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

while doing recording for MB1C i am getting coding block

Former Member
0 Likes
381

while doing recording for MB1C i am getting coding block, i could,t able to specify the charectostics for mterial.

Plz let me know how can i procedd to do posting a stock with batch and charectostics specificstion, in normal i ma getting but when i go to recording i am unable to get the chrectostics specification screen, i am getting some coding block sceen.

plz if know anything plz suggest me.

Thanks,

Gururaj.

1 REPLY 1
Read only

Former Member
0 Likes
295

Hi,

This is the BDC program for tcode MB1C.

report Z_MB1C_BDC
       no standard page heading line-size 255.

include bdcrecx1.

parameters: dataset(132) lower case.
***    DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
*
*   If it is nessesary to change the data section use the rules:
*   1.) Each definition of a field exists of two lines
*   2.) The first line shows exactly the comment
*       '* data element: ' followed with the data element
*       which describes the field.
*       If you don't have a data element use the
*       comment without a data element name
*   3.) The second line shows the fieldname of the
*       structure, the fieldname must consist of
*       a fieldname and optional the character '_' and
*       three numbers and the field length in brackets
*   4.) Each field must be type C.
*
*** Generated data section with specific formatting - DO NOT CHANGE  ***
data: begin of record occurs 0,
        BLDAT_001(010),
        BUDAT_002(010),
        BWARTWA_003(003),
        SOBKZ_004(001),
        LGORT_005(004),
        MATNR_01_009(018),
        ERFMG_01_010(017),
        LGORT_01_011(004),
        MAT_KDAUF_011(010),
        MAT_KDPOS_012(006),
      end of record.

*** End generated data section ***


PARAMETERS : P_FILE LIKE RLGRAP-FILENAME.


initialization.
  CTUMODE = 'A'.
  CUPDATE = 'A'.
      ctu = 'X'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL FUNCTION 'WS_FILENAME_GET'
   EXPORTING
*          DEF_FILENAME           = ' '
*          DEF_PATH               = ' '
     MASK                   = ',. '
     MODE                   = 'O'
*          TITLE                  = ' '
   IMPORTING
    FILENAME                 = P_FILE
*          RC                     =
   EXCEPTIONS
     INV_WINSYS             = 1
     NO_BATCH               = 2
     SELECTION_CANCEL       = 3
     SELECTION_ERROR        = 4
     OTHERS                 = 5
            .
  IF SY-SUBRC <> 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


start-of-selection.

  CALL FUNCTION 'WS_UPLOAD'
   EXPORTING
*   CODEPAGE                      = ' '
     FILENAME                      = P_FILE
     FILETYPE                      = 'DAT'
    TABLES
      DATA_TAB                      = record
   EXCEPTIONS
     CONVERSION_ERROR              = 1
     FILE_OPEN_ERROR               = 2
     FILE_READ_ERROR               = 3
     INVALID_TYPE                  = 4
     NO_BATCH                      = 5
     UNKNOWN_ERROR                 = 6
     INVALID_TABLE_WIDTH           = 7
     GUI_REFUSE_FILETRANSFER       = 8
     CUSTOMER_ERROR                = 9
     NO_AUTHORITY                  = 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.


*** End generated data section ***

start-of-selection.

loop at record.

perform bdc_dynpro      using 'SAPMM07M' '0400'.
perform bdc_field       using 'BDC_CURSOR'
                              'RM07M-LGORT'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MKPF-BLDAT'
                              record-BLDAT_001.
perform bdc_field       using 'MKPF-BUDAT'
                              record-BUDAT_002.
perform bdc_field       using 'RM07M-BWARTWA'
                              record-BWARTWA_003.
perform bdc_field       using 'RM07M-SOBKZ'
                              record-SOBKZ_004.
perform bdc_field       using 'RM07M-WERKS'
                              'KDER'.
perform bdc_field       using 'RM07M-LGORT'
                               record-LGORT_005.
perform bdc_dynpro      using 'SAPMM07M' '0421'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSEG-ERFMG(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MSEG-MATNR(01)'
                              record-MATNR_01_009.
perform bdc_field       using 'MSEG-ERFMG(01)'
                              record-ERFMG_01_010.
perform bdc_field       using 'MSEG-ERFME(01)'
                              'EA'.
perform bdc_field       using 'MSEG-LGORT(01)'
                               record-LGORT_01_011.
perform bdc_field       using 'MSEGK-MAT_KDAUF'
                              record-MAT_KDAUF_011.
perform bdc_field       using 'MSEGK-MAT_KDPOS'
                              record-MAT_KDPOS_012.
perform bdc_field       using 'DKACB-FMORE'
                              'X'.
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_dynpro      using 'SAPMM07M' '0421'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSEG-ERFMG(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
perform bdc_field       using 'DKACB-FMORE'
                              'X'.
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_transaction using 'MB1C'.

endloop.