Application Development and Automation 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 only

LT04 BATCH INPUT TROUBLE

Former Member
0 Likes
841

Hy guys i have a little trouble with my batch input. in my table t_fabb i have many rows but just after the first batch, i have an error message:MESSAGE e000(zlo) WITH 'Errore conferma OT LT04.

If i exit from the report ang get in again , the same row that failed , succed but the next row fail etc...

i can't understand why....

LOOP AT t_fabb.    
SELECT *
      FROM ltbk
     WHERE tbnum >= t_fabb-tbnum
       AND lznum  = t_fabb-aufnr
       AND lgnum  = '050'
       AND statu <> 'E'.

      SELECT SINGLE *
        FROM ltbp
       WHERE lgnum  = '050'
         AND elikz <> 'X'
         AND matnr = t_fabb-matnr
         AND tbnum = ltbk-tbnum
         AND charg <> ''.
      IF sy-subrc = 0.
        EXIT.
      ENDIF.
    ENDSELECT.
    IF sy-subrc <> 0.
      MESSAGE e000(zlo) WITH 'Numero OT già confermata'.
      LEAVE SCREEN.SET SCREEN 0.
    ENDIF.


    CLEAR bdcdata.
    REFRESH bdcdata.

    PERFORM bdc_dynpro      USING 'SAPML03T' '0131'.
*  PERFORM bdc_field       USING 'BDC_CURSOR'
*                               'LTBK-TBNUM'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'LTAK-LGNUM'
                                  '050'.
    PERFORM bdc_field       USING 'LTBK-TBNUM'
                                  ltbp-tbnum.
    PERFORM bdc_field       USING '*LTBP-TBPOS'
                                ltbp-tbpos.
    PERFORM bdc_field       USING 'RL03T-ALAKT'
                                  'X'.
    PERFORM bdc_field       USING 'RL03T-DUNKL'
                                   'D'.

    CALL TRANSACTION 'LT04' USING bdcdata
*{   REPLACE        LGPK901791                                        1
*                     MODE 'N'  UPDATE 'S' MESSAGES INTO messtab.
                     MODE 'E'  UPDATE 'S' MESSAGES INTO messtab.
*}   REPLACE
    IF sy-subrc = 0.
      SELECT SINGLE *
        FROM ltbp
       WHERE lgnum = '050'
         AND tbnum = ltbp-tbnum
         AND tanum <> ' '.
      IF sy-subrc = 0.
        z311a-ztanum = ltbp-tanum.
      ENDIF.
      PERFORM modify_z331a.
    ELSE.
      MESSAGE e000(zlo) WITH 'Errore conferma OT LT04'.
      LEAVE SCREEN.SET SCREEN 0.
    ENDIF.

    READ TABLE messtab WITH KEY msgtyp = 'S'
                                msgid = 'LT'
                                msgnr = '100'.

  ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
696

Hi,

Just check in 'messtab' if there is some error messages.

Please note that when transfer orders are created in sequence a commit work must be placed between the calls so as to clear the global internal tables associated.

Instead of call transaction i suggest that you use the FM L_TO_CREATE_TR. Please go through teh documenttation of the FM.

Also i find that you are doing SELECT within LOOPs. Please try to avoid it. Although it is not related to your issue; but as best practices one should avoid it.

Regards,

Ankur Parab

2 REPLIES 2
Read only

Former Member
0 Likes
697

Hi,

Just check in 'messtab' if there is some error messages.

Please note that when transfer orders are created in sequence a commit work must be placed between the calls so as to clear the global internal tables associated.

Instead of call transaction i suggest that you use the FM L_TO_CREATE_TR. Please go through teh documenttation of the FM.

Also i find that you are doing SELECT within LOOPs. Please try to avoid it. Although it is not related to your issue; but as best practices one should avoid it.

Regards,

Ankur Parab

Read only

0 Likes
696

thanx (the code wasn't mine... ), i solved the trouble, it's was be4 (an authirazion to write in a table in the transaction C02.

I'll change the logical to avoid the select inside the loop.