Application Development 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: 

error while bdc session

Former Member
0 Kudos

Hello Guru g,

                     I am learning BDC session transaction . I open SHDB done recording for MM01, done editing in code but when i checked it i am getting error message

( The FORM "BDC_DYNPRO" doesnot exist). Please go through the coding part and please tell me why i am getting this error message & what can i do to correct it.

report ZMMO12013_S

       no standard page heading line-size 255.

*include bdcrecx1.

*

*start-of-selection.

*

*perform open_group.

DATA : BEGIN OF ITAB OCCURS 0,

       MATNR LIKE MARA-MATNR,

       MBRSH LIKE MARA-MBRSH,

       MTART LIKE MARA-MTART,

       MAKTX LIKE MAKT-MAKTX,

       MEINS LIKE MARA-MEINS,

      END OF ITAB.

DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'UPLOAD'

EXPORTING

*   CODEPAGE                             = ' '

   FILENAME                                 = ' '

   FILETYPE                                    = 'DAT'

*   ITEM                                           = ' '

*   FILEMASK_MASK                 = ' '

*   FILEMASK_TEXT                    = ' '

*   FILETYPE_NO_CHANGE            = ' '

*   FILEMASK_ALL                  = ' '

*   FILETYPE_NO_SHOW              = ' '

*   LINE_EXIT                     = ' '

*   USER_FORM                     = ' '

*   USER_PROG                     = ' '

*   SILENT                        = 'S'

* IMPORTING

*   FILESIZE                      =

*   CANCEL                        =

*   ACT_FILENAME                  =

*   ACT_FILETYPE                  =

  TABLES

    DATA_TAB                      = ITAB

* EXCEPTIONS

*   CONVERSION_ERROR              = 1

*   INVALID_TABLE_WIDTH           = 2

*   INVALID_TYPE                  = 3

*   NO_BATCH                      = 4

*   UNKNOWN_ERROR                 = 5

*   GUI_REFUSE_FILETRANSFER       = 6

*   OTHERS                        = 7

          .

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

*   CLIENT                    = SY-MANDT

*   DEST                      = FILLER8

   GROUP                     = 'MM012013_S'

*   HOLDDATE                  = FILLER8

   KEEP                      = 'X'

   USER                      = SY-UNAME

*   RECORD                    = FILLER1

   PROG                      = SY-CPROG

*   DCPFM                     = '%'

*   DATFM                     = '%'

* IMPORTING

*   QID                       =

* 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

          .

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT ITAB.

     REFRESH BDCDATA.

     PERFORM MAPPING.

     CALL FUNCTION 'BDC_INSERT'

      EXPORTING

        TCODE                  = 'MM01'

*        POST_LOCAL             = NOVBLOCAL

*        PRINTING               = NOPRINT

*        SIMUBATCH              = ' '

*        CTUPARAMS              = ' '

       TABLES

         DYNPROTAB              = BDCDATA

*      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.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'

* EXCEPTIONS

*   NOT_OPEN          = 1

*   QUEUE_ERROR       = 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.

FORM MAPPING.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.

perform bdc_field       using 'BDC_CURSOR'

                              'RMMG1-MTART'.

perform bdc_field       using 'BDC_OKCODE'

                              '=AUSW'.

perform bdc_field       using 'RMMG1-MATNR'

                              ITAB-MATNR.

perform bdc_field       using 'RMMG1-MBRSH'

                              ITAB-MBRSH.

perform bdc_field       using 'RMMG1-MTART'

                              ITAB-MTART.

perform bdc_dynpro      using 'SAPLMGMM' '0070'.

perform bdc_field       using 'BDC_CURSOR'

                              'MSICHTAUSW-DYTXT(01)'.

perform bdc_field       using 'BDC_OKCODE'

                              '=ENTR'.

perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'

                              'X'.

perform bdc_dynpro      using 'SAPLMGMM' '4004'.

perform bdc_field       using 'BDC_OKCODE'

                              '/00'.

perform bdc_field       using 'MAKT-MAKTX'

                              ITAB-MAKTX.

perform bdc_field       using 'BDC_CURSOR'

                              'MARA-MEINS'.

perform bdc_field       using 'MARA-MEINS'

                              ITAB-MEINS.

perform bdc_field       using 'MARA-MTPOS_MARA'

                              'NORM'.

perform bdc_dynpro      using 'SAPLSPO1' '0300'.

perform bdc_field       using 'BDC_OKCODE'

                              '=YES'.

*perform bdc_transaction using 'MM01'.

*perform close_group.

ENDFORM.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Happy,

      at the end of your code, add this:

FORM BDC_DYNPRO USING PROGRAM DYNPRO.
   CLEAR BDCDATA.
   BDCDATA-PROGRAM  = PROGRAM.
   BDCDATA-DYNPRO   = DYNPRO.
   BDCDATA-DYNBEGIN = 'X'.
   APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
*  IF FVAL <> NODATA.
     CLEAR BDCDATA.
     BDCDATA-FNAM = FNAM.
     BDCDATA-FVAL = FVAL.
     APPEND BDCDATA.
*  ENDIF.
ENDFORM.

if you add this above code then Dont use include bdcrecx1.....if you go to the bdcrecx1 program then at the last part you found the above code.....

dont use upload..its obsolete...use GUI_UPLOAD.

Hope your problem will be solved.....if not then let me know.....

Thanks

Sabyasachi

19 REPLIES 19

former_member491621
Contributor
0 Kudos

Hi Happy,

It this your complete code??

You are getting the error when checking the syntax for the program(CTRL + F2).

Please check the below link. It might be helpful

http://wiki.sdn.sap.com/wiki/display/Snippets/BDC+Program+to+Upload+Material+Master+Data+%28MM01%29

0 Kudos

Yes I am getting this error while checking syntax for prog & m doing it for Basic view...yes code are complete

0 Kudos

Yes I am getting this error while checking syntax for prog & m doing it for Basic view...yes code are complete

0 Kudos

Hi Happy,

As suggested by Raymond, please include BDCRECX1 in your program.

raymond_giuseppi
Active Contributor
0 Kudos

You commented insertion of include bdcrecx1, this include contains a part of the selection-screen, some data definitions and forms. Uncomment the include line. You may have to comment some lines in your code like bdcdata definition.

Regards,

Raymond

Former Member
0 Kudos

Hi Happy,

      at the end of your code, add this:

FORM BDC_DYNPRO USING PROGRAM DYNPRO.
   CLEAR BDCDATA.
   BDCDATA-PROGRAM  = PROGRAM.
   BDCDATA-DYNPRO   = DYNPRO.
   BDCDATA-DYNBEGIN = 'X'.
   APPEND BDCDATA.
ENDFORM.

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
*  IF FVAL <> NODATA.
     CLEAR BDCDATA.
     BDCDATA-FNAM = FNAM.
     BDCDATA-FVAL = FVAL.
     APPEND BDCDATA.
*  ENDIF.
ENDFORM.

if you add this above code then Dont use include bdcrecx1.....if you go to the bdcrecx1 program then at the last part you found the above code.....

dont use upload..its obsolete...use GUI_UPLOAD.

Hope your problem will be solved.....if not then let me know.....

Thanks

Sabyasachi

0 Kudos

Hi Thanks everyone for helping me....now i able to process this

however i want to know few thing when i use GUI_UPLOAD i able to

activate prog. but when i execute it i get an error with filetype,

where as i use 'DAT' but when i use 'UPLOAD' i didn't get this error

Can u plz tell me why.....

Next thing which i want to ask while checking the material

some time i get an error message "this material has been lock"

so i want to know why i get this message and what is the

solution for this.

0 Kudos

Hi,

      you pass 'ASC' in file type.....

Thanks

Sabyasachi

0 Kudos

Hope your 1st problem will be solved...........

Sabyasachi

0 Kudos

Hi Happy,

For your first issue, You need to pass the value 'ASC' in the file type parameter.

For the second issue : The material cannot be changed. The master records have been updated correspondingly in order to avoid any unplanned changes.

Blocked means you cannot do any furhter processing at the block level.

Or some other user is already changing the material.

Hope this helps

0 Kudos

Hi Sabyasachi,

                        Just want to know suppose if it is a real time program what are the other thing i can ad in above coding....What to know how simple real time prog. look like.

0 Kudos

Hi Happy,

     in real scenario, mainly use excel file....on that time you have to use ALSM_EXCEL_TO_INTERNAL_TABLE FM. When we process session, we mainly used background process........after processing we check error records by clicking 'LOG' . correct those records and reprocess it......

hope you have got your answer......if yes then plz close this thread as correct answer.....

Thanks

Sabyasachi

0 Kudos

Hi Happy,

                any more question about this issue????

Sabyasachi

0 Kudos

Hi Happy,

What ever that you coded looks fine other than the DAT file type which we use ASC generally.

Because we use Unicode characters in Unicodes programs.

Secondly in the Real Time program you need to follow the naming conventions.

Example BDCDATA You declared as BDCDATA rather LV_BDC_DATA or something like this. Depends on the Company's Own standards.

thirdly. When u are using BDC Program Always take the Page down handling and Error Message Handling seriously into consideration if there is a table control in the Transaction.

Hope this helps.

0 Kudos

Hi

in session method you dont have to handle error records, its automatically stored in log file but in call transaction method, you have to handle.....you have to take an internal table type bdcmsgcoll.

hope it helps........

Thanks

Sabyasachi

0 Kudos

Thax for all reply really appreciated ur help...  i know about error message handing, now my final question is how to write page down handling code i don't know much about it?

How can i close this conversation. ?  

0 Kudos

Hi Happy,

You can use OK_CODE = '/00' for page down.

Hope this helps

0 Kudos

Hi Happy,

In Session method messages will be handled by system and you can see them in SHDB.

For Call transaction method you need to have a message Handling.

Regarding page down handling. Lets say you have a Table Control in the Transaction for which you are going to record. In that Transaction for that table, you need to a Page down handling. If this is not done then you will get a No-Batch Input error.

Regarding Closing the thread. Just give the Correct answer to the relevant post, then thread will be closed automatically.

Hope this helps.

0 Kudos

you choose a answer which is most helpful to you and make it correct answer.....then it closed.....

Thanks

Sabyasachi