Skip to Content
Technical Articles

Split Transfer order without Customizing in WM

Introduction

There are various sap references available where the Transfer order split is achieved through customizing. In this blog, I will discuss about achieving transfer order split only through the coding.

 

Enhancement

MWMTO012 . Function Exit EXIT_SAPLL03A_012 of the given enhancement has to be used in order to implement this.

When this exit is called during the transfer order creation, Split because of customizing has already taken place.

Transfer%20order%20positions%20structure

Transfer order positions structure

Component POOLN of the position structure has to be used in order to perform the Splitting. Positions which are having same POOLN value will be part of the same transfer order.

Business Scenario

Split has to be performed on the basis of vltyp. Positions belonging to the vltyp ‘abc’ ‘def’ should not be in the same transfer order which contains positions with other vltyp’s.

Splitting Logic

 DATA: lt_ltap_onelevel TYPE TABLE OF ltap_vb,
        lt_ltap_3level   TYPE TABLE OF ltap_vb,
        lt_ltap_working  TYPE TABLE OF ltap_vb.

  DATA:
    lv_pooln_next  TYPE i,
    lv_pooln_last  TYPE i .

  DATA : lv_split_done TYPE xfeld .

* Sorting in order to find the last pooln used.
  SORT  t_ltap_vb ASCENDING BY pooln.
* Separating the Transfer order items on the basis of vltyp .
  LOOP AT t_ltap_vb INTO DATA(ls_ltap) .
    IF ls_ltap-vltyp EQ 'abc' OR ls_ltap-vltyp EQ 'def' .
      APPEND ls_ltap TO lt_ltap_onelevel.
    ELSE.
      APPEND ls_ltap TO lt_ltap_3level.
    ENDIF.
    lv_pooln_last = ls_ltap-pooln.
  ENDLOOP.
  IF lt_ltap_onelevel[] IS NOT INITIAL AND lt_ltap_3level[] IS INITIAL.             " Only level 1 transfer order Items, No Split required. Split might already be there , should not be changed.
  ELSEIF lt_ltap_onelevel[] IS INITIAL AND lt_ltap_3level[] IS NOT INITIAL.         " Only Level 3 transfer order Items. No Split Required. Split might already be there , should not be changed.
  ELSEIF lt_ltap_onelevel[] IS NOT INITIAL AND lt_ltap_3level[] IS NOT INITIAL.     " Split could be required.
*   Copy the TO table to local for splitting .
    lt_ltap_working[] = t_ltap_vb[].
*   Generate next pooln value that can be used .
    lv_pooln_next = lv_pooln_last + 1 .
    CLEAR: ls_ltap.
    LOOP AT lt_ltap_working INTO ls_ltap WHERE vltyp EQ 'abc' OR vltyp EQ 'def'.
      CLEAR: lv_split_done .
      LOOP AT t_ltap_vb ASSIGNING FIELD-SYMBOL(<ls_ltap>) WHERE pooln EQ ls_ltap-pooln and vltyp NE 'abc' and vltyp NE 'def'.
        <ls_ltap>-pooln = lv_pooln_next.
        lv_split_done = 'X' .
      ENDLOOP.
      IF lv_split_done = 'X'.
        ADD 1 TO lv_pooln_next .
      ENDIF.
    ENDLOOP.
  ENDIF.

 

Since we dont want to change the already performed splitting because of customizing, it is important to check for splitting of items which contains same pooln value.

If there are any Questions, please comment below.

Best regards

Ketan

/
Transfer%20order%20positions%20structure
Be the first to leave a comment
You must be Logged on to comment or reply to a post.