cancel
Showing results for 
Search instead for 
Did you mean: 

Database Table getting updated after triggering an Idoc

masna_7
Participant
0 Kudos
154

Hi Experts, 

 

I have am issue in fetching the data from ADRC Table. Please find the details below : 

 

I have written a custom enhancement where I am triggering an Idoc whenever a PR is Created in SAP using the BADI ME_REQ_POSTED. And I am using the Idoc type PREQCR1 to populate the Idoc. The Issue I am facing here is populating the Idoc Address Segments.

 

Whenever there is a address change in PR, that address is getting saved into ADRC after this Idoc has been triggered because of a COMMIT WORK was placed later in the Standard Code. This standard code is currently available after this BADI ME_REQ_POSTED. So, the address segments in the Idoc is not getting populated with the latest Address.

 

How can I counter this Issue. Help greatly appreciated.

 

Thanks and Regards.

View Entire Topic
raymond_giuseppi
Active Contributor
0 Kudos

If not yet saved to database, the address should be available in memory of function group SZA0, did you alread try to

  • Assign this data from main program of function group (e.g. itab XADRC of SAPLSZA0) 
  • Or find an FM of the group that read this data
masna_7
Participant
0 Kudos
HI Raymond, I have not tried the above scenarios, Can you please help me with a Sample Code.
raymond_giuseppi
Active Contributor

First step is to find the correct location of those data in Function Group, did you perform it, e.g. debug ?

Only if succesful, then start coding

FIELD-SYMBOLS: <xadrc> TYPE adrc_tab.
ASSIGN ('(SAPLSZA0)XADRC') TO <xadrc>.

 

masna_7
Participant
0 Kudos
Hi Raymond, Yes, this is working and now I can send data into Idoc even before it updates the ADRC Table. Thank you so much Raymond.
masna_7
Participant
0 Kudos

Hi Raymond, I encountered a New Issue when copying address for multiple line item PRs.

Suppose, there are 3 line items for PR and these 3 line items have different address, in the Idoc, only the address data of the 3rd line item is getting copied for all 3 line items. This might be because, the 3rd line items is edited and saved at last. Any solution for this one ?

 

I am reading all the 3 line items in  a loop to populate the Idoc segments.

raymond_giuseppi
Active Contributor
0 Kudos
XADRC is an internal table, with luck you should find different address numbers, else try to navigate in debug