Bdc s for mm01

hi
i had an issue to process materials for different views like when for first material it should create in 3 views depending
on flat file for second it may for 2 views or 5 views , can anyone help on this
thanks
pavan

Hi,
To Select the Required View please call below function modules.
CALL FUNCTION 'BILDSEQUENZ_IDENTIFY'
EXPORTING
materialart = 'HALB' "Material Type
tcode_ref = t130m-trref
IMPORTING
bildsequenz = bildsequenz.
CALL FUNCTION 'SELECTION_VIEWS_FIND'
EXPORTING
bildsequenz = bildsequenz
pflegestatus = t134-pstat "tkstatus
TABLES
bildtab = gt_bild
EXCEPTIONS
call_wrong = 1
empty_selection = 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.

Similar Messages

  • BDC code for MM01 Transaction

    Hi All,,
                 Please give Entire BDC code for MM01 Transaction.
    i will change as per my requirement.
    I think this is already done by some ABAP Consultants.
    plz dont give answers like do recording for that transaction MM01. I know recording...
    For time constraiint, I have to complete soon.....
    Thanks in Advance
    BestRegards,
    Anil

    Hi,
    The below code is using the Session Method
    report ZDS_BDC_MM01
           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,
    * data element: MATNR
            MATNR_001(018),
    * data element: MBRSH
            MBRSH_002(001),
    * data element: MTART
            MTART_003(004),
    * data element: XFELD
            KZSEL_01_004(001),
    * data element: XFELD
            KZSEL_02_005(001),
    * data element: MAKTX
            MAKTX_006(040),
    * data element: MEINS
            MEINS_007(003),
    * data element: MAKTX
            MAKTX_008(040),
          end of record.
    *** End generated data section ***
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      ='C:\DHRUV.TXT'
       FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = RECORD
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *do.
    LOOP AT record.
    *read dataset dataset into record.
    if sy-subrc <> 0. exit. endif.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(02)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                  record-KZSEL_01_004.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(02)'
                                  record-KZSEL_02_005.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_006.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_007.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_008.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM01'.
    *enddo.
    ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    *Messages
    * Message class: MS
    *613   Please enter a session name and user name
    The Below is the coding for the Call Transaction...
    report ZDS_BDC_MM01_2
           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,
    * data element: MATNR
            MATNR_001(018),
    * data element: MBRSH
            MBRSH_002(001),
    * data element: MTART
            MTART_003(004),
    * data element: XFELD
            KZSEL_01_004(001),
    * data element: MAKTX
            MAKTX_005(040),
    * data element: MEINS
            MEINS_006(003),
    * data element: MTPOS_MARA
            MTPOS_MARA_007(004),
          end of record.
    DATA: FLNAME TYPE STRING.
    *** End generated data section ***
    DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    *** MESSAGE******
    DATA: BEGIN OF MESSTAB OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
            DATA: MATNR TYPE MARA-MATNR,
          END OF MESSTAB.
    ****END OF MESSAGE****
    PARAMETERS: FILENAME TYPE RLGRAP-FILENAME.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
      CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME           = FILENAME.
    start-of-selection.
    *perform open_dataset using dataset.
    perform open_group.
    FLNAME = FILENAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FLNAME
        FILETYPE                      = 'DAT'
    *   HAS_FIELD_SEPARATOR           = ' '
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    *   NO_AUTH_CHECK                 = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
      TABLES
        DATA_TAB                      = record
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    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 record.
      DATA:
        CNT TYPE I.
        CNT = CNT + 1.
        REFRESH BDCDATA.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MTART'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  record-MATNR_001.
    perform bdc_field       using 'RMMG1-MBRSH'
                                  record-MBRSH_002.
    perform bdc_field       using 'RMMG1-MTART'
                                  record-MTART_003.
    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)'
                                  record-KZSEL_01_004.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  record-MAKTX_005.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MEINS'.
    perform bdc_field       using 'MARA-MEINS'
                                  record-MEINS_006.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  record-MTPOS_MARA_007.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    *perform bdc_transaction using 'MM01'.
    CALL TRANSACTION 'MM01' USING BDCDATA
                            MODE 'N'
                            UPDATE 'A'
                            MESSAGES INTO MESSTAB.
    READ TABLE MESSTAB INTO MESSTAB INDEX CNT.
       IF MESSTAB-MSGTYP = 'E'.
         MESSTAB-MATNR = RECORD-MATNR_001.
         MODIFY MESSTAB INDEX CNT FROM MESSTAB. " TRANSPORTING MATNR.
       ENDIF.
    ENDLOOP.
    FORM OPEN_GROUP.
      CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = 'MM01'
                        USER     = SY-UNAME
                        KEEP     = 'X'.
    ENDFORM.
    FORM BDC_INSERT.
      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.
    ENDFORM.
    END-OF-SELECTION.
    LOOP AT MESSTAB.
        IF MESSTAB-MSGTYP = 'E'.
          WRITE:/ 'ERROR OCCURED ON MATNR = ',MESSTAB-MATNR , 'MESSAGE : MATNR ALREADY EXISTS IN MARA!!!'.
        ENDIF.
      ENDLOOP.
    perform close_group.
    *perform close_dataset using dataset.
    *&      Form  close_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM close_group .
    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.
    ENDFORM.                    " close_group
    *&      Form  bdc_dynpro
    *       text
    *      -->P_0270   text
    *      -->P_0271   text
    FORM bdc_dynpro  USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    *       text
    *      -->P_0275   text
    *      -->P_0276   text
    FORM bdc_field  USING  FNAM FVAL.
      IF FVAL <> ' '.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.                    " bdc_field
    *Text elements
    * E00 Error opening dataset, return code:
    * I01 Session name
    * I02 Open session
    * I03 Insert transaction
    * I04 Close Session
    * I05 Return code =
    * I06 Error session created
    * S01 Session name
    * S02 User
    * S03 Keep session
    * S04 Lock date
    * S05 Processing Mode
    * S06 Update Mode
    * S07 Generate session
    * S08 Call transaction
    * S09 Error sessn
    * S10 Nodata indicator
    * S11 Short log
    HTH
    Regards,
    Dhruv Shah

  • Bdc notes for mm01 & me21n

    hi gurus,
      i want  notes for creating materials and to create purchase order using bdc and to upload some datas using that recording from datas in note pad or any external file with screen shots. if any body sent to it ll be very useful to me...
    thanks in advance
    arun

    Hi,
    check the codes for mm01 and me21n.
    mm01
    report ZBHMAT no standard page heading line-size 255.
    DATA:BEGIN OF ITAB OCCURS 0,
         MATNR LIKE RMMG1-MATNR,
         MBRSH LIKE RMMG1-MBRSH,
         MTART LIKE RMMG1-MTART,
         KZSEL LIKE MSICHTAUSW-KZSEL,
         WERKS LIKE RMMG1-WERKS,
         VKORG LIKE RMMG1-VKORG,
         VTWEG LIKE RMMG1-VTWEG,
         MAKTX LIKE MAKT-MAKTX,
         MEINS LIKE MARA-MEINS,
         SKTOF LIKE MVKE-SKTOF,
         TAXKM LIKE MG03STEUER-TAXKM,
         GEWEI LIKE MARA-GEWEI,
         MTVFP LIKE MARC-MTVFP,
         TRAGR LIKE MARA-TRAGR,
         LADGR LIKE MARC-LADGR,
    END OF ITAB.
    DATA BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:/BHARAT/MAT.TXT'
       FILETYPE                      = 'ASC'
      TABLES
        DATA_TAB                      = ITAB.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
       GROUP                     = 'MATERIAL'
       KEEP                      = 'X'
       USER                      = SY-UNAME
       PROG                      = SY-CPROG.
    LOOP AT ITAB.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    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_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-KZSEL(04)'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(04)'
                                  ITAB-KZSEL.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPLMGMM' '0080'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-WERKS'.
    perform bdc_field       using 'RMMG1-WERKS'
                                  ITAB-WERKS.
    perform bdc_field       using 'RMMG1-VKORG'
                                  ITAB-VKORG.
    perform bdc_field       using 'RMMG1-VTWEG'
                                  ITAB-VTWEG.
    perform bdc_field       using 'BDC_OKCODE'
                                  'ENTR'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  ITAB-MAKTX.
    perform bdc_field       using 'MARA-MEINS'
                                  ITAB-MEINS.
    perform bdc_field       using 'MVKE-SKTOF'
                                  ITAB-SKTOF.
    perform bdc_field       using 'MG03STEUER-TAXKM(01)'
                                  ITAB-TAXKM.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '4200'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  ITAB-MAKTX.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  ITAB-MAKTX.
    perform bdc_field       using 'MARA-MEINS'
                                  ITAB-MEINS.
    perform bdc_field       using 'MVKE-SKTOF'
                                  ITAB-SKTOF.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  ITAB-MAKTX.
    perform bdc_field       using 'MARA-MEINS'
                                  ITAB-MEINS.
    perform bdc_field       using 'MARA-GEWEI'
                                  ITAB-GEWEI.
    perform bdc_field       using 'MARC-MTVFP'
                                  ITAB-MTVFP.
    perform bdc_field       using 'MARA-TRAGR'
                                  ITAB-TRAGR.
    perform bdc_field       using 'MARC-LADGR'
                                  ITAB-LADGR.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
       TCODE                  = 'MM01'
      TABLES
        DYNPROTAB              = BDCTAB.
    REFRESH BDCTAB.
    ENDLOOP.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCTAB.
      BDCTAB-PROGRAM  = PROGRAM.
      BDCTAB-DYNPRO   = DYNPRO.
      BDCTAB-DYNBEGIN = 'X'.
      APPEND BDCTAB.
    ENDFORM.
    FORM BDC_FIELD USING FNAM FVAL.
        CLEAR BDCTAB.
        BDCTAB-FNAM = FNAM.
        BDCTAB-FVAL = FVAL.
        APPEND BDCTAB.
    ENDFORM.
    me21n
    report ZBH_PURORDER no standard page heading line-size 255.
    PARAMETERS:P_FILE LIKE IBIPPARMS-PATH.
    DATA FILENAME TYPE STRING.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
       EXPORTING
          program_name  = sy-cprog
          dynpro_number = sy-dynnr
       IMPORTING
          file_name     = P_FILE.
    START-OF-SELECTION.
    FILENAME = P_FILE.
    DATA:BEGIN OF XTAB OCCURS 0,
    TYP,
    DES(255) TYPE C,
    END OF XTAB.
    DATA:BEGIN OF ITAB OCCURS 0,
    SUPERFIELD LIKE MEPO_TOPLINE-SUPERFIELD,
    EKORG LIKE MEPO1222-EKORG,
    EKGRP LIKE MEPO1222-EKGRP,
    BUKRS LIKE MEPO1222-BUKRS,
    END OF ITAB.
    DATA:BEGIN OF JTAB OCCURS 0,
    N(4) TYPE C,
    EMATN LIKE MEPO1211-EMATN,
    MENGE(13) TYPE C,
    NETPR(13) TYPE C,
    NAME1 LIKE MEPO1211-NAME1,
    END OF JTAB.
    DATA:BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA:DELIMITER VALUE '*'.
    DATA A TYPE I.
    DATA M(4) TYPE N.
    DATA L_FNAM(30) TYPE C.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = FILENAME
       FILETYPE                      = 'ASC'
      TABLES
        DATA_TAB                      = XTAB.
    LOOP AT XTAB.
    IF XTAB-TYP = 'H'.
      SPLIT XTAB-DES AT DELIMITER INTO ITAB-SUPERFIELD ITAB-EKORG ITAB-EKGRP
      ITAB-BUKRS.
      JTAB-N = JTAB-N + 1.
      APPEND ITAB.
    ELSEIF XTAB-TYP = 'I'.
      SPLIT XTAB-DES AT DELIMITER INTO JTAB-EMATN JTAB-MENGE JTAB-NETPR
      JTAB-NAME1.
    APPEND JTAB.
    ENDIF.
    ENDLOOP.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
       CLIENT                    = SY-MANDT
       GROUP                     = 'PORDER'
       KEEP                      = 'X'
       USER                      = SY-UNAME.
    LOOP AT ITAB.
    A = SY-TABIX.
    REFRESH BDCTAB.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO_TOPLINE-SUPERFIELD'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                  ITAB-SUPERFIELD.
    perform bdc_field       using 'MEPO_TOPLINE-BEDAT'
                                  '09.02.2007'.
    perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MEV4000BUTTON'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                  ITAB-SUPERFIELD.
    perform bdc_field       using 'MEPO_TOPLINE-BEDAT'
                                  '09.02.2007'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO1222-EKORG'.
    perform bdc_field       using 'MEPO1222-EKORG'
                                  ITAB-EKORG.
    perform bdc_field       using 'MEPO1222-EKGRP'
                                  ITAB-EKGRP.
    perform bdc_field       using 'MEPO1222-BUKRS'
                                  ITAB-BUKRS.
    perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MEV4001BUTTON'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                  ITAB-SUPERFIELD.
    perform bdc_field       using 'MEPO_TOPLINE-BEDAT'
                                  '09.02.2007'.
    perform bdc_field       using 'MEPO1222-EKORG'
                                  ITAB-EKORG.
    perform bdc_field       using 'MEPO1222-EKGRP'
                                 ITAB-EKGRP.
    perform bdc_field       using 'MEPO1222-BUKRS'
                                 ITAB-BUKRS.
    M = 1.
    LOOP AT JTAB.
    IF JTAB-N = A.
    WRITE:/ JTAB.
    CONCATENATE 'MEPO1211-EMATN(' M ')' INTO L_FNAM.
    perform bdc_field       using 'BDC_CURSOR'
                                  L_FNAM.
    perform bdc_field       using L_FNAM
                                  JTAB-EMATN.
    CONCATENATE 'MEPO1211-MENGE(' M ')' INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  JTAB-MENGE.
    CONCATENATE 'MEPO1211-NETPR(' M ')' INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  JTAB-NETPR.
    CONCATENATE 'MEPO1211-NAME1(' M ')' INTO L_FNAM.
    perform bdc_field       using L_FNAM
                                  JTAB-NAME1.
    M = M + 1.
    ENDIF.
    ENDLOOP.
    perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
    perform bdc_field       using 'MEPO_TOPLINE-BSART'
                                  'NB'.
    perform bdc_field       using 'MEPO_TOPLINE-SUPERFIELD'
                                  ITAB-SUPERFIELD.
    perform bdc_field       using 'MEPO_TOPLINE-BEDAT'
                                  '09.02.2007'.
    perform bdc_field       using 'MEPO1222-EKORG'
                                  ITAB-EKORG.
    perform bdc_field       using 'MEPO1222-EKGRP'
                                  ITAB-EKGRP.
    perform bdc_field       using 'MEPO1222-BUKRS'
                                  ITAB-BUKRS.
    perform bdc_field       using 'DYN_6000-LIST'
                                  '                                      1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MEPO1319-MATKL'.
    perform bdc_field       using 'MEPO1319-SPINF'
                                  'X'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MESAVE'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
       TCODE                  = 'ME21N'
      TABLES
        DYNPROTAB              = BDCTAB.
    ENDLOOP.
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCTAB.
      BDCTAB-PROGRAM  = PROGRAM.
      BDCTAB-DYNPRO   = DYNPRO.
      BDCTAB-DYNBEGIN = 'X'.
      APPEND BDCTAB.
    ENDFORM.
    FORM BDC_FIELD USING FNAM FVAL.
        CLEAR BDCTAB.
        BDCTAB-FNAM = FNAM.
        BDCTAB-FVAL = FVAL.
        APPEND BDCTAB.
    ENDFORM.
    FLAT FILE:
    H1171611000001*1000
    ICPU116000*1000
    ILEY BOARD1010000*1000
    IMOUSE66000*1000
    H1171711000001*1000
    ICPU580000*1000
    H1171701000001*1000
    IMOUSE33000*1000
    ILEY BOARD1010000*1000
    rgds,
    bharat.

  • Bdc recording for mm01

    hi all,
    this is an extract of materail master upload for mm01 when i execute this recording purchase order text view doesnot get populated with text. anybody can tell me whts wrong with this?????
    perform bdc_field       using 'MAKT-MAKTX'
                                  'carr'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(05)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXVB'.
    perform bdc_field       using 'RSTXT-TXLINE(02)'
                                  'qqqqqqqqqqqqqq  ssssssssssssssssssssss'
                                & 'sssss.00000000000000jjjjjjjjjjjjoo'.
    perform bdc_field       using 'RSTXT-TXLINE(03)'
                                  'wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww jjjjjj'
                                & 'jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj'.
    perform bdc_field       using 'RSTXT-TXLINE(04)'
                                  'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'
                                & 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'.
    perform bdc_field       using 'RSTXT-TXLINE(05)'
                                  '66666666666666666666666666666666666666'
                                & '6666666666666666666666666666666666'.
    perform bdc_dynpro      using 'SAPLSTXX' '1100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RSTXT-TXLINE(06)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=TXBA'.
    perform bdc_dynpro      using 'SAPLMGMM' '4040'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SP12'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  'carr'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.

    Hi
    You have to upload the Texts using the CREATE_TEXT fun module
    see the sample program
    REPORT zmm_longtext
           NO STANDARD PAGE HEADING
           LINE-SIZE 255.
    Internal Table for Upload of Long Texts Data
    DATA: BEGIN OF itab1 OCCURS 0,
            matnr    LIKE mara-matnr,    " Material
            text     LIKE tline-tdline,  " Long Text
          END OF itab1.
    Internal Table for Upload of Long Texts Data
    DATA: BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,    " Material
            text  LIKE tline-tdline,  " Long Text
          END OF itab.
    To create Long Text lines for CREATE_TEXT function module
    DATA:BEGIN OF dt_lines OCCURS 0.
            INCLUDE STRUCTURE tline.   " Long Text
    DATA:END OF dt_lines.
    Variable declarations for CREATE_TEXT function module
    DATA : dl_name TYPE thead-tdname,   " Object Name
           dl_lan TYPE thead-tdspras,   " Language
           gv_matnr TYPE matnr.
    Constants
    CONSTANTS:
    Object ID for Long Text of Material Basic Data 1
      c_best     TYPE thead-tdid VALUE 'GRUN',
      c_material TYPE thead-tdobject VALUE 'MATERIAL'. " Object
    Parameters
    PARAMETERS p_file LIKE rlgrap-filename.
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Start Of Selection
    START-OF-SELECTION.
    *To Upload Flat file
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = itab1
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
      SORT itab1 BY matnr.
      LOOP AT itab1.
        CLEAR gv_matnr.
        SELECT SINGLE matnr INTO gv_matnr
           FROM mara WHERE bismt = itab1-matnr.
        IF itab1-text NE ' '.
          itab-matnr = gv_matnr.
          itab-text  = itab1-text.
          APPEND itab.
        ENDIF.
        CLEAR itab.
      ENDLOOP.
      DELETE itab WHERE matnr EQ ' '.
    Upload the Texts
      SORT itab BY matnr.
      LOOP AT itab.
        dt_lines-tdformat = 'ST'.
        dt_lines-tdline = itab-text.
        APPEND dt_lines.
        dl_lan = sy-langu.
        dl_name = itab-matnr.
    Call the Function Module to Create Text
        CALL FUNCTION 'CREATE_TEXT'
          EXPORTING
            fid         = c_best
            flanguage   = dl_lan
            fname       = dl_name
            fobject     = c_material
            save_direct = 'X'
            fformat     = '*'
          TABLES
            flines      = dt_lines
          EXCEPTIONS
            no_init     = 1
            no_save     = 2
            OTHERS      = 3.
        IF sy-subrc <> 0.
          WRITE:/ 'Long Text Creation failed for Material'(001),
                 itab-matnr.
        ELSE.
          WRITE:/ 'Long Text Created Successfully for Material'(002),
                 itab-matnr.
        ENDIF.
        AT END OF matnr.
          REFRESH dt_lines.
        ENDAT.
      ENDLOOP.
    Regards
    Anji

  • BDC RECORDING  FOR MM01 PROBLEM

    Hi Experts ,
    I did recording using SHDB for TC MM01. I selected Purchase order text as one of the view but after saving my recording I not able to find the text I have entered.
    Please help.

    while recording
    if the view is selected
    and the text is not getting displayed its because of control tecnoogy being used in enjoy transactions so u cant record if u see there will be a choose button in purchase order text view
    click that it will take u to sap script editor where u can enter text

  • BDC for MM01

    Hi all.
    I need BDC code for MM01,i need to populate values depending upon "Material type",Because view changing depending upon material type.
    please give me code for that.
    To be reward all helpfull answers.
    Regards.
    jay

    Hi,
    This is a BDC for MM for T-code MM01.I hope this will help u.
    Below is the coding.
    Reward if helpful.
    Regards,
    Seevangi
    REPORT  ZMMBDC_MATERIAL_MASTER_UPD
    LINE-SIZE 255 NO STANDARD PAGE HEADING LINE-COUNT 65.
    Tables
    Structure declaration
    Work Variables and internal tables
    Constants
    Parameters
    Events: Start-Of-Selection
    data : begin of i_mara occurs 0,
            matnr like mara-matnr,
           end of i_mara.
    data : begin of ty_matdata,
            matnr like mara-matnr,   "material number
            mbrsh like rmmg1-mbrsh,  "Industry sector
            mtart like rmmg1-mtart,  "Material Type
            werks like rmmg1-werks,  "Plant
            lgort like rmmg1-lgort,  "Storage Location
            vkorg like rmmg1-vkorg,  "Sales Organization
            vtweg like rmmg1-vtweg,  "Distribution Channel
            maktx like makt-maktx,   "Material Description (Short Text)
            meins like mara-meins,   "Base Unit of Measure
            matkl like mara-matkl,   "Material Group
            bismt like mara-bismt,   "Old material number
            spart like mara-spart,   "Division
            brgew(15) ," like mara-brgew,   "Gross Weight
            ntgew(15), " like mara-ntgew,   "Net Weight
            ekgrp like marc-ekgrp,   "Purchasing Group
            gewei like mara-gewei,   "Weight Unit
            klart like rmclf-klart,  "Class Type
            taxkm like MG03STEUER-TAXKM, "Tax classification material
            ladgr like marc-ladgr,   "Loading Group
            tragr like mara-tragr,   "Transportation Group
            dismm like marc-dismm, "MRP Type
            dispo like marc-dispo, "MRP Controller (Materials Planner)
            fhori like marc-fhori, "Scheduling margin key
            disls like marc-disls, " lot size
            prmod like mpop-prmod, "Forecast model
            peran(3)," like mpop-peran,   "Number of historical periods
            anzpr(3)," like mpop-anzpr,   "Number of forecast periods
            kzini like mpop-kzini,   "Initialization indicator
            siggr(9)," like mpop-siggr,   "Tracking limit
            autru like marc-autru,   "Reset Forecast Model Automatically
            modav like mpop-modav,   "Model selection procedure
            perkz like marc-perkz, "Period Indicator
            verpr(13), " like mbew-verpr, "Moving Average Price/Periodic Unit Price
            prctr like marc-prctr, "Profit Center
            mtvfp like marc-mtvfp, "Checking Group for Availability Check
            bklas like mbew-bklas, "Valuation Class
            vprsv like mbew-vprsv, "Price control indicator
            stprs(13) ," like mbew-stprs, "Standard price
            peinh(5) ,"like mbew-peinh, "Price Unit
           end of ty_matdata,
           begin of ty_matdata1,
           matnr like mara-matnr,   "material number
            mbrsh like rmmg1-mbrsh,  "Industry sector
            mtart like rmmg1-mtart,  "Material Type
            werks like rmmg1-werks,  "Plant
            lgort like rmmg1-lgort,  "Storage Location
            vkorg like rmmg1-vkorg,  "Sales Organization
            vtweg like rmmg1-vtweg,  "Distribution Channel
            maktx like makt-maktx,   "Material Description (Short Text)
            meins like mara-meins,   "Base Unit of Measure
            matkl like mara-matkl,   "Material Group
            bismt like mara-bismt,   "Old material number
            spart like mara-spart,   "Division
            brgew(15) ," like mara-brgew,   "Gross Weight
            ntgew(15), " like mara-ntgew,   "Net Weight
            ekgrp like marc-ekgrp,   "Purchasing Group
            gewei like mara-gewei,   "Weight Unit
            klart like rmclf-klart,  "Class Type
            taxkm like MG03STEUER-TAXKM, "Tax classification material
            ladgr like marc-ladgr,   "Loading Group
            tragr like mara-tragr,   "Transportation Group
            dismm like marc-dismm, "MRP Type
            dispo like marc-dispo, "MRP Controller (Materials Planner)
            fhori like marc-fhori, "Scheduling margin key
            prmod like mpop-prmod, "Forecast model
            peran(3)," like mpop-peran,   "Number of historical periods
            anzpr(3)," like mpop-anzpr,   "Number of forecast periods
            kzini like mpop-kzini,   "Initialization indicator
            siggr(9)," like mpop-siggr,   "Tracking limit
            autru like marc-autru,   "Reset Forecast Model Automatically
            modav like mpop-modav,   "Model selection procedure
            perkz like marc-perkz, "Period Indicator
            verpr(13), " like mbew-verpr, "Moving Average Price/Periodic Unit Price
            prctr like marc-prctr, "Profit Center
            mtvfp like marc-mtvfp, "Checking Group for Availability Check
            bklas like mbew-bklas, "Valuation Class
            vprsv like mbew-vprsv, "Price control indicator
            stprs(13) ," like mbew-stprs, "Standard price
            peinh(5) ,"like mbew-peinh, "Price Unit
            message like bapiret2-message, "Error Message.
           end of ty_matdata1,
           begin of ty_error,
             matnr like mara-matnr,
             mbrsh like rmmg1-mbrsh,  "Industry sector
             mtart like rmmg1-mtart,  "Material Type
             werks like rmmg1-werks,  "Plant
             message like bapiret2-message,
           end of ty_error.
          Data                     Begin with W_                        *
    data : i_matdata like standard table of ty_matdata with header line.
    BAPIMATHEAD - Header Segment with Control Information
    data : i_headdata like bapimathead occurs 0 with header line.
    bapi_makt - Material Descriptions.
    data : i_bapi_makt like bapi_makt occurs 0 with header line.
    *bapi_mlan - Tax data
    data : i_bapi_mlan like bapi_mlan occurs 0 with header line.
    bapi_mara - Material Data at Client Level.
    data : i_clientdata like bapi_mara occurs 0 with header line.
    bapi_marax - Checkbox Structure for BAPI_MARA.
    data : i_clientdatax like bapi_marax occurs 0 with header line.
    bapi_marc - Material Data at Plant Level.
    data : i_plantdata like bapi_marc occurs 0 with header line.
    bapi_marcx - Checkbox Structure for BAPI_MARA.
    data : i_plantdatax like bapi_marcx occurs 0 with header line.
    BAPI_MARD - Material Data at Storage Location Level.
    data : i_storagelocationdata like bapi_mard occurs 0 with header line.
    bapi_mardx - Checkbox Structure for BAPI_MARD
    data : i_storagelocationdatax like bapi_mardx occurs 0 with header line.
    *bapi_mpop - Forecast Parameters
    data : i_forcastingparameter like BAPI_MPOP occurs 0 with header line.
    *bapi_mpopx - Checkbox Structure for BAPI_MPOP
    data : i_forcastingparameterx like BAPI_MPOPX occurs 0 with header line.
    *bapi_mbew - Valuation Data
    data : i_valuationdata like BAPI_MBEW occurs 0 with header line.
    *bapi_mbewx - Checkbox Structure for BAPI_MBEW
    data : i_valuationdatax like BAPI_MBEWX occurs 0 with header line.
    *bapi_mvke - Sales Data
    data : i_salesdata like BAPI_MVKE occurs 0 with header line.
    *bapi_mvkex - Checkbox Structure for BAPI_MVKE
    data : i_salesdatax like BAPI_MVKEX occurs 0 with header line.
    bapiret2 - Return parameter
    data : i_return like bapiret2 occurs 0 with header line.
    Errors displayed on screen.
    data : i_error like standard table of ty_error with header line.
    *Error data to be loaded after correction.
    data : i_matdata1 like standard table of ty_matdata1 with header line.
    *bapi_marm - Unit of measure
    data : i_bapi_marm like bapi_marm occurs 0 with header line.
    *bapi_marmx - unit of measurex
    data : i_bapi_marmx like bapi_marmx occurs 0 with header line.
    To determine error.
    data : w_flg(1).
       S E L E C T I O N     S C R E E N / P A R A M E T E R S
    selection-screen: begin of block b1 with frame.
    parameters: p_file like rlgrap-filename obligatory.
    selection-screen: end of block b1.
    selection-screen skip 1.
    selection-screen: begin of block b2 with frame.
    parameters: p_file1 like rlgrap-filename .
    selection-screen: end of block b2.
              A T   S E L E C T I O N   S C R E E N
    at selection-screen on value-request for p_file.
    WS_FILENAME_GET - Determination of a file name on the presentation
    server using a file selection dialog.
      call function 'WS_FILENAME_GET'
    exporting
       def_filename           = '*.TXT'
       def_path               = 'C:\'
       mask                   = ',.TXT,.*.'
       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.
                      T O P    O F     P A G E                          *
    top-of-page.
      skip.
      write : /01 'Material Number', 30 'Error Message'.
       S T  A R T   O F   S E L E C T I O N
    start-of-selection.
    perform read_data.
    perform create_material.
    perform display_error.
    *&      Form  read_data
          text
    -->  p1        text
    <--  p2        text
    form read_data.
    Uploads a file from the presentation server into an internal table.
    call function 'WS_UPLOAD'
           exporting
                codepage                = 'IBM'
                filename                = p_file
                filetype                = 'DAT'
           tables
                data_tab                = i_matdata
           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
                others                  = 10.
      if sy-subrc <> 0.
        write:/ 'File Not Uploaded'.
      endif.
    endform.                    " read_data
    *&      Form  create_material
          text
    -->  p1        text
    <--  p2        text
    form create_material.
    loop at i_matdata.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = i_matdata-matnr
    IMPORTING
       OUTPUT        = i_matdata-matnr.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = i_matdata-prctr
    IMPORTING
       OUTPUT        = i_matdata-prctr
    *select matnr from mara into table i_mara .
    *sort i_mara by matnr descending.
    *read table i_mara index 1.
    *i_mara-matnr = i_mara-matnr + 1.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        INPUT              =  i_mara-matnr
      IMPORTING
        OUTPUT             =  i_mara-matnr
      EXCEPTIONS
        LENGTH_ERROR       = 1
        OTHERS             = 2
    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 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
       INPUT              =  i_matdata-matnr
    IMPORTING
       OUTPUT             =  i_matdata-matnr
    EXCEPTIONS
       LENGTH_ERROR       = 1
       OTHERS             = 2
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    i_headdata-material = i_matdata-matnr.
      i_headdata-material = i_mara-matnr.
      i_headdata-ind_sector = i_matdata-mbrsh.
      i_headdata-matl_type = i_matdata-mtart.
      i_headdata-basic_view = 'X'.
      i_headdata-mrp_view = 'X'.
      i_headdata-storage_view = 'X'.
      i_headdata-SALES_VIEW = 'X'.
      i_headdata-PURCHASE_VIEW = 'X'.
      i_headdata-FORECAST_VIEW = 'X'.
      i_headdata-ACCOUNT_VIEW = 'X'.
      i_headdata-COST_VIEW = 'X'.
      i_headdata-prt_view = 'X'.
      i_headdata-work_sched_view = 'X'.
      i_headdata-quality_view = 'X'.
      append i_headdata.
    clear i_headdata.
      i_bapi_makt-langu     = sy-langu.
      i_bapi_makt-matl_desc = i_matdata-maktx.
      append i_bapi_makt.
    clear i_bapi_makt.
      i_clientdata-matl_group = i_matdata-matkl.
      i_clientdata-old_mat_no = i_matdata-bismt.
      i_clientdata-base_uom = i_matdata-meins.
      i_clientdata-division = i_matdata-spart.
      i_clientdata-UNIT_OF_WT = i_matdata-gewei.
      i_clientdata-TRANS_GRP = i_matdata-tragr.
      i_clientdata-NET_WEIGHT = i_matdata-ntgew.
      append i_clientdata.
    clear i_clientdata.
      i_clientdatax-matl_group = 'X'.
      i_clientdatax-old_mat_no = 'X'.
      i_clientdatax-base_uom = 'X'.
      i_clientdatax-division = 'X'.
      i_clientdatax-UNIT_OF_WT = 'X'.
      i_clientdatax-TRANS_GRP = 'X'.
      i_clientdatax-NET_WEIGHT = 'X'.
      append i_clientdatax.
    clear i_clientdatax.
      i_plantdata-plant = i_matdata-werks.
      i_plantdata-mrp_type = i_matdata-dismm.
      i_plantdata-mrp_ctrler = i_matdata-dispo.
      i_plantdata-availcheck = i_matdata-mtvfp.
      i_plantdata-profit_ctr = i_matdata-prctr.
      i_plantdata-LOADINGGRP = i_matdata-ladgr.
      i_plantdata-PUR_GROUP = i_matdata-ekgrp.
      i_plantdata-AUTO_RESET = i_matdata-autru.
      i_plantdata-PERIOD_IND = i_matdata-perkz.
      i_plantdata-MRP_CTRLER = i_matdata-dispo.
      i_plantdata-SM_KEY = i_matdata-fhori.
      i_plantdata-LOTSIZEKEY = i_matdata-disls.
      append i_plantdata.
    clear i_plantdata.
      i_plantdatax-plant = i_plantdata-plant.
      i_plantdatax-mrp_type = 'X'.
      i_plantdatax-mrp_ctrler = 'X'.
      i_plantdatax-availcheck = 'X' .
      i_plantdatax-profit_ctr = 'X' .
      i_plantdatax-LOADINGGRP = 'X' .
      i_plantdatax-PUR_GROUP = 'X' .
      i_plantdatax-AUTO_RESET = 'X'.
      i_plantdatax-PERIOD_IND = 'X'.
      i_plantdatax-MRP_CTRLER = 'X'.
      i_plantdatax-SM_KEY = 'X'.
      i_plantdatax-LOTSIZEKEY = 'X'.
      append i_plantdatax.
    clear i_plantdatax.
      clear i_forcastingparameter.
      i_forcastingparameter-PLANT = i_matdata-werks.
      i_forcastingparameter-HIST_VALS = i_matdata-peran.
      i_forcastingparameter-FORE_PDS = i_matdata-anzpr.
      i_forcastingparameter-INITIALIZE = i_matdata-kzini.
      i_forcastingparameter-TRACKLIMIT = i_matdata-siggr.
      i_forcastingparameter-MODEL_SP = i_matdata-modav.
      i_forcastingparameter-FORE_MODEL = i_matdata-prmod.
      append i_forcastingparameter.
      clear i_forcastingparameterx.
      i_forcastingparameterx-PLANT = i_matdata-werks.
      i_forcastingparameterx-HIST_VALS = 'X'.
      i_forcastingparameterx-FORE_PDS = 'X'.
      i_forcastingparameterx-INITIALIZE = 'X'.
      i_forcastingparameterx-TRACKLIMIT = 'X'.
      i_forcastingparameterx-MODEL_SP = 'X'.
      i_forcastingparameterx-FORE_MODEL = 'X'.
      append i_forcastingparameterx.
      i_valuationdata-MOVING_PR = i_matdata-verpr.
      i_valuationdata-STD_PRICE = i_matdata-stprs.
      i_valuationdata-PRICE_CTRL = i_matdata-VPRSV.
      i_valuationdata-VAL_CLASS = i_matdata-bklas.
      i_valuationdata-PRICE_UNIT = i_matdata-peinh.
      i_valuationdata-VAL_AREA = i_matdata-werks.
      append i_valuationdata.
      i_valuationdatax-VAL_AREA = i_matdata-werks.
      i_valuationdatax-MOVING_PR = 'X'.
      i_valuationdatax-STD_PRICE = 'X'.
      i_valuationdatax-PRICE_CTRL = 'X'.
      i_valuationdatax-VAL_CLASS = 'X'.
      i_valuationdatax-PRICE_UNIT = 'X'.
      append i_valuationdatax.
      i_salesdata-SALES_ORG = i_matdata-vkorg.
      i_salesdata-DISTR_CHAN = i_matdata-vtweg.
      i_salesdata-DELY_UOM = i_matdata-meins.
      append i_salesdata.
      i_salesdatax-SALES_ORG = i_matdata-vkorg.
      i_salesdatax-DISTR_CHAN = i_matdata-vtweg.
      i_salesdata-DELY_UOM = 'X'.
      append i_salesdatax.
      i_bapi_marm-ALT_UNIT = i_matdata-meins.
      i_bapi_marm-GROSS_WT = i_matdata-brgew.
      append i_bapi_marm.
      i_storagelocationdata-plant = i_plantdatax-plant.
      i_storagelocationdata-stge_loc = i_matdata-lgort.
      append i_storagelocationdata.
    clear i_storagelocationdata.
      i_storagelocationdatax-plant = i_plantdatax-plant.
      i_storagelocationdatax-stge_loc = i_storagelocationdata-stge_loc.
      append i_storagelocationdatax.
    clear i_storagelocationdatax.
    i_bapi_mlan-TAXCLASS_1 = i_matdata-TAXKM.
      append i_bapi_mlan.
    BAPI - BAPI_MATERIAL_SAVEDATA is used to Create and Change Material
    Master Data.
      call function 'BAPI_MATERIAL_SAVEDATA'
        exporting
          headdata                   = i_headdata
          clientdata                 = i_clientdata
          clientdatax                = i_clientdatax
          plantdata                  = i_plantdata
          plantdatax                 = i_plantdatax
          FORECASTPARAMETERS         = i_forcastingparameter
          FORECASTPARAMETERSX        = i_forcastingparameterx
        PLANNINGDATA               =
        PLANNINGDATAX              =
          storagelocationdata        = i_storagelocationdata
          storagelocationdatax       = i_storagelocationdatax
          VALUATIONDATA              = i_valuationdata
          VALUATIONDATAX             = i_valuationdatax
        WAREHOUSENUMBERDATA        =
        WAREHOUSENUMBERDATAX       =
          SALESDATA                  = i_salesdata
          SALESDATAX                 = i_salesdatax
        STORAGETYPEDATA            =
        STORAGETYPEDATAX           =
        FLAG_ONLINE                = ' '
        FLAG_CAD_CALL              = ' '
        importing
          return                     = i_return
        tables
          materialdescription        = i_bapi_makt
          UNITSOFMEASURE             = i_bapi_marm
          UNITSOFMEASUREX            = i_bapi_marmx
        INTERNATIONALARTNOS        =
        MATERIALLONGTEXT           =
         TAXCLASSIFICATIONS         = i_bapi_mlan
        RETURNMESSAGES             =
        PRTDATA                    =
        PRTDATAX                   =
        EXTENSIONIN                =
        EXTENSIONINX               =
    if i_return-type = 'E'.
        i_error-matnr = i_mara-matnr.
        i_error-mbrsh = i_matdata-mbrsh.
        i_error-mtart = i_matdata-mtart.
        i_error-werks = i_matdata-werks.
        i_error-message = i_return-message.
      append i_error.
      clear i_error.
      w_flg = 'X'.
    *else.
    Execute external Commit when using BAPIs
    When you call BAPIs in your program that change data in the R/3
    System afterwards you must call this method to write the changes to *
    the database.
    call function 'BAPI_TRANSACTION_COMMIT'
    exporting
       wait          = 'X'
    importing
       return        = i_return
    endif.
    refresh : i_headdata ,  i_bapi_makt, i_clientdata, i_clientdatax ,
              i_plantdata, i_plantdatax,
              i_storagelocationdata,i_storagelocationdatax,
              i_salesdata , i_salesdatax ,
              i_valuationdata , i_valuationdatax,
              i_bapi_marm,i_bapi_marmx,
              i_bapi_mlan.
    clear : i_headdata ,  i_bapi_makt, i_clientdata, i_clientdatax ,
              i_plantdata, i_plantdatax, i_storagelocationdata,
              i_storagelocationdatax,
              i_valuationdata , i_valuationdatax,
              i_bapi_marm,i_bapi_marmx,
              i_bapi_mlan.
    endloop.
    endform.                    " create_material
    *&      Form  display_error
          text
    -->  p1        text
    <--  p2        text
    form display_error.
    loop at i_error.
    read table i_matdata with key matnr = i_error-matnr.
    if sy-subrc = 0.
        i_matdata1-matnr = i_mara-matnr.
        i_matdata1-mbrsh = i_matdata-mbrsh.
        i_matdata1-mtart = i_matdata-mtart.
        i_matdata1-maktx = i_matdata-maktx.
        i_matdata1-meins = i_matdata-meins.
       i_matdata1-matkl = i_matdata-matkl.
       i_matdata1-bismt = i_matdata-bismt.
       i_matdata1-zeinr = i_matdata-zeinr.
       i_matdata1-spart = i_matdata-spart.
       i_matdata1-werks = i_matdata-werks.
       i_matdata1-dismm = i_matdata-dismm.
       i_matdata1-dispo = i_matdata-dispo.
       i_matdata1-beskz = i_matdata-beskz.
       i_matdata1-sobsl = i_matdata-sobsl.
       i_matdata1-lgpro = i_matdata-lgpro.
       i_matdata1-lgfsb = i_matdata-lgfsb.
       i_matdata1-eprio = i_matdata-eprio.
       i_matdata1-mtvfp = i_matdata-mtvfp.
       i_matdata1-lgort = i_matdata-lgort.
       i_matdata1-lgpbe = i_matdata-lgpbe.
       i_matdata1-prctr = i_matdata-prctr.
       i_matdata1-message = i_error-message.
        append i_matdata1.
        clear i_matdata1.
    endif.
    endloop.
    loop at i_error.
      write :/01 i_error-matnr , 30 i_error-message.
    endloop.
    if i_error is initial.
      write :/01 text-001.
    endif.
    if w_flg = 'X'.
      call function 'WS_DOWNLOAD'
       exporting
        BIN_FILESIZE                  = ' '
         codepage                      = 'IBM'
         filename                      = p_file1
         filetype                      = 'DAT'
        MODE                          = ' '
        WK1_N_FORMAT                  = ' '
        WK1_N_SIZE                    = ' '
        WK1_T_FORMAT                  = ' '
        WK1_T_SIZE                    = ' '
        COL_SELECT                    = ' '
        COL_SELECTMASK                = ' '
        NO_AUTH_CHECK                 = ' '
      IMPORTING
        FILELENGTH                    =
        tables
          data_tab                      = i_error
        FIELDNAMES                    =
       exceptions
         file_open_error               = 1
         file_write_error              = 2
         invalid_filesize              = 3
         invalid_type                  = 4
         no_batch                      = 5
         unknown_error                 = 6
         invalid_table_width           = 7
         gui_refuse_filetransfer       = 8
         customer_error                = 9
         others                        = 10
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endif.
    endform.                    " display_error7

  • HI I HAVE PROBLEM WHEN IAM WRITING BDC FOR MM01

    HI,
    WHEN IAM WRITING BDC PROGRAM FOR MM01 USING SHDB RECORDING. WHEN I RECORDED SOME VIEWS I MEAN I SCROLLED DOWN AND SELECT THOSE VIEWS.
    BUT IT WILL NOT TAKE THOSE VIEWS WHEN I UPLOAD THE DATA THOSE VIEWS ARE NOT SELECTED. PLZ TELL ME HOW COULD I DO THIS.
    URGENT PLZ.
    THANKS,
    MURALI.

    Hi Murali,
    Rather of scrolling down while recording press page down button. as scroll will not get recorded during recording.
    The page down function code is P+.
    Press page down button on key board while recording.
    I had checked it through recording it had worked.
    I got BDC_OKCODE     = P+ in recording.
    This will solve your problem.
    Regards
    Narin Nandivada

  • BDC for MM01 using bapi

    HI all ,
    i am new to bapi . i have created so many bdcs to upload data in sap but havent done any bapi .
    i want to upload data through bapi  for mm01 .
    how can i achieve this and which bapi is responsible for this job . plz send any sample code for this .
    Thanks ,
    Amit Ranjan .

    Hi Amit,
    Refer to the code in the following link:
    Re: Reg Transfer of MM01 data using BAPI method
    Hope this will solve your query...

  • BDC Migrations for Both Call and Session for same Transaction

    Hi Friends,
    When am trying to migrate 100 records for MM01 by using both call transaction and session method but i got the error at 50th record..i would like to know what was happen in both of them and how can i resolve those errors please can you let me know
    Regards,
    Sreenivas

    Hi,
    I don't understand, did you check the log of SM35 ?  did you try to execute the BDC in display error ?
    regards
    Fred

  • Dynamic select views for MM01 Transaction

    Hii  Friends,
    I have an issue like i need to dynamically select the views in MM01 transaction from the BDC program
    without selecting that views manually.
    Using SHDB recording i can select the views before recording  and then call those views again
    If i want to select the views from the program how do i do it..
    If there is any way to do this in call transaction let me know plz
    Thanks in advance
    kishore

    BDC is not good for MM01 , go for bapi
    other wise go for  LSMW bapi method...
    Business Object      BUS1001006   Standard material
    Method               SAVEDATA                    Create and change materia
    Message Type         MATMAS_BAPI                 Create and change materia
    Basic Type           MATMAS_BAPI02               Create and Change Materia

  • Hello BAPI For MM01

    Hello All,
                     I am trying to develop a bapi for MM01.For which i have used a code as suggested by one of you.But the problem is when i am trying to upload my Excel sheet it is giving me a dump. I have designed my Excel sheet according to the sequence in my code. Is it necessary to maintain the sequence as in BDC?. Hers the code to have a clear idea.Please help me out as i am new to BAPI.
    *& Report  ZBAPI2
    REPORT  ZBAPI2.
    TABLES
    FLAGS *
    DATA: f_stop. " Flag used to stop processing
    DATA DECLARATIONS *
    DATA : v_empty TYPE i, " No. of empty records
    v_total TYPE i. " Total no. of records.
    STRUCTURES & INTERNAL TABLES
    *--- BAPI structures
    DATA: bapi_head LIKE bapimathead,  " Header Segment with Control
    bapi_makt LIKE bapi_makt, " Material Description
    bapi_mara1 LIKE bapi_mara, " Client Data
    bapi_marax LIKE bapi_marax, " Checkbox Structure for BAPI_MARA
    bapi_marc1 LIKE bapi_marc, " Plant View
    bapi_marcx LIKE bapi_marcx, " Checkbox Structure for BAPI_MARC
    bapi_mbew1 LIKE bapi_mbew, " Accounting View
    bapi_mbewx LIKE bapi_mbewx, " Checkbox Structure for BAPI_MBEW
    bapi_return LIKE bapiret2. " Return Parameter
    *--- Internal table to hold excel file data
    DATA: it_intern TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    *--- Internal table to hold Matetrial descriptions
    DATA: BEGIN OF it_makt OCCURS 100.
            INCLUDE STRUCTURE bapi_makt.
    DATA: END OF it_makt.
    *--- Internal to hold the records in the text file
    DATA : BEGIN OF it_data OCCURS 100,
    werks(4), " Plant
    mtart(4), " Material type
    matnr(18), " Material number
    matkl(9) , " Material group
    mbrsh(1), " Industry sector
    meins(3), " Base unit of measure
    gewei(3), " Weight Unit
    spart(2), " Division
    ekgrp(3), " Purchasing group
    vprsv(1), " Price control indicator
    *stprs(12), " Standard price
    peinh(3), " Price unit
    *spras(2), " Language key
    maktx(40), " Material description
    END OF it_data.
    SELECTION SCREEN. *
    SELECTION-SCREEN BEGIN OF BLOCK scr1 WITH FRAME TITLE text-111.
    PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY DEFAULT " Input File
    'C:\Material_master.XLS'.
    PARAMETER : p_max(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
    PARAMETERS: p_header TYPE i DEFAULT 0. " Header Lines
    PARAMETERS: p_begcol TYPE i DEFAULT 1 NO-DISPLAY,
    p_begrow TYPE i DEFAULT 1 NO-DISPLAY,
    p_endcol TYPE i DEFAULT 100 NO-DISPLAY,
    p_endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK scr1.
    AT SELECTION-SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *--- Validating file
      PERFORM validate_file USING p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    *--- Perform to convert the Excel data into an internal table
      PERFORM convert_xls_itab.
      IF NOT it_data[] IS INITIAL.
    *--- Perform to delete Header lines
        PERFORM delete_header_empty_recs.
      ENDIF.
    END OF SELECTION. *
    END-OF-SELECTION.
    *--- Perform to upload Material Master data
      PERFORM upload_matmas.
    Form : validate_input_file
    Description : To provide F4 help for file if read from PC
    FORM validate_file USING f_file TYPE rlgrap-filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name     = f_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE s010(zlkpl_msgclass). " 'Error in getting filename'.
      ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    text
    FORM convert_xls_itab.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename    = p_file
          i_begin_col = p_begcol
          i_begin_row = p_begrow
          i_end_col   = p_endcol
          i_end_row   = p_endrow
        TABLES
          intern      = it_intern.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *--- Perform to move the data into an internal data
      PERFORM move_data.
    ENDFORM. " CONVERT_XLS_ITAB
    *& Form MOVE_DATA
    text
    FORM move_data.
      DATA : lv_index TYPE i.
      FIELD-SYMBOLS <fs>  .
    *--- Sorting the internal table
      SORT it_intern BY row col.
      CLEAR it_intern.
      LOOP AT it_intern.
        MOVE it_intern-col TO lv_index.
    *--- Assigning the each record to an internal table row
        ASSIGN COMPONENT lv_index OF STRUCTURE it_data TO <fs> .
    *--- Asigning the field value to a field symbol
        MOVE it_intern-value TO <fs> .
        AT END OF row.
          APPEND it_data.
          CLEAR it_data.
        ENDAT.
      ENDLOOP.
    ENDFORM. " MOVE_DATA
    *& Form DELETE_HEADER_EMPTY_RECS
    To delete the Header and empty records
    FORM delete_header_empty_recs.
      DATA: lv_tabix LIKE sy-tabix.
      IF NOT p_header IS INITIAL.
        LOOP AT it_data.
          IF p_header > 0 AND NOT it_data IS INITIAL.
            DELETE it_data FROM 1 TO p_header.
    P_HEADER = 0.
            EXIT.
          ENDIF.
        ENDLOOP.
      ENDIF.
      CLEAR it_data.
    *--- To delete the empty lines from internal table
      LOOP AT it_data.
        lv_tabix = sy-tabix.
        IF it_data IS INITIAL.
          v_empty = v_empty + 1.
          DELETE it_data INDEX lv_tabix..
        ENDIF.
      ENDLOOP.
      CLEAR it_data.
    *--- Total no of recs in file
      DESCRIBE TABLE it_data LINES v_total.
      IF v_total = 0.
        MESSAGE i013(zlkpl_msgclass). " No records in the file
        f_stop = 'X'.
        STOP.
      ENDIF.
    ENDFORM. " DELETE_HEADER_EMPTY_RECS
    *& Form UPLOAD_MATMAS
    to upload Material Master data
    FORM upload_matmas .
      LOOP AT it_data.
    Header
        bapi_head-material = it_data-matnr.
        bapi_head-ind_sector = it_data-mbrsh.
        bapi_head-matl_type = it_data-mtart.
        bapi_head-basic_view = 'X'.
        bapi_head-purchase_view = 'X'.
        bapi_head-account_view = 'X'.
    Material Description
        REFRESH it_makt.
       it_makt-langu = it_data-spras.
        it_makt-matl_desc = it_data-maktx.
        APPEND it_makt.
    Client Data - Basic
        bapi_mara1-matl_group = it_data-matkl.
        bapi_mara1-base_uom = it_data-meins.
        bapi_mara1-unit_of_wt = it_data-gewei.
        bapi_mara1-division = it_data-spart.
        bapi_marax-matl_group = 'X'.
        bapi_marax-base_uom = 'X'.
        bapi_marax-unit_of_wt = 'X'.
        bapi_marax-division = 'X'.
    Plant - Purchasing
        bapi_marc1-plant = it_data-werks.
        bapi_marc1-pur_group = it_data-ekgrp.
        bapi_marcx-plant = it_data-werks.
        bapi_marcx-pur_group = 'X'.
    Accounting
        bapi_mbew1-val_area = it_data-werks.
        bapi_mbew1-price_ctrl = it_data-vprsv.
       bapi_mbew1-std_price = it_data-stprs.
        bapi_mbew1-price_unit = it_data-peinh.
        bapi_mbewx-val_area = it_data-werks.
        bapi_mbewx-price_ctrl = 'X'.
        bapi_mbewx-std_price = 'X'.
        bapi_mbewx-price_unit = 'X'.
    *--- BAPI to create material
        CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
        headdata = bapi_head
        clientdata = bapi_mara1
        clientdatax = bapi_marax
        plantdata = bapi_marc1
        plantdatax = bapi_marcx
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA = BAPI_MBEW1
    VALUATIONDATAX = BAPI_MBEWX
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
        IMPORTING
        return = bapi_return
        TABLES
        materialdescription = it_makt
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
        IF bapi_return-type = 'E'.
          WRITE:/ 'Error:' ,bapi_return-message ,'for material:' ,
    it_data-matnr.
        ELSEIF bapi_return-type = 'S'.
          WRITE: 'Successfully created material' ,it_data-matnr.
        ENDIF.
      ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS

    Hi bnupur14,
      Please do place a debugger @ FM ALSM_EXCEL_TO_INTERNAL_TABLE and check p_file, make p_endcol is 12, p_endrow 65000, then check whether its going for dump or not.
    I have executed your code there is no dump @ FM ALSM_EXCEL_TO_INTERNAL_TABLE or converting data into internal table.
    But where You are getting Dump actually.
    Regards,
    Suneel G
    Edited by: Suneel Kumar Gopisetty on Aug 19, 2009 11:02 AM

  • Code thrownig an error after recording for MM01

    Hello BAPI Experts,
    I would like to ask that recording using T.Code shdb(for MM01)  Mat Type: Raw Material to extend from one plant & storage location to another .My code thrownig an error , as I capture all views
    ls it not possible using BDC.
    Valuable answer will b appreciated in form of beers!
    Thanks in advance!!!!!!
    R Sinha

    Hi Sinha..
    In recording select Views using PgDn button, You should not use mouse by scrolling it.
    I think this will resolve your Problem, still need help plz do message me.
    Please do close the thread once you problem is resolved.
    Regards,
    sg

  • What is the process for mm01 datatransfer by selecting different views

    what will be the basic thing to be done for selecting different views?

    hi ..if want to upload master data for different views then first create material using MM01 and then update material for different views one by one in MM02..for mass data transfer u can use BDCs for MM01 and MM02
    regards

  • Problem in creating a BDC program for transaction cj20n(project sytem)

    Hi all,
    I am trying to create project,WBS element ,network and activity using a BDC program,
      I am able to create to a recording for the transaction cj20n using tcode shdb but when i run the recording it doesnt run properly i am not able to create any thing.
    I get error saying that a particular field doesnt exist on the screen.
    Is possible to create a BDC program for transaction CJ20N ?
    Also is there any other alternative  apart from using a BAPI or a function module.
    Thanks,
    Nishant

    Hi,
        Check below link for BAPIs of transaction cj20n.
    [BAPI for cj20n|BAPI for CJ20N transaction]
    Thanks,
    Asit Purbey.

  • BAdI/User Exit for MM01

    Hi All,
    I am looking for a User Exit for MM01
    I need to catpure the Document data in MM01>Additional data>Document data tab
    I checked with the following enchancements but no use
    MGA00001
    MGA00002
    MGA00003
    BADI_Material_Check.
    Can any one help me in finding the suitable enhancemet?
    Thanks
    Bhasker

    Hi Bhasker
    Go to Se18 Tcode
    and give the definition name is "DOCUMENT_MAIN01"
    check the definition in display mode because it is Sap Standard Definition.
    there you will find a "TYPE" Tab
    under this you have two check boxes 
    <b>1) Multiple Use</b>
    2) Filter-Depend
    if you want multiple implementations  check this Check box
    after this you need to create a request and the system asks  Access Key for Changes
    for that you will catch that Key from your Basis Team.
    Regards
    Sreeni

Maybe you are looking for

  • How to show a report for 'Previous Month' Data

    Hi Gurus, I have a requirement, where i have to default my report to show previous month data. Scenario: My prompts by Default are set to CURRENT (current year,quarter,month). once the user logs in, the report should display data for month 'Nov' inst

  • After updating my ipod i have lost apps and music how do i retrieve them

    I just updated my ipod touch to the latest version and have now noticed that my apps and some of my music have disappeared? I recall itunes saying that my ipod have been synced to another computer (but this isn't the case, I have only ever synced my

  • ESS: Changing input field to dropdown box

    Hi,   We are configuring ESS, portal's record working time iview has a column "wage type(CATSD-LGART)" which is input field with search help in portal screen.We are looking for an option to change this field to drop down box.  Client wants simple nav

  • Safari won't open php's

    safari 5.1 os 10.68 Trying to open a php web page shows a blank page

  • Contacts first & Last name

    Good day,     Can anyone help in switching my contacts in X3 from last - first display to First - Last Display. Thanks