‎2009 Nov 30 12:07 PM
Hi Experts,
I need to populate outbound Idoc in my development for the same I am using Method: MB_DOCUMENT_BEFORE_UPDATE.
But in the same I need to populate field called 'adrc-regiogroup', I am using below logic to populate >>
first get material document number then use it to retrieve ser03obknr, then use it for objkobknr which inturn will give objkequnr, then use it to find equzequnr then equziloan, from it iloailoan then from it iloaadrnr then adrcaddrnumber and from then retrieve 'adrc-regiogroup'.
SELECT ser03~mblnr
adrstreet~strt_code
adrc~regiogroup
INTO TABLE lt_rgroup
FROM adrstreet AS adrstreet
JOIN adrc AS adrc ON adrc~streetcode = adrstreet~strt_code
AND adrc~country = adrstreet~country
JOIN iloa AS iloa ON iloa~adrnr = adrc~addrnumber
JOIN equz AS equz ON equz~iloan = iloa~iloan
JOIN objk AS objk ON objk~equnr = equz~equnr
JOIN ser03 AS ser03 ON objk~obknr = ser03~obknr
FOR ALL ENTRIES IN xt_xmseg
WHERE ser03~mblnr = xt_xmseg-mblnr
AND ser03~mjahr = xt_xmseg-mjahr
AND ser03~zeile = xt_xmseg-zeile.
but problem with this is that BADI gets triggered before COMMIT of sap database, so basically SER03 table is not updated with respective material document entry.
so I need either exit which gets triggered after sap commit, so that I will be able to execute above code
or
I need other logic to retrieve data from table adrc.
Please let me know as soon as possible.
Thanks.
‎2009 Nov 30 1:37 PM
use MB_DOCUMENT_UPDATE method of the same BADI. Its triggered in update task.
‎2009 Nov 30 12:18 PM
You can try out
Business object BUS2017
event GoodsMovement.created Created
Check if its useful
‎2009 Nov 30 1:29 PM
‎2009 Nov 30 1:37 PM
use MB_DOCUMENT_UPDATE method of the same BADI. Its triggered in update task.
‎2009 Nov 30 1:41 PM
Hi Rajesh,
I tried to put breakpoint in MB_DOCUMENT_UPDATE, but its not getting triggered.
are you sure? or am i doing anything wrong?
Thanks.
‎2009 Nov 30 1:46 PM
this method is triggered in update task.
Put a break-point inside the method. Excute the Tcode in debug mode. while debugging goto Settings menu in the same session and click Update debugging. At the bottom you can see the message update debugging switched on.
Points :
You cannot write any code in method which is called in update task which contains implicit or explicit commit ex call transaction , call screen , commit work etc.
Workarounds :
you can wrap you code in a FM and call that FM in update task or starting new task.
‎2009 Nov 30 3:18 PM
Hi All,
Thanks for your quick response.
Yes, my code is wrapped in FM only. This BADI gets triggered before SAP Commit. I want to retrieve data from SER03 corresponding to material document number intiated in MIGO.
So current flow is --> MIGO --> INPUT DATA --> SAVE --> BADI triggered (my FM wrapped in it) --> SAP COMMIT (SER03 updated) .
But I want flow --> MIGO --> INPUT DATA --> SAVE --> SAP COMMIT (SER03 updated) --> BADI or ANYTHING triggered (my FM wrapped in it)
I want something which is after SAP commit.
I checked BUS2017 and it is not working for me.
or any other solution/suggestion would be really useful.
Thanks.
Edited by: Nikhil Jathar on Nov 30, 2009 9:18 AM
‎2009 Nov 30 3:42 PM
did you try calling the FM in update task or starting new task in the method I suggested earlier. It works .
‎2009 Nov 30 3:50 PM
‎2009 Nov 30 4:06 PM
Hi Rajesh, it does work.
Actually when I tried to execute it in debugging mode it wasn't working, but later I tested it on some custom tables to check whether it populates any after commit value/s, it worked. Great.
Thanks.