Skip to Content
author's profile photo Former Member
Former Member

BATCH INPUT MB11

Hello,

i encounter some problems,

when i do a batch input

on mb11

ok the strange thing is:

when i enter the transaction MB11 with a production order

i see 16 positions.

when i enter it during the batch, there are only 15 positions on the screen.

if i check the resb, i can see 16 articles being linked to the production order.

"magic" input?

well, perhaps i missed a check or something like that,

but why are 15 positions visible if i enter the transaction in batch mode and 16 if i enter it normally?

to make the whole thing clear to you, i post the complete code of my abap below:

REPORT zj_gl_pp_orders_mb11_batch .
CONSTANTS: c_autyp10 TYPE t003o-autyp VALUE 10,
           c_num_of_tv_lines type i VALUE 24.

TYPES: BEGIN OF s_auart,
       auart TYPE t003o-auart,
       END OF s_auart,

       BEGIN OF s_auftraege,
         aufnr TYPE aufk-aufnr,
         objnr TYPE aufk-objnr,
         rsnum type afko-rsnum,
         erdat TYPE aufk-erdat,
         auart TYPE aufk-auart,
       END OF s_auftraege,
*********************
       BEGIN OF s_sel,
       sign(1),
       option(2),
       low(8) TYPE c,
       high(8) TYPE c,
       END OF s_sel,

       BEGIN OF s_lgort,
        matnr TYPE mard-matnr,
        lgort TYPE mard-lgort,
        labst type mard-labst,
       END OF s_lgort,

       table_lgort TYPE TABLE OF s_lgort,
       table_sel   TYPE STANDARD TABLE OF s_sel   WITH DEFAULT KEY,
       table_auart TYPE STANDARD TABLE OF s_auart WITH DEFAULT KEY,
       table_auftraege TYPE STANDARD TABLE OF s_auftraege WITH DEFAULT
                                                               KEY,
       line_lgort TYPE LINE OF table_lgort.

*data objects.
DATA: gt_batch LIKE bdcdata OCCURS 0 WITH HEADER LINE,
      gt_resb like table of resb,
      gt_lgort TYPE table_lgort,
      gt_auftraege type table_auftraege,
      gt_auart type table_auart,
      sel_auart TYPE table_sel,
      messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA: wa_batch LIKE LINE OF gt_batch,
      wa_auftraege like line of gt_auftraege,
      wa_resb like line of gt_resb,
      wa_auart like line of gt_auart,
      wa_sel_auart TYPE LINE OF table_sel,
      wa_lgort TYPE line_lgort.

Field-Symbols: <table> type any table,
               <wa>    type any,
               <field> type any.

*PARAMETERS: p_aufnr TYPE afko-aufnr.
*******************SCREEN LAYOUT
SELECT-OPTIONS:
so_auart FOR wa_auftraege-auart,
so_aufnr FOR wa_auftraege-aufnr,
so_erdat FOR wa_auftraege-erdat,
so_objnr FOR wa_auftraege-objnr.
**********************************


START-OF-SELECTION.
  PERFORM get_relevant_orders.
  if not gt_auftraege[] is initial.
    PERFORM select_data.
    PERFORM fill_batch.
    perform output_messtab.
  endif.
END-OF-SELECTION.




*---------------------------------------------------------------------*
*       FORM bdc_field                                                *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  p_fnam                                                        *
*  -->  p_fval                                                        *
*---------------------------------------------------------------------*
FORM bdc_field USING p_fnam p_fval.
  IF p_fval <> '/'.
    CLEAR gt_batch.
    gt_batch-fnam = p_fnam.
    gt_batch-fval = p_fval.
    APPEND gt_batch.
  ENDIF.
  CLEAR gt_batch.
ENDFORM.


*---------------------------------------------------------------------*
*       FORM bdc_dynpro                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  p_program                                                     *
*  -->  p_screennumber                                                *
*---------------------------------------------------------------------*
FORM bdc_dynpro USING p_program p_screennumber.
  gt_batch-program = p_program.
  gt_batch-dynpro  = p_screennumber.
  gt_batch-dynbegin = 'X'.
  APPEND gt_batch.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM fill_batch                                               *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM fill_batch.
  DATA: dref TYPE REF TO data,
        l_auftrag TYPE string,
        l_fldname TYPE string,
        l_remainder type i, "modulorest des end_of_page checks
        l_lines TYPE sy-tabix,
        l_wert type string,
        l_pos(2) type n,
        counter type i,
        supercount type i.

  FIELD-SYMBOLS: <wa_messtab> TYPE ANY,
                 <fldname> TYPE ANY,
                 <wert>    type any.

  ASSIGN gt_auftraege TO <table>.
  CREATE DATA dref LIKE LINE OF <table>.
  ASSIGN dref->* TO <wa>.
  LOOP AT <table> INTO <wa>.

  IF NOT gt_batch[] IS INITIAL.
    FREE gt_batch.
  ENDIF.
  ASSIGN COMPONENT 'AUFNR' OF STRUCTURE <wa> TO <field>.
  l_auftrag = <field>.






********************batch
  PERFORM bdc_dynpro      USING 'SAPMM07M' '0400'.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                'RM07M-BWARTWA'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=NFAL'.
  PERFORM bdc_field       USING 'RM07M-BWARTWA'
                                ''.
  PERFORM bdc_field       USING 'RM07M-XNUVR'
                                'X'.
  PERFORM bdc_dynpro      USING 'SAPMM07M' '1405'.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                'RM07M-AUFNR(01)'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=OK'.
  PERFORM bdc_field       USING 'RM07M-AUFNR(01)'
                                 l_auftrag.
  PERFORM bdc_dynpro      USING 'SAPMM07M' '0421'.
**************hier die felder des table views fuellen.
clear counter.


ASSIGN COMPONENT 'RSNUM' OF STRUCTURE <wa> TO <field>.
l_wert = <field>.



*********BEGINN DES DURCHLAUFS
loop at gt_resb into wa_resb where rsnum = l_wert.
  supercount = supercount + 1.
  counter = counter + 1.
  clear l_fldname.
  clear l_pos.
  read table gt_lgort into wa_lgort with key matnr = wa_resb-matnr.
    if sy-subrc = 0. "also wenn bestand existiert.
********Die maximale Anzahl der Zeilen betraegt 24.
********Insofern wird wenn die l_pos modulo 24 = 0
********ist, ein "=p+" durchgefuehrt, und l_pos danach wieder auf 01
********gesetzt
        l_pos = counter.
*************markieren zum Verbrauch
        concatenate 'RM07M-XSELK(' l_pos ')' into l_fldname.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                       l_fldname.
        PERFORM bdc_field       USING  l_fldname
                                      'X'.
        clear l_fldname.
************zu verbrauchende Menge**************************
        concatenate 'MSEG-ERFMG(' l_pos ')' into l_fldname.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                       l_fldname.
        PERFORM bdc_field       USING  l_fldname
                                      '1'.
        clear l_fldname.
************Lagerort des Materials***************************
        concatenate 'MSEG-LGORT(' l_pos ')' into l_fldname.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                       l_fldname.
        PERFORM bdc_field       USING  l_fldname
                                       wa_lgort-lgort.
        clear l_fldname.
    endif.
****end_of_page check
    l_remainder = counter mod c_num_of_tv_lines.
    check l_remainder = 0.
****naechste seite.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=P+'.
        PERFORM bdc_field       USING 'BDC_SUBSCR'
                                      'SAPMM07M'.
        PERFORM bdc_field       USING 'BDC_SUBSCR'
                                      'SAPLKACB'.
        PERFORM bdc_dynpro      USING 'SAPLKACB'
                                      '0002'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EENTE'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'COBL-GSBER'.
        PERFORM bdc_field       USING 'BDC_SUBSCR'
                                      'SAPLKACB'.
        PERFORM bdc_dynpro      USING 'SAPMM07M'
                                      '0421'.
****counter auf 0 zuruecksetzen.
        counter = 0.
endloop.
*****************ENDE DES DURCHLAUFS










*ABSCHLIESSENDE VERBUCHUNG (so oft enter ausfuehren, wie positionen
*existieren, plus eine weitere ausfuehrung zur abschliessenden
*bestaetigung)
supercount = supercount + 1.
PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=BU'.
PERFORM bdc_field       USING 'BDC_SUBSCR'
                               'SAPMM07M'.
PERFORM bdc_field       USING 'BDC_SUBSCR'
                               'SAPLKACB'.
do supercount  times.
        PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EENTE'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'COBL-GSBER'.
        PERFORM bdc_field       USING 'BDC_SUBSCR'
                                      'SAPLKACB'.
enddo.





  CALL TRANSACTION 'MB11' USING gt_batch
                                MODE 'N'
                                UPDATE 'S'
                                MESSAGES INTO messtab.
  CLEAR l_fldname.
  free gt_batch.
  CONCATENATE l_auftrag ' ' INTO l_fldname.
  messtab-fldname = l_fldname.
  DESCRIBE TABLE messtab LINES l_lines.
  READ TABLE messtab INDEX l_lines ASSIGNING <wa_messtab>.
  ASSIGN COMPONENT 'FLDNAME' OF STRUCTURE <wa_messtab> TO <fldname>.
  <fldname> = l_fldname.

  ENDLOOP.
ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM select_data.
  DATA: lt_resb LIKE TABLE OF resb,
        wa_resb LIKE LINE OF lt_resb.

  DATA: BEGIN OF materials OCCURS 0,
              matnr TYPE mard-matnr,
        END OF materials.

  Data: l_value type string.
  Field-Symbols: <wa> type any,
                 <field> type any.

  SELECT *
  FROM afko
       INNER JOIN
                 resb
                 ON afko~rsnum = resb~rsnum
                 INTO CORRESPONDING FIELDS
                 OF TABLE lt_resb
                 for all entries in
                                 gt_auftraege
                 WHERE afko~aufnr = gt_auftraege-aufnr
*                AND   resb~bdmng > resb~enmng
                 AND   resb~XWAOK = 'X'
                 AND   resb~KZEAR = 'X'.

*Wichtig:
*Hat ein Material einen Bestand in einem Lagerort
*der zu dem Werk passt, zu dem es zugeordnet ist?
*Nur diese Materialien werden in der MB11 verbraucht.
*in mard den relevanten lagerort abfragen
*entsprechend dem korrekten LABST ( x > 0 ).

check not lt_resb is initial.

SELECT matnr
       lgort
       labst
       FROM
       mard
       INTO TABLE gt_lgort
       FOR ALL ENTRIES IN lt_resb
       WHERE matnr = lt_resb-matnr
       and werks   = lt_resb-werks
       AND labst   > 0.

sort gt_lgort by matnr labst descending.

if sy-subrc = 0.
  DELETE ADJACENT DUPLICATES FROM gt_lgort COMPARING matnr.
*korrekten lagerort eintragen.
  loop at gt_lgort into wa_lgort.
    read table lt_resb with key matnr = wa_lgort-matnr assigning <wa>.
    if sy-subrc = 0.
      assign component 'LGORT' of structure <wa> to <field>.
      <field> = wa_lgort-lgort.
    endif.
  endloop.
  gt_resb[] = lt_resb[].
endif.

ENDFORM.                    " SELECT_STORAGE_DATA

*---------------------------------------------------------------------*
*       FORM output_messtab                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM output_messtab.                   "
  DATA: len TYPE i.
  DATA: flag.
  DATA: c_msg LIKE t100-text.
  DATA: data_temp TYPE REF TO data.
  FIELD-SYMBOLS: <fs> TYPE c, <wa> TYPE ANY, <l_field> TYPE ANY.

  delete adjacent duplicates from messtab comparing FLDNAME.

  CREATE DATA data_temp TYPE t100.
  ASSIGN data_temp->* TO <wa>.
*  SKIP.

  delete messtab where msgtyp = 'S'
                 and   msgnr  = '654'.


  LOOP AT messtab.

*    IF ( messtab-msgid = 'IW' AND messtab-msgnr = '085' ) or
*       ( messtab-msgid = 'IW' AND messtab-msgnr = '080' ).
*      inp-bem = text-133.
*    ENDIF.
    SELECT SINGLE * FROM t100
     INTO <wa>                                              "T100
      WHERE sprsl = messtab-msgspra AND
            arbgb = messtab-msgid AND
            msgnr = messtab-msgnr.
    CHECK sy-subrc EQ 0.
    ASSIGN COMPONENT 'TEXT' OF STRUCTURE <wa> TO <l_field>.
    c_msg = <l_field>.
    IF NOT messtab-msgv1 IS INITIAL.
      len = strlen( messtab-msgv1 ).
      ASSIGN messtab-msgv1+0(len) TO <fs>.
      REPLACE '&1' WITH <fs> INTO c_msg.
      IF sy-subrc NE 0.
        REPLACE '&' WITH <fs> INTO c_msg.
      ENDIF.
    ENDIF.
    IF NOT messtab-msgv2 IS INITIAL.
      len = strlen( messtab-msgv2 ).
      ASSIGN messtab-msgv2+0(len) TO <fs>.
      REPLACE '&2' WITH <fs> INTO c_msg.
      IF sy-subrc NE 0.
        REPLACE '&' WITH <fs> INTO c_msg.
      ENDIF.
    ENDIF.
    IF NOT messtab-msgv3 IS INITIAL.
      len = strlen( messtab-msgv3 ).
      ASSIGN messtab-msgv3+0(len) TO <fs>.
      REPLACE '&3' WITH <fs> INTO c_msg.
      IF sy-subrc NE 0.
        REPLACE '&' WITH <fs> INTO c_msg.
      ENDIF.
    ENDIF.
    IF NOT messtab-msgv4 IS INITIAL.
      len = strlen( messtab-msgv4 ).
      ASSIGN messtab-msgv4+0(len) TO <fs>.
      REPLACE '&4' WITH <fs> INTO c_msg.
      IF sy-subrc NE 0.
        REPLACE '&' WITH <fs> INTO c_msg.
      ENDIF.
    ENDIF.
    CASE messtab-msgtyp.
      WHEN 'W'.
        FORMAT COLOR 3.                "gelb
        IF flag = 'X'.
          FORMAT INTENSIFIED ON.
          CLEAR flag.
        ELSE.
          FORMAT INTENSIFIED OFF.
          flag = 'X'.
        ENDIF.
      WHEN 'E' OR 'A'.
        FORMAT COLOR 6.                                     "rot
        IF flag = 'X'.
          FORMAT INTENSIFIED ON.
          CLEAR flag.
        ELSE.
          FORMAT INTENSIFIED OFF.
          flag = 'X'.
        ENDIF.
      WHEN OTHERS.
        FORMAT COLOR 5.                "grün
        IF flag = 'X'.
          FORMAT INTENSIFIED ON.
          CLEAR flag.
        ELSE.
          FORMAT INTENSIFIED OFF.
          flag = 'X'.
        ENDIF.
    ENDCASE.
    WRITE: /4 messtab-msgtyp(1), messtab-msgid(4), messtab-msgnr(3),
messtab-fldname(15), c_msg.
*    WRITE: /4 c_msg, order-aufnr.
    FORMAT RESET.
  ENDLOOP.

*  CLEAR messtab.
*  REFRESH messtab.
ENDFORM.                               " OUTPUT_MESSTAB

*&---------------------------------------------------------------------*
*&      Form  GET_RELEVANT_ORDERS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_relevant_orders.
*selektiere alle auftragsarten vom Typ PPS-Fertigungsauftrag
if so_auart[] is initial and so_aufnr[] is initial.
  PERFORM get_pps_auftragsarten.
endif.
*selektiere alle auftraege aus der AUFK, die den PPS-Auftragsarten
*zugeordnet wurden.
  PERFORM get_pps_auftraege.
  if not gt_auftraege[] is initial.
     perform check_resb.
  endif.
endform.                    " GET_RELEVANT_ORDERS

FORM get_pps_auftragsarten.
  IF so_auart[] IS INITIAL.

    SELECT
          auart
          FROM t003o
          INTO TABLE
               gt_auart
               WHERE autyp = c_autyp10.
    IF sy-subrc = 0.

      LOOP AT gt_auart INTO wa_auart.
        wa_sel_auart-sign   = 'I'.
        wa_sel_auart-option = 'EQ'.
        wa_sel_auart-low    = wa_auart-auart.
*pruefen, ob vom user etwas eingegeben wurde.
*        read table so_auart with key LOW = wa_auart-auart assigning
*<wa>
*.       if sy-subrc = 0.
*          wa_sel_auart = <wa>.
*        endif.
        APPEND wa_sel_auart TO sel_auart.
      ENDLOOP.

    ENDIF.
  ELSE.
    LOOP AT so_auart ASSIGNING <wa>.
      APPEND <wa> TO sel_auart.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " GET_PPS_AUFTRAGSARTEN

*---------------------------------------------------------------------*
*       FORM get_pps_auftraege                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM get_pps_auftraege.
  DATA: lt_auftraege LIKE gt_auftraege,
        wa_auftraege LIKE LINE OF lt_auftraege,
        lt_jest3 LIKE TABLE OF jest,
        wa_jest LIKE jest,
        l_pointer TYPE sy-tabix.

  DATA: old_idx LIKE sy-tabix.


  DATA: BEGIN OF lt_jest OCCURS 0.
          INCLUDE STRUCTURE jest.
  DATA: END OF lt_jest.

  DATA: BEGIN OF lt_jest2 OCCURS 0.
          INCLUDE STRUCTURE jest.
  DATA: END OF lt_jest2.

  DATA: BEGIN OF jest_wa.
          INCLUDE STRUCTURE jest.
  DATA: END OF jest_wa.

  DATA: BEGIN OF valid_jest OCCURS 0,
        objnr LIKE jest-objnr.
  DATA: END OF valid_jest.

  DATA: old_obj LIKE jest-objnr.

  DATA: valid, object_done.

  FIELD-SYMBOLS: <wa> TYPE ANY.

  SELECT aufk~aufnr
         aufk~objnr
         afko~rsnum
         aufk~erdat
         aufk~auart
     FROM  aufk inner join afko
           on aufk~aufnr = afko~aufnr
     INTO TABLE gt_auftraege
         WHERE  aufk~aufnr IN so_aufnr
         AND    auart IN sel_auart
         AND    erdat IN so_erdat.

  CHECK NOT gt_auftraege[] IS INITIAL.
**alle abhaengigen objektnummern plus stati lesen
  SELECT        * FROM  jest
         INTO TABLE lt_jest
         FOR ALL ENTRIES
         IN gt_auftraege
         WHERE  objnr  = gt_auftraege-objnr.
*         and    stat   = 'I0002'
*         or     stat   = 'I0009'
*         or     stat   = 'I0076'.

  LOOP AT lt_jest INTO jest_wa.
    IF
    (
    jest_wa-stat = 'I0002'
    AND jest_wa-inact = space
    )
    OR
    (
    jest_wa-stat = 'I0076'
    )
    OR jest_wa-stat = 'I0013'.

      APPEND jest_wa  TO lt_jest2.
    ENDIF.
  ENDLOOP.
  FREE lt_jest.

  lt_jest[] = lt_jest2[].

  SORT lt_jest BY objnr stat ASCENDING.


  LOOP AT lt_jest.
      old_idx = sy-tabix.
      IF lt_jest-objnr NE old_obj.
        valid = 'X'.
        CLEAR object_done.
      ENDIF.

      IF valid = 'X' AND object_done = space.
         READ TABLE lt_jest INTO jest_wa WITH KEY objnr = lt_jest-objnr
                                                  stat = 'I0002'
                                                  inact = space.
      IF sy-subrc NE 0.
*Objekt ist nicht freigegeben also ungueltig.
          CLEAR valid.
      ELSE.
*Objekt OK. (Vorausgesetzt kein LOESCHVERMERK oder Archivloeschen)
*AUFTRAG NOCH NICHT RUECKGEMELDET. OBJEKT GUELTIG
*falls LOESCHVORMERKUNG INAKTIV
        READ TABLE lt_jest INTO jest_wa WITH KEY   objnr = lt_jest-objnr
                                                   stat = 'I0076'.
          IF sy-subrc NE 0.
              valid = 'X'.
          ELSE.
              IF jest_wa-inact = space.
                CLEAR valid.
              ELSE.
                valid = 'X'.
              ENDIF.
          ENDIF.

        READ TABLE lt_jest INTO jest_wa WITH KEY objnr = lt_jest-objnr
                                                 stat = 'I0013'.
        IF sy-subrc EQ 0.
          IF jest_wa-inact = 'X'.
            valid = 'X'.
          ENDIF.
        ENDIF.
        IF valid = 'X'.
          sy-tabix = old_idx.
          old_obj = lt_jest-objnr.
          object_done = 'X'.
          MOVE lt_jest-objnr TO valid_jest-objnr.
          COLLECT valid_jest.
          CONTINUE.
        ENDIF. "Objekt gueltig. addiere zur gueltigen tabelle
      ENDIF. "Objekt nicht freigegeben
    ENDIF.
  sy-tabix = old_idx.
  old_obj = lt_jest-objnr.
ENDLOOP.

*  DESCRIBE TABLE valid_jest LINES old_idx.
*  WRITE: / old_idx, 'entries found.'.

*Map the remaining objects to the orders
LOOP AT valid_jest.
READ TABLE gt_auftraege
     WITH KEY objnr = valid_jest-objnr
                      INTO wa_auftraege.
IF sy-subrc = 0.
  APPEND wa_auftraege TO lt_auftraege.
ENDIF.
ENDLOOP.

FREE gt_auftraege.
gt_auftraege[] = lt_auftraege[].


ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  CHECK_RESB
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form check_resb.
data: lt_resb type table of resb,
      wa_resb like line of lt_resb,
      old_idx type sy-tabix,
      old_rsnum type resb-rsnum,
      valid,
      object_done.

DATA: BEGIN OF valid_resb OCCURS 0,
        rsnum LIKE resb-rsnum.
DATA: END OF valid_resb.

data: lt_auftraege type table_auftraege.

      select *
      from resb
      into table lt_resb
      for all entries in gt_auftraege
      where rsnum = gt_auftraege-rsnum
      and   BDART <> 'BB'.

      check not lt_resb[] is initial.

      sort lt_resb by rsnum ascending.

      loop at lt_resb into wa_resb.
           old_idx = sy-tabix.
           if wa_resb-rsnum ne old_rsnum.
             "wenn wir also eine neue rsnum haben
              valid = 'X'.
              clear object_done.
           endif.

           if valid = 'X' and object_done = space.
               read table lt_resb into wa_resb with key
                                               rsnum = wa_resb-rsnum
                                               RGEKZ = 'X'.
               if sy-subrc = 0.
                  sy-tabix = old_idx.
                  clear valid.
                  clear object_done.
                  old_rsnum = wa_resb-rsnum.
                  continue.
               else. "keine retrograde entnahme also ok
                  sy-tabix = old_idx.
                  valid = 'X'.
                  object_done = 'X'.
                  old_rsnum = wa_resb-rsnum.
                    move old_rsnum to valid_resb-rsnum.
                    collect valid_resb.
               endif.
           endif.
      endloop.

*remap found objects
loop at valid_resb.
  read table gt_auftraege with key rsnum = valid_resb-rsnum
  into wa_auftraege.
  if sy-subrc = 0.
     append wa_auftraege to lt_auftraege.
  endif.
endloop.
gt_auftraege[] = lt_auftraege[].

sort gt_auftraege by aufnr rsnum ascending.

*write:/ 'AUFTRAG', 'RSNUM'.
*
*loop at gt_auftraege into wa_auftraege.
*   write:/ wa_auftraege-aufnr, wa_auftraege-rsnum.
*endloop.
*

endform.                    " CHECK_RESB



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 13, 2005 at 02:15 PM

    i should mention the fact that this program works for the most orders i am interested in.

    there are only some exceptions which can reprocessed of course.

    either manually or by adding some code in the area i use to fill the bdcdata structure.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hei Gideon,

      the already mentioned description explains why you have less lines in the batch input mode. There are several transaction which act differenct in batch input mode. It could also be that the user has less bigger screen than you have when you record. For multiple input lines, you should always remember to add a page down, after a view lines.

      Concerning the mb11, it would be better not to use an own batch input program. You can build around the lsmw program for standard handling of goods mouvments your own program. Gerd at least thinks that is more save cause mb11 is very important to run clean. Check out the program Gerd wrote for that last September for the last customer I was working for. You can find it in the folder of the projects, check ZSP* and than the related topic. More I should not offer here in the forum. When needed contact me by email.

      Best regards, Volker

  • Posted on Sep 13, 2005 at 04:53 PM

    There is no magic in here. The number lines that you see online may not necessarily be the same as what you get in batch. This is because, online, the SAPGUI can be formatted by the user, so the number of lines you can see can vary by the user.

    To overcome this problem, most BDC that have table controls/step-loops are done by using a feature provided within the transaction. This feature enables you to add the new line always at a constant position. In MB11, you can achieve this by pressing 'New Item' after every item. That will enable you to enter the new item always in the first line/position. So you can keep your position as 1 always.

    Instead of BDC, why don't you use BAPI_GOODSMVT_CREATE.

    If this helps, please reward and close the post.

    Thanks,

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.