Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read from inbound IDOC

Former Member
0 Kudos

Our WMS kicks off IDOCs  SHP_OBDLV_CONFIRM_DECENTRAL and these are inbound to SAP (our WMS does the Goods Issue).

These inbound IDOCs trigger user exit MV50AFZ1  -->  userexit_save_document.

In that user exit, I have been given a requirement to SELECT from VEKP for the handling unit header for the delivery number. (Ultimately, we are looking for the tracking number from VEKP).

This would work fine, except through debugging the user exit, I can see that VEKP doesn't get updated until after the user exit is finished. (It is updated from the E1BPDLVHDUNHDR segment from the IDOC).  Therefore, there is a timing issue; I can't access the data from the VEKP table b/c it isn't updated prior to the user exit.

Could I instead access the IDOC directly through some function / BAPI that I can call from the user exit?  (Rather than selecting VEKP?)

If so, what FM/BAPI could be used?

Is there a better design?

Thanks

Jeremy H.

5 REPLIES 5

Jelena
Active Contributor
0 Kudos

Not sure what you're trying to achieve exactly, but the IDoc fields are usually available only in the corresponding inbound IDoc user exit (this old post has a big list). Those are triggered before the transaction starts, so that the IDoc data could be modified or validated, for example.

Since it seems that the data is just being created in the transaction then, naturally, you won't be able to select it yet from the database in the ..SAVE... user exit. Instead in the user exit you'd need to read data from memory (there might be internal table VEKP available).

Again, it's not clear, unfortunately, what your goal is, so I'm just guessing.

Former Member
0 Kudos

Hi

Thanks for your reply.

Our warehouse mgmt system post goods issues for deliveries.  When it does each, it kicks off an IDOC for ship confirmation (SHP_OBDLV_CONFIRM_DECENTRAL) inbound to SAP.

Each IDOC contains delivery info and various box information for a shipment.

At the same time, MV50AFZ1 is invoked.  An external consulting group previously placed code to process data that was sourced from those IDOCs in the MV50AFZ1-->userexit_save_document.

Further processing is then done in that user exit to send shipping info back to our e-commerce site/database.

What we want to do now, is add the tracking number (sourced in that idoc) to that e-commerce processing that is sent to the website.  We thought we'd be able to access the VEKP table for the tracking number easily enough in the userexit, but through debug, I found the table isn't really updated until after that user exit (as you said, the name implies).

We reasoned that maybe (from that same user exit) we could instead find and read the right IDOC and access the segments to get tracking.  I certainly acknowledge this may not be the best solution.

Is there instead. a more appropriate user exit in MV50AFZ1 to access the updated VEKP records?  Or should I be taking a look at (a more internal XVEKP)?  I'll debug some more to see if that reveals any of the data I need.

Thanks
Jeremy H.

0 Kudos

Is there a possibility to use -

  • CALL FUNCTION <--> IN A NEW TASK ( A wait of few seconds is required initially to ensure the data from previous process is updated successfully to database )
  • CALL FUNCTION <--> IN UPDATE TASK
  • PERFORM ON COMMIT

Wherein you have to move your processing logic of updating eCommerce database into the function module / Subroutine.

Thanks, Abhinab

Jelena
Active Contributor
0 Kudos

Not sure why HU data wouldn't be populated in the user exit mentioned... Unfortunately, I'm not that familiar with HU functionality (haven't worked with it). There could be a different user exit or BADI available, google 'delivery PGI user exit'. This post and this one are just from the top of the list.

Reading the IDoc back is not going to happen, but unless this data must be in HU, you might also want to consider moving it into another IDoc segment.

There is also an option to add a custom program to the output processing. It is always executed after all the delivery updates came through, so all the data should be available in DB. I've used it a few times to trigger a process that was dependent on the update completion.

Former Member
0 Kudos

Hi,

Thank you, I'll check out the links you posted and see what I can find.

What I've found as I debugged up-and-back-out of the MV50AFz1-->userexit_save_document (where neither the HU data from the IDOC nor the updated VEKP records are yet available), is that my IDOC is processed like this...

SAPLBD20 include LBD20F0A (processes IDOCs)

     Form IDOCS_PASS_TO_APPLICATION

          (logic withiin reads tables to find my IDOC message type and calls corresponding function (which is BAPI_IDOC_INPUT1)

From that BAPI, the function is called for my IDOC type and eventually

BAPI_OUTB_DELIVERY_CONFIRM_DEC  is called.  This has the HU header passed to it, and contains the tracking number I need

I'm not sure how I will be able to get the HU data to be passed into the user exit I'm in, or if I will need to use another user exit, etc, and move my ecommerce process to a different user exit.  I'll continue to debug and research.