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: 

Comparing contents of line items

Former Member
0 Kudos

Hi Guru's,

The requirement to change the automatically assigned Mail route in Sales order user exit.

If order type is ZCO1 or ZCO4 and delivery plant is 3PL2, select all line items and check for ROUTE = '000015'

If any one line item contains route as 000015 then need to proceed further steps otherwise exit.

If there is 1 more route other than 000015 then need to change the route 000015 to the other route.

If there are 2 or more routes other than 000015 then don't change any thing and exit.

<removed_by_moderator>

Regards,

Srinivas.

Edited by: Julius Bussche on Sep 8, 2008 1:30 PM

1 REPLY 1

uwe_schieferstein
Active Contributor
0 Kudos

Hello Srinivas

The field VBAP-ROUTE (salesorder -> item details -> tabstrip Shipping ) is available in user-exit (routine) USEREXIT_SAVE_DOCUMENT_PREPARE (program SAPMV45A, include MV45AFZZ). Apparently, if you modify this user-exit then you can manipulate the data before they are saved into the DB, e.g.:


FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

  DATA: ls_xvbap     LIKE LINE OF  xvbap,
            ld_count      TYPE i.

  CHECK ( vbak-auart = 'ZC01'  OR vbak-auart = 'ZC04' ).

  " Assumption: all items have same delivery plant
  READ TABLE xvbap[] INTO ls_xvbap INDEX 1.
  CHECK ( ls_xvbap-werks = '3PL2' ).

  ld_count = 0.
  LOOP AT xvbap TRANSPORTING NO FIELDS
                 WHERE ( route = '000015' ).
    ADD 1 TO ld_count.
  ENDLOOP.

  CASE ld_count.
    WHEN '1'.

    WHEN '2'.

    WHEN OTHERS.
    ENDCASE.

ENDFORM.

Regards

Uwe