EXIT_SAPLL03T_003

Hi all!
I need to collect all the same positions of a Transfer Requirment with the same material code when i create the TR.
Example
TR n. 1
Pos 1 Mat ABSX qty 10
Pos 2 Mat XXDT  qty 5
Pos 3 Mat ABSX qty 20.
Result
TR n. 1
Pos 1 Mat ABSX qty 30
Pos 2 Mat XXDT  qty 5
Pos 3 Mat ABSX qty 0.
I found the customer function in the object, EXIT_SAPLL03T_003 but it doesn't seems to work.
here the code i implemented
DATA: BEGIN OF t_matnr OCCURS 0,
      matnr LIKE ltbp-matnr,
      cont  TYPE i,
      qta   LIKE vbap-zmeng.
DATA: END OF t_matnr.
DATA: x_flag.
CLEAR t_matnr.
REFRESH t_matnr.
LOOP AT xh_ltbp.
  CLEAR t_matnr.
  READ TABLE t_matnr WITH KEY matnr = xh_ltbp-matnr.
  IF sy-subrc EQ 0.
    MOVE xh_ltbp-matnr TO t_matnr-matnr.
    ADD 1 TO t_matnr-cont.
    ADD xh_ltbp-menge TO t_matnr-qta.
    MODIFY t_matnr INDEX sy-tabix.
  ELSE.
    MOVE xh_ltbp-matnr TO t_matnr-matnr.
    ADD 1 TO t_matnr-cont.
    ADD xh_ltbp-menge TO t_matnr-qta.
    APPEND t_matnr.
  ENDIF.
  CLEAR t_matnr.
ENDLOOP.
LOOP AT t_matnr WHERE cont GT 1.
  CLEAR x_flag.
  LOOP AT xh_ltbp WHERE matnr EQ t_matnr-matnr.
    IF x_flag EQ ' '.
      MOVE t_matnr-qta TO xh_ltbp-menge.
      MOVE t_matnr-qta TO xh_ltbp-menga.
      MOVE t_matnr-qta TO xh_ltbp-tamen.
      MOVE t_matnr-qta TO xh_ltbp-tamea.
      MOVE ' ' TO xh_ltbp-elikz.
      MOVE 'X' TO x_flag.
    ELSE.
      MOVE 0 TO xh_ltbp-menge.
      MOVE 0 TO xh_ltbp-menga.
      MOVE 0 TO xh_ltbp-tamen.
      MOVE 0 TO xh_ltbp-tamea.
      MOVE 'X' TO xh_ltbp-elikz.
    ENDIF.
    MOVE-CORRESPONDING xh_ltbp TO xv_ltbp.
    APPEND xv_ltbp.
    CLEAR xv_ltbp.
  ENDLOOP.
ENDLOOP.
xv_ltbk[] = xh_ltbk[].

Hi,
U have done good coding, small mistake in second loop, u maintain flag its not enoughf for single value variable. because u have multipul materials so u have create one flag internal table to maintain which r materials u have updated.
so u have to create one more internal table with field of MATNR.
while modifying internal table write below syntax.
MODIFY TABLE ITAB.
exp code:
DATA: BEGIN OF itab OCCURS 0,
      field1(8) TYPE c,
      field2(10) TYPE c,
      qty   TYPE i,
      END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
      field1(8) TYPE c,
      cnt      TYPE i,
      qty      TYPE i,
      END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0,
      field1(8) TYPE c,
      END OF itab2.
DATA var(8) TYPE c.
itab-field1 = 'MATNR1'.
itab-field2 = 'line1'.
itab-qty = 2.
APPEND itab.
itab-field1 = 'MATNR2'.
itab-field2 = 'line2'.
itab-qty = 3.
APPEND itab.
itab-field1 = 'MATNR1'.
itab-field2 = 'line3'.
itab-qty = 4.
APPEND itab.
LOOP AT itab.
  READ TABLE itab1 WITH KEY field1 = itab-field1.
  IF sy-subrc = 0.
     itab1-field1 = itab-field1.
    ADD 1 TO itab1-cnt.
    ADD itab-qty TO itab1-qty.
    MODIFY itab1 INDEX sy-tabix.
  ELSE.
    itab1-field1 = itab-field1.
    itab1-cnt = 1.
    itab1-qty = itab-qty.
    APPEND itab1.
  ENDIF.
ENDLOOP.
loop at itab.
  write :/ itab-field1, itab-field2, itab-qty.
  ENDLOOP.
LOOP AT itab.
  READ TABLE itab2 WITH KEY  field1 = itab-field1.
  IF sy-subrc <> 0.
    READ TABLE itab1 WITH KEY field1 = itab-field1.
    MOVE itab1-qty TO itab-qty.
    MODIFY TABLE  itab . "INDEX sy-tabix.
    itab2-field1 = itab-field1.
    APPEND itab2.
  ELSE.
    MOVE 0 TO itab-qty.
    MODIFY TABLE itab ."INDEX sy-tabix.
  ENDIF.
ENDLOOP.
ULINE.
write : / 'output is '.
LOOP AT itab.
  WRITE : / itab-field1, itab-field2, itab-qty.
ENDLOOP.

Similar Messages

  • MB31 - EXIT_SAPLL03T_003

    Hello Everyone!!
    I am using this user-exit EXIT_SAPLL03T_003 to try to CHANGE the Storage Location Inside the Transport Requirement.
    What I am doing is basically this:
    DATA: wa_ltbp TYPE ltbp,
          wa_ltbk TYPE ltbk.
    READ TABLE XH_LTBK INTO wa_ltbk INDEX 1.
    READ TABLE XH_LTBP INTO wa_ltbp INDEX 1.
    APPEND WA_LTBK TO XV_LTBK.
    WA_LTBP-LGORT = '0301'.
    APPEND WA_LTBP TO XV_LTBP.
    (The '0301' hard-coded is just a TEST).
    The problem is this is NOT working... no matter WHAT I do... the field LGORT stays BLANK in table LTBP and in any TR t-code I look.
    Any ideas???
    Thanks in advance!
    Fernanda

    Actually yes, it's checked... because if we don't check it, we cannot supply raw materials!!
    But we need to avoid this for semi-finished goods.
    That's why we're trying the user'exit...
    Any ideas?!
    Thanks and best regards,
    Fernanda

  • EXIT_SAPLL03T_003 in MB31

    Hello Everyone!!
    I am using this user-exit to try to CHANGE the Storage Location Inside the Transport Requirement.
    What I am doing is basically this:
    DATA: wa_ltbp TYPE ltbp,
          wa_ltbk TYPE ltbk.
    READ TABLE XH_LTBK INTO wa_ltbk INDEX 1.
    READ TABLE XH_LTBP INTO wa_ltbp INDEX 1.
    APPEND WA_LTBK TO XV_LTBK.
    WA_LTBP-LGORT = '0301'.
    APPEND WA_LTBP TO XV_LTBP.
    (The '0301' hard-coded is just a TEST).
    The problem is this is NOT working... no matter WHAT I do... the field LGORT stays BLANK in table LTBP and in any TR t-code I look.
    Any ideas???
    Thanks in advance!
    Fernanda

    Hi Fernanda
    I don't know the exit EXIT_SAPLL03T_003, but it's called by L_LK01_VERARBEITEN: it's called at the end of that fm, just after updating all standard table, so in particular LTBP:
    * Transportbedarfspositionen hinzufügen
      INSERT LTBP FROM TABLE V_HLTBP.
      IF SY-SUBRC NE 0.
        MESSAGE A515 WITH V_HLTBP-LGNUM V_HLTBP-TBNUM V_HLTBP-TBPOS.
      ENDIF.
    * Transportbedarfsköpfe verändern
      UPDATE LTBK FROM TABLE V_SLTBK.
        IF SY-SUBRC NE 0.
          MESSAGE A510 WITH V_SLTBK-LGNUM V_SLTBK-TBNUM.
        ENDIF.
      UPDATE LTBP FROM TABLE V_SLTBP.
          IF SY-SUBRC NE 0.
            MESSAGE A511 WITH V_SLTBP-LGNUM V_SLTBP-TBNUM V_SLTBP-TBPOS.
          ENDIF.
    *     From here you may send created or changed Transfer Requirements *
    *     to a subsystem.
        CALL CUSTOMER-FUNCTION '003'
           TABLES XV_LTBK = V_SLTBK
                  XV_LTBP = V_SLTBP
                  XH_LTBK = V_HLTBK
                  XH_LTBP = V_HLTBP.
    Just as It's indicated in the standard code, it seems that exit is to store the data in another system, for example to store some data in additional custom tables
    Max

  • Update transfer requirement user exit, with order

    Dear experts,
    I want to use exit MWMTR001, function module EXIT_SAPLL03T_003 to update the Transfer requirement with the Order number created in COR1.
    But I see that by the time the user exit is called, the order number has not yet been created in the database.
    Is there maybe another place to do what I want?
    Thank you in advance,
    Roxani Athousaki

    Hi Frenchy,
    Thanks for the answer. I have one more question.
    Is it possible to automate it based on a movement type, so that every time we create a Transfer Order for this movement type the relevant TR will be automatically marked for 'final delivery'. This would help us, because then we would not have to go to WAM everytime to mark it as complete.
    Or some kind of configuration that will dictate that only one Transfer order will be allowed for a Transfer Requirement and the TR will be set to complete as soon as the TO is confirmed.
    Thanks,
    Mike

Maybe you are looking for

  • Can I upgrade iCloud storage using iTunes cards for payment?

    I have chosen not to use my credit card in conjunction with my AppleID, so I purchase all of my apps and media using iTunes cards.  Can I pay for upgraded iCloud storage using iTunes credits?  I would prefer to pay one year at a time using those cred

  • When using URLConnection read input stream error

    hi, In my applet I build a URLConnection, it connect a jsp file. In my jsp file I refer to a javaBean. I send two objects of request and response in jsp to javaBean. In javabean return output stream to URLConnect. At that time a error happened.WHY???

  • Video Setting greyed out

    Hi, I'm trying to find a way to control my blacks while digitizing footage in via a component cable and a aja Kona LHE card. I noticed that in the clip settings on the digitize window there are slioders for hue,sat, bright, Contras, black and white b

  • Help creating a report with Financial Reporting Studio.

    Hi, Im new at Financial Reporting Studio so my question might be something very easy, for beginners. Im trying to create a report with two columns where in each column there is the year dimension. In the first column there is the current POV for year

  • HT1379 MacBook Pro won't turn on all of s sudden

    Did anyone get it started on their own?