ABAP Forum
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Processing Issue - Program RVV50R10C

akshat_ra
Explorer
0 Likes
57
Hi,

We have a background job scheduled for program RVV50R10C every 15 mins in PROD to create the outbound deliveries with a custom variant . There is custom logic implemented in  USEREXIT_SAVE_DOCUMENT in include MV50AFZ1 which MODIFY a Z DB table entry for the delivery. 

The same variant is available in quality and other systems. We see a difference in the processing of the deliveries. In case the multiple deliveries are getting created for multiple sales orders, USEREXIT_SAVE_DOCUMENT is triggering once and XLIPS will have all the deliveries at once in PROD but in case of other test systems , USEREXIT_SAVE_DOCUMENT is triggering for each delivery and XLIPS will have that specific delivery. This difference is behavior is failing out custom logic. 

The custom logic is written keeping in mind, that USEREXIT_SAVE_DOCUMENT will trigger specifically for each delivery and XLIPS will have that specific delivery. 

is there any parameter in the variant configuration of this report which is causing this behavior difference ?

Thanks

 

 

 

2 REPLIES 2
Read only

AlexandrePassarelli
Active Participant
0 Likes
41

Hi,

I don't think this is a bug. It is how VL10 builds packages, and the package size comes from customizing, not from the variant itself. I read the code in an S/4HANA 2023 system (SAP_BASIS 758).

Why the exit sees all deliveries at once

RVV50R10C does not call the delivery creation once per order. It splits the selected lines into packages and calls GN_DELIVERY_CREATE once per package (form PACKAGES_DELIVER, function group V50R_CREA).

GN_DELIVERY_CREATE then saves everything it created in that call in one go: GN_LIEFERUNGEN_BUCHEN (include LV50SF12) calls BELEG_SICHERN_01, and in form BELEG_SICHERN_POST (include FV50XF0B_BELEG_SICHERN) you find PERFORM userexit_save_document(sapmv50a). That call is not inside any loop over XLIKP. So USEREXIT_SAVE_DOCUMENT runs once per package, and XLIKP / XLIPS hold every delivery of that package.

What decides the package size

The delivery creation profile, field "Dlv Creation Profile" (P_PROF3) on the selection screen, table T186C:

  • MAX_LINES ("Maximum Lines"): the maximum number of items in one package. In form PACKAGE_EXTRACT_SINGLE (include LV50R_UTILF04) the package keeps taking the next document while it has fewer lines than this value.
  • PACKAGE_TYPE: 1 = all items for document and ship-to party, 2 = all documents in a package, 9 = user exit.

In my system the standard profiles (0001, 0002, 0101) have MAX_LINES = 1 and PACKAGE_TYPE = 1, which gives one document per call. That matches what you see in QA. A higher MAX_LINES, or package type 2, puts many orders in one call. That matches PROD.

Why the same variant behaves differently

The variant only keeps the profile name. T186C is client-dependent customizing, so the same name can have different values in each system. Also, in AT SELECTION-SCREEN ON BLOCK f14 (include V50R_ON_BLOCK), when "Use List Profile" is set or the profile name changes, the report reads T186C again (SELECT SINGLE * FROM t186c) and overwrites the values on the screen.

What I would do

  1. Compare the profile in PROD and QA: SM30 view V_T186C, or the SPRO activity "Maintain Parameters for Creating Deliveries". I expect MAX_LINES or PACKAGE_TYPE to be different.
  2. Fix the exit anyway. Even with MAX_LINES = 1, one order can still split into more than one delivery in the same call, so "one delivery per call" is never guaranteed. Loop over XLIKP and read the items of each delivery:
FORM userexit_save_document.
  " one call can carry many deliveries (one VL10 package): loop, never READ ... INDEX 1
  LOOP AT xlikp WHERE updkz <> 'D'.
    LOOP AT xlips WHERE vbeln = xlikp-vbeln
                    AND updkz <> 'D'.
      " build your Z row for xlikp-vbeln / xlips-posnr here
    ENDLOOP.
  ENDLOOP.
  " then one MODIFY ztable FROM TABLE ... for the whole call
ENDFORM.

If you prefer a BAdI instead of the user exit: LE_SHP_DELIVERY_PROC, method SAVE_AND_PUBLISH_DOCUMENT, is called in the same form right before the exit and gets the same tables (IT_XLIKP, IT_XLIPS...). It needs the same loop.

Not tested: I did not run VL10 in a background job or debug a real package. Everything above comes from reading the code and the T186C entries in my lab (S/4HANA 2023). The loop above passed the syntax check with the LIKPVB / LIPSVB types, but not inside your MV50AFZ1.

Read only

Lakshmipathi
Active Contributor
0 Likes
15

Compare the IMG Logistics Execution -> Shipping -> Worklists -> Maintain Parameters for Creating Deliveries settings. Also, manually, execute the program RVV50R10C in both the environments. There, go to User Role tab and check both the systems. There should be some difference