BDC for MM01(Material creation)

Hello Please anybody send me code for creating materials with reference to reference material and plant in sselection screen in version ECC 6.0?
My selection screen will be::
Reference material:                                                       Plant:

Plz User <b>BAPI_MATERIAL_SAVEDATA</b>
Why So :
you will never get it to work correctly in all cases every time for all material types, it is just much easier to work with an API that is not screen dependent. Then you don't have to worry about all of the exceptions when dealing with certain material types, and such. For example, say you have a material which you want to update the po text, and you did your recording for another material, which didn't have a specific view, so now when doing BDC for this material, the screen where you select the view you want to process, may be in a different place in the table control, see what I'm getting at? Its just very much easier to work with BAPIs and is suggest to use BAPI over BDC whenever possible.
Also still u want to go for it, check this code :
REPORT Y730_BDC5 .
*HANDLING TABLE CONTROL IN BDC
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(100) TYPE C,
END OF IT_DUMMY.
DATA : BEGIN OF IT_XK01 OCCURS 0,
LIFNR(10) TYPE C,
BUKRS(4) TYPE C,
EKORG(4) TYPE C,
KTOKK(4) TYPE C,
NAME1(30) TYPE C,
SORTL(10) TYPE C,
LAND1(3) TYPE C,
SPRAS(2) TYPE C,
AKONT(6) TYPE C,
FDGRV(2) TYPE C,
WAERS(3) TYPE C,
END OF IT_XK01,
BEGIN OF IT_BANK OCCURS 0,
BANKS(3) TYPE C,
BANKL(10) TYPE C,
BANKN(10) TYPE C,
KOINH(30) TYPE C,
LIFNR(10) TYPE C,
END OF IT_BANK.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'C:\VENDOR.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DUMMY.
LOOP AT IT_DUMMY.
IF IT_DUMMY-DUMMY+0(2) = '11'.
IT_XK01-LIFNR = IT_DUMMY-DUMMY+2(10).
IT_XK01-BUKRS = IT_DUMMY-DUMMY+12(4).
IT_XK01-EKORG = IT_DUMMY-DUMMY+16(4).
IT_XK01-KTOKK = IT_DUMMY-DUMMY+20(4).
IT_XK01-NAME1 = IT_DUMMY-DUMMY+24(30).
IT_XK01-SORTL = IT_DUMMY-DUMMY+54(10).
IT_XK01-LAND1 = IT_DUMMY-DUMMY+64(3).
IT_XK01-SPRAS = IT_DUMMY-DUMMY+67(2).
IT_XK01-AKONT = IT_DUMMY-DUMMY+69(6).
IT_XK01-FDGRV = IT_DUMMY-DUMMY+75(2).
IT_XK01-WAERS = IT_DUMMY-DUMMY+77(3).
APPEND IT_XK01.
ELSE.
IT_BANK-BANKS = IT_DUMMY-DUMMY+2(3).
IT_BANK-BANKL = IT_DUMMY-DUMMY+5(10).
IT_BANK-BANKN = IT_DUMMY-DUMMY+15(10).
IT_BANK-KOINH = IT_DUMMY-DUMMY+25(30).
IT_BANK-LIFNR = IT_DUMMY-DUMMY+55(10).
APPEND IT_BANK.
ENDIF.
ENDLOOP.
LOOP AT IT_XK01.
REFRESH IT_BDCDATA.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-REF_LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
IT_XK01-LIFNR.
perform bdc_field using 'RF02K-BUKRS'
IT_XK01-BUKRS.
perform bdc_field using 'RF02K-EKORG'
IT_XK01-EKORG.
perform bdc_field using 'RF02K-KTOKK'
IT_XK01-KTOKK.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-TELX1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
IT_XK01-NAME1.
perform bdc_field using 'LFA1-SORTL'
IT_XK01-SORTL.
perform bdc_field using 'LFA1-LAND1'
IT_XK01-LAND1.
perform bdc_field using 'LFA1-SPRAS'
IT_XK01-SPRAS.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-KOINH(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
DATA : FNAM(20) TYPE C,
IDX TYPE C.
MOVE 1 TO IDX.
LOOP AT IT_BANK WHERE LIFNR = IT_XK01-LIFNR.
CONCATENATE 'LFBK-BANKS(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKS.
CONCATENATE 'LFBK-BANKL(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKL.
CONCATENATE 'LFBK-BANKN(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-BANKN.
CONCATENATE 'LFBK-KOINH(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
IT_BANK-KOINH.
IDX = IDX + 1.
ENDLOOP.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-FDGRV'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFB1-AKONT'
IT_XK01-AKONT.
perform bdc_field using 'LFB1-FDGRV'
IT_XK01-FDGRV.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
IT_XK01-WAERS.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'WYT3-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'XK01' USING IT_BDCDATA
MODE 'A'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
ENDLOOP.
FORM BDC_DYNPRO USING PROG SCR.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROG.
IT_BDCDATA-DYNPRO = SCR.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDFORM.
All things r available in SDN, please search.
Reward points if useful.
Thanks
vinsee

Similar Messages

  • Screen Exit for MM01 Material Creation

    Hi,
    The requirement is to add 2 new field in the Material Creation transaction (MM01) in the General Plant / Storage Location View.
    I was trying to find the Screen exit in the MGA Package but there was no screen exit for material. So, i tried by SPRO- IMG, iam able to attach my designed screen and its viewable in MM01 but the data is not being updated in the relevant table for the custom fields (The custom fields are appended in the MARC table).
    So, can you please help me about the coding part for the updation of the custom field data.
    Thanx

    Hi,
      Check these:
    MGA00001 - Material Master (Industry): Checks
    and Enhancements
    MGA00002 - Material Master (Industry): Number
    Assignment
    MGA00003 - Material Master (Industry and
    Retail): Number Display
    Check with 'BADI_MATERIAL_REF'
    Refer
    http://www.****************/Tutorials/ExitsBADIs/MM/MM01.htm
    https://forums.sdn.sap.com/click.jspa?searchID=7217830&messageID=3313524
    Regards
    Kiran

  • LSMW/BDC for service PO creation

    Dear all,
    Can anybody pl suggest how to create an LSMW or BDC for service PO creation with multiple
    line items and under each line item there will be multiple service line items also.
    Thx
    Amitava

    hi,
    You could do LSMW without the help of a technical consultant.
    In LSMW you could create a PO by BDc or through BAPI.
    Make use of the BAPI to create.
    BAPI_PO_CREATE1. ( Nothing but a Se37 Function module).
    the parmeters required can be checked in funcition module documentaion in the bapi.
    Hope this helps.
    harish

  • 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

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

  • 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

  • Any component for article/material creation

    Hi All
    Is there any standard component for UI of articles/material creation in Webdynpro ABAP or SAP Floor Plan Manager?
    Regards
    Sunit

    Hi Aditya,
    There is a standard component for Sales order maintenance : LORD_MAINTAIN_COMP
    Note: It is also used to create / change /display the quotation/inquiry as well
    Regards,
    Rama
    Message was edited by: Ramakrishnappa Gangappa

  • Run time error while running BDC for production order creation and confirmation:

    Dear Gurus,
    We have a situation, where the users are trying to do the entries creation of order or confirmation (through manual and BDC). But, if there is any kind of a deficit quantities in consumption or GR quantity, then it is going to run time error and Dumps are coming in program SAPLCORB
    and the transaction code is coming for CO11N.
    How to avoid this error to run the production system in smoothing way...Any flash lights on this will be great full
    Regards,
    Madhu.G

    Hi Madhu,
    Expert Caetano has rightly point out. Refer Note 1840705 - RAISE_EXCEPTION short dump if running CO11N in background
    Cause
    The short dump is triggered because SAP transaction CO11N contains new GUI elements that cannot always be dealt with in a background process,
    such as the confirmation texts.
    Resolution
    SAP recommends that the standard production order BAPIs, such as BAPI_PRODORDCONF_CREATE_TT, should be used to post a confirmation in background.
    If this is not feasible, the following workaround may be uses:
    Define a confirmation profile in transaction OPK0; 
    In the detail areas, remove the area "Confirmation text"; 
    Set this profile as standard, so that it is chosen automatically by the system when a batch-job
    is started; 
    Assign this confirmation profile to the batch user with transaction SU3 using parameter CORUPROF.
    Also see Note 429432 - CO11N: Batch input in background dumps if long text is maintained
    Refer to note 1154692 - Endless loop during confirmation in background if you doing Auto GR during confirmations
    Thanks & Regards,
    Ramagiri

  • Bdc for mm01 transaction

    Hi friends,
        I have to upload data using mm01 transaction.
        My program has to select respective views according to material type.
        Can anybody help me.
    Thanks and regards,
    Pavani.

    Hi,
    You will save lot of time & energy if you opt to use BAPI_MATERIAL_SAVEDATA. Have a look @the sample code. Please note Do not allocate any points as this code doesn't belong to me, however I have tested it & it works fine.
    TABLES bapi_MVKEx.
    * 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
                                      "Information
    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_MVKE1 LIKE BAPI_MVKE, "Sales Data
    BAPI_RETURN LIKE BAPIRET2. " Return Parameter
    DATA: return     LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    *--- 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
    MTPOS_MARA(4), "Item Category Group
    vkorg(4), "Sales Org
    vtweg(2), "Dist channel
    Prdha(18), "Prod Hierarchy
    ladgr(4), " Loading Group
    prctr(10), "Profit Centr
    xchpf(1), "Batch Mgmt
    kondm(2), "Material Pricing Grp
    ktgrm(2), "Account Assignment Grp
    mvgr1(4),
    mvgr2(4),
    mvgr3(4),
    versg(1), "Material Statistics Grp
    * Added fields not part of the layout
    sapmatnr(18),
    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
    'H:\DATA\Nova\rbc\zrbc129.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'
    exporting
    STATIC = 'X'
    CHANGING
    FILE_NAME = F_FILE
    EXCEPTIONS
    MASK_TOO_LONG = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    *MESSAGE S010" 'Error in getting filename'.
    ENDIF.
    ENDFORM. " validate_input_file
    *& Form CONVER_XLS_ITAB
    * To convert XLS to internal table
    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> type any.
    *--- 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
    <fs> = it_intern-value.
    *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" 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
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        input              = it_data-matnr
    IMPORTING
       OUTPUT             =  it_data-sapmatnr
    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.
    BAPI_HEAD-MATERIAL = IT_DATA-sapMATNR.
    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'.
    BAPI_HEAD-SALES_VIEW = 'X'.
    BAPI_HEAD-QUALITY_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_MARA1-item_cat = it_data-mtpos_mara.
    BAPI_MARA1-PROD_HIER = it_data-prdha.
    bapi_marax-item_cat = 'X'.
    bapi_marax-prod_hier = 'X'.
    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_MARC1-LOADINGGRP = IT_DATA-LADGR.
    BAPI_MARC1-PROFIT_CTR = IT_DATA-prctr.
    BAPI_MARC1-BATCH_MGMT = IT_DATA-xchpf.
    bapi_marc1-qm_authgrp = 'X'.
    bapi_marcx-qm_authgrp = 'X'.
    BAPI_MARCX-PLANT = IT_DATA-WERKS.
    BAPI_MARCX-PUR_GROUP = 'X'.
    BAPI_MARCX-LOADINGGRP = 'X'.
    BAPI_MARCX-PROFIT_CTR = 'X'.
    BAPI_MARCX-BATCH_MGMT = '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'.
    * Sales Data
    BAPI_MVKE1-ITEM_CAT = IT_DATA-MTPOS_MARA.
    BAPI_MVKEX-ITEM_CAT = 'X'.
    BAPI_MVKE1-SALES_ORG = IT_DATA-vkorg.
    BAPI_MVKEX-SALES_ORG = IT_DATA-vkorg.
    BAPI_MVKE1-DISTR_CHAN = IT_DATA-vtweg.
    BAPI_MVKEX-DISTR_CHAN = IT_DATA-vtweg.
    BAPI_MVKE1-MAT_PR_GRP = IT_DATA-kondm.
    BAPI_MVKEX-MAT_PR_GRP = 'X'.
    BAPI_MVKE1-ACCT_ASSGT = IT_DATA-ktgrm.
    BAPI_MVKEX-ACCT_ASSGT = 'X'.
    BAPI_MVKE1-MATL_GRP_1 = IT_DATA-mvgr1.
    BAPI_MVKEX-MATL_GRP_1 = 'X'.
    BAPI_MVKE1-MATL_GRP_2 = IT_DATA-mvgr2.
    BAPI_MVKEX-MATL_GRP_2 = 'X'.
    BAPI_MVKE1-MATL_GRP_3 = IT_DATA-mvgr3.
    BAPI_MVKEX-MATL_GRP_3 = 'X'.
    BAPI_MVKE1-matl_stats = IT_DATA-versg.
    BAPI_MVKEX-matl_stats = '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
    SALESDATA = BAPI_MVKE1
    SALESDATAX = BAPI_MVKEX
    IMPORTING
    RETURN = BAPI_RETURN
    TABLES
    MATERIALDESCRIPTION = IT_MAKT
    IF BAPI_RETURN-TYPE = 'E'.
    WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,it_data-matnr.
    ELSEIF BAPI_RETURN-TYPE = 'S'.
    WRITE: 'Successfully created/Changed material' ,it_data-matnr.
          CLEAR return.
          REFRESH return.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               IMPORTING
                    return = return.
    ENDIF.
    ENDLOOP.
    ENDFORM. " UPLOAD_MATMAS
    Regards
    Raju Chitale

  • Bdc for MM01 with classification view

    Hi all,
    I need to create materials using mm01 with classification view. since there is no bapi supporting this view, i am ding by bdc.
    The problem is in classification view once i give the class type and name a screen pops with caption
    characteristic value assignment, but theere are no charateristics displayed - wat values do i have to enter here >
    once i leave this screen the characteristics show up one after the other and i can load the details. but then while tryin to save error comes staing incnsisitent value assigned. wat do i ener in the intermediate screen t avoid this error.
    thanks

    hi when you are creating a classification view with characteristics.. you need to do all at once... you cannot modify..
    all you can do is delete the whole view and create with all the changed again.. I  dont memorize the BAPI .. but you have BAPIdelete.. BAPIadd..

  • BDC for MM01 - Views not getting selected

    Hi,
    I have recorded the MM01 transaction and have developed the BDC code. While recording I selected the following views - Basic Data 1, Basic Data 2, Purchasing, Accounting 1 and Accounting 2.
    I run the BDC program by call transaction method. I selected the processing mode as 'A'. Now when I execute the program I get the Select view screen. In that Basic data1, basic data2 and purchasing views are getting selected automatically but Accounting 1 and accounting 2 views are not getting selected. When I click ok, the Plant in organization level is not picked up from excel file.
    While selecting views when I scroll the views screen then Accounting 1 and accounting 2 views are getting selected and the plant detail is picked from the excel.
    Please help.
    Regards,
    Sriram

    Hi,
    Use this BDC okcode to get the Accounting tab selected.
                                                         T     MM01                                                                               
    SAPLMGMM          0060          X                                                                               
    BDC_CURSOR     RMMG1-MTART
                                                                BDC_OKCODE     /00
                                                                RMMG1-MTART     FERT
    SAPLMGMM     0070     X                                                                               
    BDC_CURSOR     MSICHTAUSW-DYTXT(02)
                                                                BDC_OKCODE     =P+
                                                                MSICHTAUSW-KZSEL(01)     X
                                                                MSICHTAUSW-KZSEL(02)     X
    SAPLMGMM     0070     X                                                                               
    BDC_CURSOR     MSICHTAUSW-DYTXT(08)
                                                                BDC_OKCODE     =ENTR
                                                                MSICHTAUSW-KZSEL(07)     X
                                                                MSICHTAUSW-KZSEL(08)     X
    Hope this may be useful
    Thanks,
    Archana

  • BDC for F4 help in MM01

    Hi
    I have done a BDC for mm01 but when I am selecting sales Org view and trying to click on F4 the transaction hangs. I further checked the BDC of F4 does not get recorded. I tried to use Ok code 04 but it only picks the first value in the search help and populates without showing the F4. I am attaching my Code. Please can you have a look how to accomplish the requirement
    PERFORM F_POPULATE_BDCTAB USING:
         '1'  'SAPLMGMM'          '0060',
         ' '  'BDC_CURSOR'        'RMMG1-MTART',
         ' '  'BDC_OKCODE'        '=AUSW',
         ' '  'RMMG1-MBRSH'       l_c_3,
         ' '  'RMMG1-MTART'       mtart,
         '1'  'SAPLMGMM'          '0070',
         ' '  'BDC_CURSOR'        'MSICHTAUSW-DYTXT(01)',
         ' '  'BDC_OKCODE'        '=SELA',
         ' '  'BDC_CURSOR'        'MSICHTAUSW-DYTXT(01)',
         ' '  'BDC_OKCODE'        '=ENTR',
        '1'  'SAPLMGMM'          '0080',
        ' '  'BDC_CURSOR'        'RMMG1-WERKS',
        ' '  'BDC_OKCODE'        '=ENTR',
         '1'  'SAPLMGMM'          '0080',
         ' '  'BDC_CURSOR'        'RMMG1-WERKS',
         ' '  'BDC_OKCODE'        '=04',
         '1'  'SAPMMG01'          '0700',
         ' '  'BDC_OKCODE'        '=12',
        ' '  'BDC_OKCODE'        '=04',
        ' '  'MSICHTAUSW-KZSEL(01)' c_x,
         '1'  'SAPLMGMM'           '4004',
         ' '  'BDC_OKCODE'         '=BU',
         ' '  'MAKT-MAKTX'         maktx,
         ' '  'MARA-MEINS'         meins,
         ' '  'MARA-MATKL'         matkl,
         ' '  'MARA-MTPOS_MARA'    'NORM'.
    Any help is appreciable.
    Thanks
    Arghadip

    The requirement is such that the User is going to enter the Material Type, Industry Sector,UOM and short text in Portal and I need to provide the MM01 screen to the user with the following data. Now when he is trying to select all the views to create in the Sales Org view and some other views another screen is appearing for Plant and Sales Org where it has a Value help which on clicking it gets stopped. The user wants the look and feel of MM01 through BDC including the Value help features and also those entry he has entered in Portal.
    Thanks
    Arghadip

  • 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

  • BDC for PO

    Can any one give me a piece of code which explains better about the table control handling of the line items in BDC for purchase order creation.

    Hi,
    Check
    http://web.mit.edu/sapr3/windocs/bpors03m.htm
    http://www.finance.utoronto.ca/Page641.aspx
    Regards

  • Material Creation Using BDCs.

    Hi all,
    I have developed a program for Material Creation using BDC.
    Material is Being created and that is working well and good.Here i have a Requirement to update the Newly creted material in Ztable.So when i use call transaction mathod,i have written code for updation under the line CALL TRANSACTION.where in iam getting newly creatde material from MARA table,and so it is working perfectly fine..
    But our requirement should be sessions method,so when i use sessions method and exeute the program..we face the problem of updation.
    the piece of code for updation is updating previously created material.
    Literally speaking only the sessions are created ,when the program is executed,material is not created when program is run.Material is only created when the sessions are processed using SM35,
    So how should i do here,where should be the updation code written and where will we get the newly created material in sessions method..
    Pls Help me in solving this problem

    hai priyanaka it might be due to configuration problem
    bcos manulay also ur gettign this , so just consult ur MM consultant for soem setting
    regards
    afzal

Maybe you are looking for

  • Tracking with iphone remote

    i have a new mac mini using with a 32" samsung tv. I am using my iphone as a wireless input device using Snatch & rowmote pro as the wireless input device. My problem is that the tracking on track pad is very 'jerky'. the kb is fine when typing. I ha

  • Error: This content cannot be displayed in a frame

    Hello Everyone, I have problem to view work shop > object browser page . when I click on any objects It shows "This content cannot be displayed in a frame" and close the session . Please help me on it.

  • Scanning Chinese Text with Snow Leopard

    Has anyone had a good experience with a Snow Leopard-compatible OCR program that they have used to scan Chinese (simplified) text? I have used ReadIris with previous Mac systems, and have found it to be a highly unstable program that crashed frequent

  • 50 Fixed CO-PA Profitability Analysis Elements

    We are in the blueprint stage of a new SAP implementation using the Life Sciences express solution.  Our consultants advised us that there are 50 SAP fixed characteristics in CO-PA for Profitablity Analysis and we have the ability to add up to 50 non

  • MIGO Output Error

    Hi All Iam getting the following error in the status of the message determination of GR Object 500001202720080001 Output type: GR Note Vers.1 Processing log for program /SMB40/M07DR routine ENTRY_WE01 Processing routine ENTRY_WE01 in program /SMB40/M