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

SHDB and SM35

Former Member
0 Likes
3,761

I've recorded a transaction and created a bdc program to save it and run it using SM35. But i'm having a multiple error like this:

"No batch input data for screen SAPMM07M 0400"

I have the screen 0400 at the beginning.

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
3,133

There are some big logic problems with your program. Build_bdc is done ONCE and this poulates INT_BDC. Then in process_file you call bdc_insert multiple times. The first time it will pass all the stuff you've built for ALL transactions. This will raise your errors. Then you refresh the table and continue on your loop, calling bdc_insert and passing an empty INT_BDC.

You need to change so that INT_BDC is built for each call of BDC_INSERT. I think inserting a BDC_INSERT within your build_bdc should work...then 'process_file' just becomes a call to 'BDC_CLOSE_GROUP'.

22 REPLIES 22
Read only

Former Member
0 Likes
3,133

You must populate the data into your internal table and then try to run it. Sometimes the data you may have entered may not be enough for all the fields. Process the session in SM35 and check the data in the fields.

Read only

Former Member
0 Likes
3,133

Hi

the error is not in the screen. The input is dat is not available. Check whether the internal table contains the data. check the data uploading.

regards

kishore

Read only

Former Member
0 Likes
3,133

Hi,

U have to specify all data value in a file for which transaction u done recording.

When u run using SM35, might be possible that data is not available in ur file for that screen.

Regards,

Digesh Panchal

Read only

Former Member
0 Likes
3,133

Yeah. The bdc table is populated. I've printed it after running the program and there are data. I compared it against the recording in shdb and they seems to be the same. I could not determine what is the problem. Please help.

Read only

Former Member
0 Likes
3,133

Run yourn session in SM35 and check which field does not have data.

Read only

0 Likes
3,133

Screen 0400 is the first screen for MB1B which I recorded. It has data. I'm just wondering why there are so many errors pointing to screen 0400 when this is just one screen at the beginning.

Read only

0 Likes
3,133

Can you please post your code?

Read only

0 Likes
3,133

It's fine when I'm running it it SM35 but it should not return to the first screen of MB1B. That's where I got the error on screen 0400.

here's my code


REPORT zmm_mtp_batch_upload
       NO STANDARD PAGE HEADING
       LINE-COUNT 65 LINE-SIZE 255
       MESSAGE-ID z001.

*tables
TABLES: msegk, mseg, mkpf, rm07m.

**----------------------------------------------------------------------
** INTERNAL TABLE DECLARATION
**----------------------------------------------------------------------
* the file to be uploaded must be consistent with this table
DATA: BEGIN OF itab OCCURS 0,
        bldat LIKE mkpf-bldat,        "Doc date
        budat LIKE mkpf-budat,        "Posting date
        werks LIKE rm07m-werks,       "Plant
        bwartwa LIKE rm07m-bwartwa,   "Movement type
        lgort LIKE rm07m-lgort,       "Issuing Storage location
        requi(4) TYPE n,              "Requisitioner
        matnr LIKE mseg-matnr,        "Material
        erfmg(15) TYPE n,             "Qty
        charg LIKE mseg-charg,        "Batch number
        umlgo LIKE mseg-umlgo,        "Receiving storage location
      END OF itab,

      msgtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
      bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

* temporary hold the uploaded text file prior to splitting
      BEGIN OF irec OCCURS 0,
        rec(1000) TYPE c,
      END OF irec,

* table for errors
      it_errors LIKE itab OCCURS 1 WITH HEADER LINE,

* bdc table
      BEGIN OF int_bdc OCCURS 100,       "BDC DATA TABLE
        program LIKE bdcdata-program,    "PROGRAM NAME
        dynpro(4) TYPE c,                "SCREEN NO.
        dynbegin LIKE bdcdata-dynbegin,  "BEGIN NEW SCREEN
        fnam LIKE bdcdata-fnam,          "FIELD NAME
        fval LIKE bdcdata-fval,          "FIELD VALUE
      END OF int_bdc,

**----------------------------------------------------------------------
** VARIABLE DECLARATIONS
**----------------------------------------------------------------------
* counter
      item_no(2) TYPE n,
      j(2) TYPE n,
      scrsets(2) TYPE n,
      l(2) TYPE n,
      nxt_page(2) TYPE n,
      istr(2) TYPE n,
      tmp_matnr(15) TYPE c,
      tmp_erfmg(15) TYPE c,
      tmp_lgort(15) TYPE c,
      tmp_charg(15) TYPE c,
      err(1) TYPE c,
      rec_count TYPE sy-tfill,
      v_error TYPE i,
      v_subrc TYPE sy-subrc,
      e_grp_opened.

**----------------------------------------------------------------------
** SELECTION SCREEN
**----------------------------------------------------------------------
* parameters
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_hdate  LIKE sy-datum DEFAULT sy-datum,
            p_grp(12) TYPE c OBLIGATORY,
            p_rec LIKE msegk-wempf OBLIGATORY,
            p_file   LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.

* search for file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            defpath          = 'c:'
            mask             = ',*.txt,*.*.'
            mode             = '0'
            title            = 'Open file to be uploaded'
       IMPORTING
            filename         = p_file
       EXCEPTIONS
            inv_winsys       = 1
            no_batch         = 2
            selection_cancel = 3
            selection_error  = 4
            OTHERS           = 5.

**----------------------------------------------------------------------
** START OF SELECTION
**----------------------------------------------------------------------
START-OF-SELECTION.
* Upload the file
  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            filename                = p_file
            filetype                = 'ASC'
       TABLES
            data_tab                = irec
       EXCEPTIONS
            conversion_error        = 1
            file_open_error         = 2
            file_read_error         = 3
            invalid_table_width     = 4
            invalid_type            = 5
            no_batch                = 6
            unknown_error           = 7
            gui_refuse_filetransfer = 8
            OTHERS                  = 9.

  CASE sy-subrc.
    WHEN 1. WRITE: / 'Conversion error'.
    WHEN 2. WRITE: / 'Error opening file'.
    WHEN 3. WRITE: / 'Eror Reading file'.
    WHEN 4. WRITE: / 'Invalid table width'.
    WHEN 5. WRITE: / 'Invalid type'.
    WHEN 6. WRITE: / 'No batch'.
    WHEN 7. WRITE: / 'Unknown error occured'.
    WHEN 8. WRITE: / 'GUI refuse filetransfer'.
    WHEN 9. WRITE: / 'Other problems encountered.'.
  ENDCASE.

* exit if no data is uploaded from the file
  IF sy-subrc NE 0.
    EXIT.
  ENDIF.

  LOOP AT irec.
    CLEAR itab.
    SPLIT irec AT ',' INTO
        itab-bldat
        itab-budat
        itab-werks
        itab-bwartwa
        itab-lgort
        itab-requi
        itab-matnr
        itab-erfmg
        itab-charg
        itab-umlgo.
    APPEND itab.

    rec_count = rec_count + 1.
    scrsets = rec_count / 7.
  ENDLOOP.

* Check for the correctness of data that has been uploaded
  LOOP AT itab WHERE
    budat EQ space OR
    bldat EQ space OR
    werks EQ space OR
    bwartwa EQ space OR
    lgort EQ space OR
    matnr EQ space OR
    erfmg EQ space OR
    umlgo EQ space.

    err = 'X'.

*     If there is error in the file, exit loop
    IF err EQ 'X'.
      EXIT.
    ENDIF.

  ENDLOOP.

*   If there is error in the file
*   issue message and system exit
  IF err EQ 'X'.
    MESSAGE i008 WITH 'Invalid file.'.  "I=info, E=error
    EXIT.
  ENDIF.

* Allows 311 and 321 movement types
* Reversal: 312, 322
  LOOP AT itab WHERE
    bwartwa NE '311' AND
    bwartwa NE '321' AND
    bwartwa NE '312' AND
    bwartwa NE '322'.
    err = 'X'.

*   If there invalid movement type in the file, exit loop
    IF err EQ 'X'.
      EXIT.
    ENDIF.
  ENDLOOP.

*   If there is error in the movement types
*   issue message and system exit
  IF err EQ 'X'.
    MESSAGE i008 WITH 'Your file contains invalid movement types.'.
    EXIT.
  ENDIF.

* Performs
  PERFORM upload_file.
  PERFORM process_file.


*&---------------------------------------------------------------------*
*&      Form  upload_file
*&---------------------------------------------------------------------*
*       Upload contents of the file to internal table it_temp
*       ad prints it
*----------------------------------------------------------------------*
FORM upload_file.

* open bdc
  CALL FUNCTION 'BDC_OPEN_GROUP'
       EXPORTING
            client              = sy-mandt
            group               = p_grp
            holddate            = p_hdate
            keep                = 'X'
            user                = sy-uname
       EXCEPTIONS
            client_invalid      = 1
            destination_invalid = 2
            group_invalid       = 3
            group_is_locked     = 4
            holddate_invalid    = 5
            internal_error      = 6
            queue_error         = 7
            running             = 8
            system_lock_error   = 9
            user_invalid        = 10
            OTHERS              = 11.

  CASE sy-subrc.
    WHEN 0.
    WHEN 1. WRITE: / 'Invalid client'.
    WHEN 3. WRITE: / 'Invalid group'.
    WHEN 4. WRITE: / 'Group locked'.
    WHEN 5. WRITE: / 'Hold date invalid'.
    WHEN 10. WRITE: / 'Invalid user'.
    WHEN OTHERS.
      WRITE: / 'Problems encountered. Please check master data.'.
  ENDCASE.

*** Start Code
*
*&---------------------------------------------------------------------*
*& THE FF. CODE IS FOR DEBUGGING PURPOSES
*&---------------------------------------------------------------------*
*& TEST - To display the uploaded data - TEST
*&---------------------------------------------------------------------*
*  LOOP AT itab.
*    WRITE: /1 itab-bldat,
*        itab-budat,
*        itab-werks,
*        itab-bwartwa,
*        itab-lgort,
*        itab-requi,
*        itab-matnr,
*        itab-erfmg,
*        itab-charg,
*        itab-lgort2.
*  ENDLOOP.
*
*** End Code

ENDFORM.                    " upload_file

*&---------------------------------------------------------------------*
*&      Form  build_bdc
*&---------------------------------------------------------------------*
FORM build_bdc.
  DATA last_rec(1) TYPE c.
  item_no = 0.
  j = 0.

  LOOP AT itab.
* Increment every rows added
    item_no = item_no + 1.
    j = j + 1.

* First loop/record
    IF j = 1.
*     screen #1
      PERFORM bdc_screen TABLES int_bdc USING 'SAPMM07M' '0400'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'MKPF-BLDAT' itab-bldat,
        USING 'MKPF-BUDAT' itab-budat,
        USING 'RM07M-BWARTWA' itab-bwartwa,
        USING 'RM07M-WERKS' itab-werks,
        USING 'RM07M-LGORT' itab-lgort,
        USING 'XFULL' 'X',
        USING 'RM07M-XNAPR'  'X',
        USING 'RM07M-WVERS2'  'X',
        USING 'BDC_OKCODE'  '/00'.
    ENDIF.

    IF item_no EQ 1.
*     screen #2
      PERFORM bdc_screen TABLES int_bdc USING 'SAPMM07M' '0421'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'MSEGK-WEMPF' p_rec,
        USING 'MSEGK-UMLGO' itab-lgort,  "switched to itab-lgort
        USING 'DKACB-FMORE' 'X',
        USING 'BDC_OKCODE'  '/00'.
    ENDIF.


    CONCATENATE 'mseg-matnr(' item_no ')' INTO tmp_matnr.
    CONCATENATE 'mseg-erfmg(' item_no ')' INTO tmp_erfmg.
    CONCATENATE 'mseg-lgort(' item_no ')' INTO tmp_lgort.
    CONCATENATE 'mseg-charg(' item_no ')' INTO tmp_charg.

    CONDENSE tmp_matnr NO-GAPS.
    CONDENSE tmp_erfmg NO-GAPS.
    CONDENSE tmp_lgort NO-GAPS.
    CONDENSE tmp_charg NO-GAPS.

    PERFORM bdc_field TABLES int_bdc:
      USING tmp_matnr itab-matnr,
      USING tmp_erfmg itab-erfmg,
      USING tmp_lgort itab-umlgo,        "switched to itab-umlogo
      USING tmp_charg itab-charg.

    AT LAST.
      PERFORM bdc_screen TABLES int_bdc USING 'SAPMM07M' '0421'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'BDC_OKCODE' '=BU',
        USING 'DKACB-FMORE' 'X'.

      PERFORM bdc_screen TABLES int_bdc USING 'SAPLKACB' '0002'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'BDC_OKCODE' '=ENTE'.

      last_rec = 'X'.
    ENDAT.

    nxt_page = item_no MOD 7.
    IF nxt_page EQ '00' AND rec_count NE item_no AND last_rec NE 'X'.
*     Ends the first page
      PERFORM bdc_screen TABLES int_bdc USING 'SAPLKACB' '0002'.
      PERFORM bdc_field TABLES int_bdc:
*        USING 'DKACB-FMORE' 'X',
        USING 'BDC_OKCODE' '=ENTE'.

      PERFORM bdc_screen TABLES int_bdc USING 'SAPLKACB' '0002'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'BDC_OKCODE' '=ENTE'.

*     Next screen
      PERFORM bdc_screen TABLES int_bdc USING 'SAPMM07M' '0421'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'BDC_OKCODE' '=NLE'.

      PERFORM bdc_screen TABLES int_bdc USING 'SAPLKACB' '0002'.
      PERFORM bdc_field TABLES int_bdc:
        USING 'BDC_OKCODE' '=ENTE'.

*     allocated row is only 7
*     resetting to 1 triggers the next page
      item_no = 0.
    ENDIF.
  ENDLOOP.

* Call transaction MB1B
*  PERFORM bdc_tranasction USING 'MB1B'.
*  IMPORT v_subrc FROM MEMORY ID 'v_subrc'.

ENDFORM.                    " build_bdc

*-----------------------------------------------------------------------
* FORM SUBMIT_BDC
* This form will submit the bdc table using call function
*-----------------------------------------------------------------------
FORM submit_bdc.
  CALL FUNCTION 'BDC_INSERT'
       EXPORTING
            tcode            = 'IE01'
       TABLES
            dynprotab        = int_bdc
       EXCEPTIONS
            internal_error   = 1
            not_open         = 2
            queue_error      = 3
            tcode_invalid    = 4
            printing_invalid = 5
            posting_invalid  = 6
            OTHERS           = 7.
  IF sy-subrc <> 0.
    MOVE-CORRESPONDING itab TO it_errors.
    APPEND it_errors.
  ENDIF.
ENDFORM.                               "submit_bdc

*-----------------------------------------------------------------------
* FORM CLOSEGROUP
* CLOSES BDC SESSION GROUP
*-----------------------------------------------------------------------
FORM closegroup.
  CALL FUNCTION 'BDC_CLOSE_GROUP'
       EXCEPTIONS
            not_open    = 1
            queue_error = 2
            OTHERS      = 3.

  IF sy-subrc = 1.
    WRITE: / 'BDC NOT OPEN'.
  ENDIF.
ENDFORM.

*-----------------------------------------------------------------------
* FORM BDC_SCREEN
* This form takes two parameters and makes an entry into a bdc table
* specified for a new screen.
*-----------------------------------------------------------------------
FORM bdc_screen TABLES p_bdc STRUCTURE int_bdc
                USING p_program p_screen.
  CLEAR p_bdc.                         "clears table work area
  p_bdc-program  = p_program.
  p_bdc-dynpro   = p_screen.
  p_bdc-dynbegin = 'X'.
  APPEND p_bdc. CLEAR p_bdc.
ENDFORM.

*-----------------------------------------------------------------------
* FORM BDC_FIELD
* This form takes 2 parameters and makes an entry into a BDC table
* specified for a new field.
*-----------------------------------------------------------------------
FORM bdc_field TABLES p_bdc STRUCTURE int_bdc
               USING p_name p_value.
  CASE p_value.
    WHEN ' '.                          "don't move if blank
    WHEN OTHERS.
      MOVE p_name TO p_bdc-fnam.
      MOVE p_value TO p_bdc-fval.
      APPEND p_bdc.
  ENDCASE.
ENDFORM.


*&---------------------------------------------------------------------*
*&      Form  process_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM process_file.
  PERFORM build_bdc.

  LOOP AT itab.

*** Start Code
*
*&---------------------------------------------------------------------*
*   THE FF. CODE IS FOR DEBUGGING PURPOSES
*&---------------------------------------------------------------------*
*   Write the contents of the bdc table
*&---------------------------------------------------------------------*
    LOOP AT int_bdc.
      WRITE: /1 int_bdc-program,
             10 int_bdc-dynpro,
             15 int_bdc-dynbegin,
             17 int_bdc-fnam,
             40 int_bdc-fval.
    ENDLOOP.
*
*** End Code


* submits the bdc table using call function
    CALL FUNCTION 'BDC_INSERT'
         EXPORTING
              tcode            = 'MB1B'
         TABLES
              dynprotab        = int_bdc
         EXCEPTIONS
              internal_error   = 1
              not_open         = 2
              queue_error      = 3
              tcode_invalid    = 4
              printing_invalid = 5
              posting_invalid  = 6
              OTHERS           = 7.

    IF sy-subrc <> 0.
      MOVE-CORRESPONDING itab TO it_errors.
      APPEND it_errors.
    ENDIF.

    REFRESH int_bdc.

  ENDLOOP.

* close group
  CALL FUNCTION 'BDC_CLOSE_GROUP'
       EXCEPTIONS
            not_open    = 1
            queue_error = 2
            OTHERS      = 3.

  IF sy-subrc EQ 1.
    WRITE: / 'BDC not open'.
  ENDIF.

  WRITE: /1 'UPLOADING FINISHED!',
         /1 'Proceed to SM35 and execute the transaction.'.

ENDFORM.                    " process_file
*&---------------------------------------------------------------------*
*&      Form  bdc_tranasction
*&---------------------------------------------------------------------*
*       MB1B Transaction
*----------------------------------------------------------------------*
FORM bdc_tranasction USING tcode.
  DATA: v_msg TYPE string,
        v_subrc TYPE sy-subrc,
        v_msg_id LIKE t100-arbgb,
        v_msg_no LIKE t100-msgnr,
        v_msg1 LIKE balm-msgv1,
        v_msg2 LIKE balm-msgv2,
        v_msg3 LIKE balm-msgv3,
        v_msg4 LIKE balm-msgv4.

  REFRESH msgtab.

  CALL TRANSACTION 'MB1B' USING bdcdata
  MODE 'N'
  UPDATE 'S'
  MESSAGES INTO msgtab.

  v_subrc = sy-subrc.

  EXPORT v_subrc TO MEMORY ID 'v_subrc'.

  LOOP AT msgtab.
    IF msgtab-msgid EQ 'VL' AND
      msgtab-msgnr EQ '311' AND
      msgtab-msgtyp EQ 's'.

      EXIT.
    ENDIF.
  ENDLOOP.

  IF sy-subrc EQ 0.
    v_msg_id = msgtab-msgid.
    v_msg_no = msgtab-msgnr.
    v_msg1 = msgtab-msgv1.
    v_msg2 = msgtab-msgv2.
    v_msg3 = msgtab-msgv3.
    v_msg4 = msgtab-msgv4.

    CALL FUNCTION 'MESSAGE_PREPARE'
         EXPORTING
              language               = 'E'
              msg_id                 = v_msg_id
              msg_no                 = v_msg_no
              msg_var1               = v_msg1
              msg_var2               = v_msg2
              msg_var3               = v_msg3
              msg_var4               = v_msg4
         IMPORTING
              msg_text               = v_msg
         EXCEPTIONS
              function_not_completed = 1
              message_not_found      = 2
              OTHERS                 = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    IF v_subrc <> 0.
      v_error = v_error + 1.


      CALL FUNCTION 'BDC_OPEN_GROUP'
           EXPORTING
                client   = sy-mandt
                group    = p_grp
                holddate = p_hdate
                keep     = ''
                user     = sy-uname.

      IF sy-subrc EQ 0.
        WRITE: /5 'Session'(012), p_grp, ' created Successfully'(011).
        e_grp_opened = 'X'.
      ELSE.
        WRITE: /5 'Unable to Create the session'(013),
                  p_grp, '. Return code'(010), sy-subrc.
      ENDIF.

      CALL FUNCTION 'BDC_INSERT'
           EXPORTING
                tcode     = 'MB1B'
           TABLES
                dynprotab = bdcdata.

    ENDIF.

    REFRESH bdcdata.
    CLEAR bdcdata.

  ENDIF.
ENDFORM.                    " bdc_tranasction

Read only

Former Member
0 Likes
3,133

Hello Adrian,

When u execute MB1B in foreground are there any other fields which are mandetory which may be giving u this error.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
3,133

there might be some fields which are required to be filled in that screen, and while recording u might have skipped filling them.

fill those fields and again record and then map accordingly.

Read only

Former Member
0 Likes
3,133

Hi Adrian,

1. BDC will accept only character value, so check whether you are trying to pass any value other than character type.

2.Check for the mandatory screen fields. This may also be one of the problem.

Regs,

Venkat Ramanan

Read only

0 Likes
3,133

All the fields including the required one are all filled up. The problem occurs in the last two screens which is screen 0421 using bdc_okcode =BU and screen 0002 using bdc_okcode =ENTE.

Supposedly, that will end the process and will save the data. But after executing them in the foreground, the system is taking me back to screen 0400 which should be not because that's the first screen and it's done. I can't figure it out.

Read only

0 Likes
3,133

This error occurs when sap wants to show the screen but your program has not created it. Basically your program is not setting up the screens in the same sequence that sap expects them.

I think it will be easier to isolate the error in your code if you test it on small numbers of input records. Try one record, this will probably work. Then try 2 or the smallest number which causes the error. This might clarify things for you.

Read only

0 Likes
3,133

It's working if you have only one record. But once it became two or more. The error occurs.

Read only

0 Likes
3,133

hI aDRIAN,

surely after each 'post' your program needs to issue a screen 400 to start the next MB1B but your program only creates the 400 at the very start.

I think you need to change it to call multiple MB1bs and issue the 400 at the start of each one.

Read only

0 Likes
3,133

Hi,

Try keeping the loop after screen 0400..I mean it should fire the screen only once at the begining of execution of the BDC.Populate the screen only once.

Read only

0 Likes
3,133

> hI aDRIAN,

> surely after each 'post' your program needs to issue

> a screen 400 to start the next MB1B but your program

> only creates the 400 at the very start.

>

> I think you need to change it to call multiple MB1bs

> and issue the 400 at the start of each one.

I only need to post once that's why I only have one screen 0400.

I tried to add the screen 0400 at the end of the code where SAP is asking and it works fine but it started to ask records again starting from record 1. It's weird.

Read only

former_member186741
Active Contributor
0 Likes
3,134

There are some big logic problems with your program. Build_bdc is done ONCE and this poulates INT_BDC. Then in process_file you call bdc_insert multiple times. The first time it will pass all the stuff you've built for ALL transactions. This will raise your errors. Then you refresh the table and continue on your loop, calling bdc_insert and passing an empty INT_BDC.

You need to change so that INT_BDC is built for each call of BDC_INSERT. I think inserting a BDC_INSERT within your build_bdc should work...then 'process_file' just becomes a call to 'BDC_CLOSE_GROUP'.

Read only

0 Likes
3,133

Hi Neil,

I dont think that is the problem. I use this code to print the int_bdc:


    LOOP AT int_bdc.
      WRITE: /1 int_bdc-program,
             10 int_bdc-dynpro,
             15 int_bdc-dynbegin,
             17 int_bdc-fnam,
             40 int_bdc-fval.
    ENDLOOP.

And the result was what I expected against the recording I created using SHDB.

Read only

0 Likes
3,133

ok, but why is the transaction call in a loop? If you only need one post then you only need one transaction call don't you?...and the int_bdc table is being cleared after the first call anyway...actually that IS THE PROBLEM!

You call the transaction with all your screens but then you call the transaction, once for all the other entries in ITAB, and for all these calls int_BDC is empty! Therefore sap will say: where is the first screen for that MB1b you want me to run!!

Read only

0 Likes
3,133

Oh man! That is the prob! Thanks Neil.

I'll give you points for your help.

Again, thanks.

Read only

Former Member
0 Likes
3,133

Hello Adrian,

I think the COBL screen appears multiple times in the transaction.

try adding the following in the FORM build_bdc.

IF item_no EQ 1.

  • screen #2

PERFORM bdc_screen TABLES int_bdc USING 'SAPMM07M' '0421'.

PERFORM bdc_field TABLES int_bdc:

USING 'MSEGK-WEMPF' p_rec,

USING 'MSEGK-UMLGO' itab-lgort, "switched to itab-lgort

USING 'DKACB-FMORE' 'X',

USING 'BDC_OKCODE' '/00'.

                                  • add

PERFORM bdc_screen TABLES int_bdc USING 'SAPLKACB' '0002'.

PERFORM bdc_field TABLES int_bdc:

USING 'BDC_OKCODE' '=ENTE'.

*****************

ENDIF.

Let me know what happens. My understanding is the COBL screen is the problem.