Material creation with BAPI

Hi gurús,
               I am using BAPI_MATERIAL_SAVEDATA to create material. But the ejecution show the following message:
046Field WERKS has been transferred inconsistently or is blank.
I really cant find where i have to charge it. I think im do it in all the fields where WERKS is necesary.
Regards
Enzo

Hi Enzo I ussualy use BAPI_MATERIAL_MAINTAINDATA_RT to create materials, if not resolve the problem, you can try with this.
Regards

Similar Messages

  • Service PO creation with BAPI

    Hi All,
    I have to create a file upload program to create service PO's with BAPI_PO_CREATE1. Please if anyone can give me a example of it it would be great.
    Thanks.
    Malinda

    Hi ,
           Check out this program .
    use this program for creating service po's using bapi.
    *& Report ZMM_PO_CREATE1 *
    REPORT ZMM_PO_CREATE1 .
    data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
    POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
    POITEM like BAPIMEPOITEM occurs 0 with header line,
    POITEMX like BAPIMEPOITEMX occurs 0 with header line,
    POESLLC like BAPIESLLC occurs 0 with header line,
    POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
    POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
    POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
    POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
    POCOND like BAPIMEPOCOND occurs 0 with header line,
    RETURN like BAPIRET2 occurs 0 with header line.
    data : po_no(10).
    data : begin of it_head occurs 0,
    ref(10),
    bsart like ekko-bsart,
    lifnr like ekko-lifnr,
    ekorg like ekko-ekorg,
    ekgrp like ekko-ekgrp,
    bukrs like ekko-bukrs,
    verkf like ekko-verkf,
    telf1 like ekko-telf1,
    ihrez like ekko-ihrez,
    unsez like ekko-unsez,
    kdatb(10),
    kdate(10),
    end of it_head.
    data : begin of it_det occurs 0,
    ref(10),
    knttp like ekpo-knttp,
    pstyp like ekpo-pstyp,
    txz01 like ekpo-txz01,
    matkl like ekpo-matkl,
    werks like ekpo-werks,
    afnam like ekpo-afnam,
    ktext1 like esll-ktext1,
    srvpos like esll-srvpos,
    frmval1 like esll-frmval1,
    frmval2 like esll-frmval2,
    menge like esll-menge,
    kostl like eskn-kostl,
    sakto like eskn-sakto,
    zzcode like eskn-zzcode,
    kbetr like konv-kbetr,
    end of it_det.
    data : c_col1 TYPE i VALUE '0001',
    c_col2 TYPE i VALUE '0002',
    c_col3 TYPE i VALUE '0003',
    c_col4 TYPE i VALUE '0004',
    c_col5 TYPE i VALUE '0005',
    c_col6 TYPE i VALUE '0006',
    c_col7 TYPE i VALUE '0007',
    c_col8 TYPE i VALUE '0008',
    c_col9 TYPE i VALUE '0009',
    c_col10 TYPE i VALUE '0010',
    c_col11 TYPE i VALUE '0011',
    c_col12 TYPE i VALUE '0012',
    c_col13 TYPE i VALUE '0013',
    c_col14 TYPE i VALUE '0014',
    c_col15 TYPE i VALUE '0015',
    c_col16 TYPE i VALUE '0016'.
    data : v_currentrow type i,
    v_currentrow1 type i.
    data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
    itab_det like ALSMEX_TABLINE occurs 0 with header line.
    data : file_head type RLGRAP-FILENAME,
    file_item type RLGRAP-FILENAME.
    file_head = 'C:Documents and SettingsDesktophead.xls'.
    file_item = 'C:Documents and SettingsDesktopitem.xls'.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = file_head
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 12
    i_end_row = 50
    tables
    intern = itab_head
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 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.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = file_item
    i_begin_col = 1
    i_begin_row = 1
    i_end_col = 16
    i_end_row = 50
    tables
    intern = itab_det
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF itab_head[] IS INITIAL.
    WRITE:/ 'No Header Data Exists '.
    STOP.
    ELSE.
    sort itab_head by row col.
    read table itab_head index 1.
    v_currentrow = itab_head-row.
    loop at itab_head.
    if itab_head-row ne v_currentrow.
    APPEND it_head.
    v_currentrow = itab_head-row.
    ENDIF.
    CASE itab_head-col.
    WHEN c_col1.
    it_head-ref = itab_head-value.
    WHEN c_col2.
    it_head-bsart = itab_head-value.
    WHEN c_col3.
    it_head-lifnr = itab_head-value.
    WHEN c_col4.
    it_head-ekorg = itab_head-value.
    WHEN c_col5.
    it_head-ekgrp = itab_head-value.
    WHEN c_col6.
    it_head-bukrs = itab_head-value.
    WHEN c_col7.
    it_head-verkf = itab_head-value.
    WHEN c_col8.
    it_head-telf1 = itab_head-value.
    WHEN c_col9.
    it_head-ihrez = itab_head-value.
    WHEN c_col10.
    it_head-unsez = itab_head-value.
    WHEN c_col11.
    it_head-kdatb = itab_head-value.
    WHEN c_col12.
    it_head-kdate = itab_head-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_head.
    CLEAR it_head.
    ENDIF.
    IF itab_det[] IS INITIAL.
    WRITE:/ 'No Item Data Exists '.
    STOP.
    ELSE.
    sort itab_det by row col.
    read table itab_det index 1.
    v_currentrow1 = itab_det-row.
    loop at itab_det.
    if itab_det-row ne v_currentrow1.
    APPEND it_det.
    v_currentrow1 = itab_det-row.
    ENDIF.
    CASE itab_det-col.
    WHEN c_col1.
    it_det-ref = itab_det-value.
    WHEN c_col2.
    it_det-knttp = itab_det-value.
    WHEN c_col3.
    it_det-pstyp = itab_det-value.
    WHEN c_col4.
    it_det-txz01 = itab_det-value.
    WHEN c_col5.
    it_det-matkl = itab_det-value.
    WHEN c_col6.
    it_det-werks = itab_det-value.
    WHEN c_col7.
    it_det-afnam = itab_det-value.
    WHEN c_col8.
    it_det-srvpos = itab_det-value.
    WHEN c_col9.
    it_det-ktext1 = itab_det-value.
    WHEN c_col10.
    it_det-frmval1 = itab_det-value.
    WHEN c_col11.
    it_det-frmval2 = itab_det-value.
    WHEN c_col12.
    it_det-menge = itab_det-value.
    WHEN c_col13.
    it_det-kostl = itab_det-value.
    WHEN c_col14.
    it_det-sakto = itab_det-value.
    WHEN c_col15.
    it_det-zzcode = itab_det-value.
    WHEN c_col16.
    it_det-kbetr = itab_det-value.
    ENDCASE.
    ENDLOOP.
    APPEND it_det.
    CLEAR it_det.
    ENDIF.
    loop at it_head.
    poheader-doc_type = it_head-bsart.
    poheader-vendor = it_head-lifnr.
    poheader-purch_org = it_head-ekorg.
    poheader-pur_group = it_head-ekgrp.
    poheader-comp_code = it_head-bukrs.
    poheader-sales_pers = it_head-verkf.
    poheader-telephone = it_head-telf1.
    poheader-REF_1 = it_head-ihrez.
    poheader-OUR_REF = it_head-unsez.
    poheader-VPER_START = it_head-kdatb.
    poheader-VPER_END = it_head-kdate.
    loop at it_det where ref = it_head-ref.
    poitem-acctasscat = it_det-knttp.
    poitem-item_cat = it_det-pstyp.
    poitem-short_text = it_det-txz01.
    poitem-matl_group = it_det-matkl.
    poitem-plant = it_det-werks.
    poitem-PREQ_NAME = it_det-afnam.
    POESLLC-SERVICE = it_det-srvpos.
    POESLLC-SHORT_TEXT = it_det-ktext1.
    POESLLC-FORM_VAL1 = it_det-frmval1.
    POESLLC-FORM_VAL2 = it_det-frmval2.
    POESLLC-QUANTITY = it_det-menge.
    POACCOUNT-COSTCENTER = it_det-kostl.
    POACCOUNT-GL_ACCOUNT = it_det-sakto.
    POCONDHEADER-COND_TYPE = 'R000'.
    POCONDHEADER-COND_VALUE = it_det-kbetr.
    endloop.
    endloop.
    poheaderx-doc_type = 'X'.
    poheaderx-vendor = 'X'.
    poheaderx-purch_org = 'X'.
    poheaderx-pur_group = 'X'.
    poheaderx-comp_code = 'X'.
    poheaderx-sales_pers = 'X'.
    poheaderx-telephone = 'X'.
    poheaderx-REF_1 = 'X'.
    poheaderx-OUR_REF = 'X'.
    poheaderx-VPER_START = 'X'.
    poheaderx-VPER_END = 'X'.
    poitemx-acctasscat = 'X'.
    poitemx-item_cat = 'X'.
    poitemx-short_text = 'X'.
    poitemx-matl_group = 'X'.
    poitemx-plant = 'X'.
    poitemx-PREQ_NAME = 'X'.
    *POESLLCx-SHORT_TEXT = 'X'.
    POACCOUNTx-COSTCENTER = 'X'.
    POACCOUNTx-GL_ACCOUNT = 'X'.
    POCONDHEADER-cond_type = 'X'.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = poheader
    POHEADERX = poheaderx
    POADDRVENDOR =
    TESTRUN =
    MEMORY_UNCOMPLETE =
    MEMORY_COMPLETE =
    POEXPIMPHEADER =
    POEXPIMPHEADERX =
    VERSIONS =
    NO_MESSAGING =
    NO_MESSAGE_REQ =
    NO_AUTHORITY =
    NO_PRICE_FROM_PO =
    IMPORTING
    EXPPURCHASEORDER = po_no
    EXPHEADER =
    EXPPOEXPIMPHEADER =
    TABLES
    RETURN = return
    POITEM = poitem
    POITEMX = poitemx
    POADDRDELIVERY =
    POSCHEDULE =
    POSCHEDULEX =
    POACCOUNT = poaccount
    POACCOUNTPROFITSEGMENT =
    POACCOUNTX = poaccountx
    POCONDHEADER = pocondheader
    POCONDHEADERX = pocondheaderx
    POCOND =
    POCONDX =
    POLIMITS =
    POCONTRACTLIMITS =
    POSERVICES = poesllc
    POSRVACCESSVALUES =
    POSERVICESTEXT =
    EXTENSIONIN =
    EXTENSIONOUT =
    POEXPIMPITEM =
    POEXPIMPITEMX =
    POTEXTHEADER =
    POTEXTITEM =
    ALLVERSIONS =
    POPARTNER =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT =
    IMPORTING
    RETURN =
    if sy-subrc = 0.
    loop at return.
    write return-MESSAGE_V1.
    write po_no.
    endloop.
    endif.
    Also check this link
    [Service Order through BAPI|Service PO creation with BAPI;

  • Issue in Material creation from BAPI

    Hi All,
    I am working on Mass material upload from the program using BAPI function module: BAPI_MATERIAL_SAVEDATA.
    But the problem is for Material Type 'Finished Product' I could get all the views from the structure BAPIMATHEAD except for views Oil-specific data and Plant Stock.
    So is there any other FM or Structure which includes there 2 views also as its field?
    Thanks.

    Hi,
    Check the bellow links for Material Master Bapi.
    Create Material Master Data with BAPI
    And Check the bellow BAPI for your requirement.
    BAPI_MATERIAL_GET_DETAIL
    or
    BAPI_MATERIAL_GETDETAIL
    Regards,
    Goutam Kolluru.

  • Material  Creation with Classification Data

    Hi friends,
    I am technical guy,
    I need to know how to create material(MM01)  with classification data,
    if i want fetch data , where i will find that data ( means which tables).
    Thanks in Advance,
    regards,
    Bhaksar

    HI Bhaskar,
    I will explain you a scenario, where you will be able to understand the relation.
    Consider i am manufacturing a two wheeler, which has the material number but with various colours say Red and Blue.
    In this case during my SD process, in the sales order, i need to mention the material number also with the colour as Red in the batch field in order to make the process more specific.
    In order to cater this need, i need to activate batch managment for that material in the purchasing view and also opening the classification view in the Material master with the batch class as 001 _ Material Class.
    Now my work will not get completed without maintaining a batch master for the same. Ie i have to ensure a batchmaster for the material using tcode MSC1N, with batch as colour, Material code, Plant and storage location also if split valuation is activated, we need to mention the valuation type too.
    Hope i had thrown some lights over the topic enquired.
    Regards,
    RitiG

  • Sales order creation with bapi in webdynpro using table control

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items. Pls give me some idea to resolve this issue, here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' method CREATE_SALES_ORDER .
    Declaration for Order Header Node DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

    DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

  • Sales order creation with bapi in webdynpro

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of  data sale order is getting created in  va01 for multiple line items.
    Pls give me some idea to resolve this issue,
    here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
    method CREATE_SALES_ORDER .
    Declaration for Order Header Node
    DATA: node_order_header TYPE REF TO if_wd_context_node,
           elem_order_header TYPE REF TO if_wd_context_element,
           stru_order_header TYPE if_componentcontroller=>element_order_header .
    Declaration for Order Items Node
    DATA: node_order_items TYPE REF TO if_wd_context_node,
           elem_order_items TYPE REF TO if_wd_context_element,
           stru_order_items TYPE if_componentcontroller=>element_order_items .
    Declaration for Order Partners Node
    DATA: node_order_partners TYPE REF TO if_wd_context_node,
    elem_order_partners TYPE REF TO if_wd_context_element,
    stru_order_partners TYPE if_componentcontroller=>element_order_partners .
    node_order_header = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_header
    elem_order_header = node_order_header->get_element( ).
    elem_order_header->get_static_attributes(
    IMPORTING static_attributes = stru_order_header
    <ORDER_ITEMS> via lead selection
    node_order_items = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_items ).
    elem_order_items = node_order_items->get_element( ).
    elem_order_items->get_static_attributes(
    IMPORTING static_attributes = stru_order_items ).
    <ORDER_PARTNERS> via lead selection
    node_order_partners = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_partners ).
    elem_order_partners = node_order_partners->get_element( ).
    elem_order_partners->get_static_attributes(
    IMPORTING static_attributes = stru_order_partners ).
    DATA: v_sales_doc TYPE bapivbeln-vbeln.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_header_in TYPE table of bapisdhd1,"
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
          i_order_items_in TYPE TABLE OF bapisditm,
          w_order_items_in TYPE bapisditm,
          i_order_conditions_in TYPE TABLE OF bapicond,
          w_order_conditions_in TYPE bapicond,
          w_order_SCHDL type  BAPISCHDL,
          i_order_SCHDL type table of BAPISCHDL.
    Order Header Details
    CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
    refresh : i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, i_order_SCHDL.
    w_order_header_in-doc_type = stru_order_header-doc_type.
    w_order_header_in-sales_org = stru_order_header-sales_org.
    w_order_header_in-distr_chan = stru_order_header-distr_chan.
    w_order_header_in-division = stru_order_header-division.
    w_order_header_in-req_date_h = stru_order_header-req_date_h.
    w_order_header_in-sales_dist = stru_order_header-sales_dist.
    w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
    Order Item Details
      CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-itm_num = stru_order_items-itm_num.
    w_order_items_in-ITM_NUMBER =  stru_order_items-ITM_NUMBER.
    w_order_items_in-material = stru_order_items-material.
    w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
    w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
    w_order_items_in-plant = stru_order_items-plant.
    w_order_items_in-target_val = stru_order_items-target_val.
    w_order_items_in-currency = stru_order_items-currency.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input = w_order_items_in-material
       IMPORTING output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    Order Partner Details
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = stru_order_partners-partn_role.
    w_order_partners-partn_numb = stru_order_partners-partn_numb.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING input = w_order_partners-partn_numb
       IMPORTING output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    Order Condition Details
    w_order_SCHDL-ITM_NUMBER  = stru_order_items-itm_number." '000010'.
             w_order_SCHDL-req_qty     = stru_order_items-target_qty." '5'.
              APPEND w_order_SCHDL to i_order_SCHDL.
    Create Sales Order BAPI Call
    *loop at i_order_header_in into  w_order_header_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
       order_header_in = w_order_header_in
       IMPORTING
         salesdocument = v_sales_doc
         TABLES
           return = i_return
           order_items_in = i_order_items_in
           order_partners = i_order_partners
            order_schedules_in  = i_order_SCHDL
           order_conditions_in = i_order_conditions_in.
    Get message manager
      DATA: l_current_controller TYPE REF TO if_wd_controller,
            l_message_manager    TYPE REF TO if_wd_message_manager.
      l_current_controller ?= wd_this->wd_get_api( ).
      CALL METHOD l_current_controller->get_message_manager
        RECEIVING
          message_manager = l_message_manager.
      DATA: v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT v_sales_doc IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
          wait = 'X'.
        CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
        INTO v_message_text SEPARATED BY space.
    Report Success message
        CALL METHOD l_message_manager->report_success
        EXPORTING message_text = v_message_text.
        ELSE.
          v_message_text = 'Error Creating Sales Order'.
    Report Error message
          CALL METHOD l_message_manager->report_error_message
          EXPORTING message_text = v_message_text.
          ENDIF.
    *endloop.
    endmethod.
    and code for table control i am using is
    method WDDOINIT .
      Types : Begin of item_tab,
            itm_number  type bapisditm-itm_number,
            material type bapisditm-material,
            plant type bapisditm-plant ,
            target_qty type bapisditm-target_qty,
            target_qu type bapisditm-target_qu,
            target_val type bapisditm-target_val,
        currency type bapisditm-currency,
            end of item_tab.
    *Creating internal table and Work Area of the same structure
    *as that of the Node created.
    Data : it_item type standard table of item_tab,
            wa_item type item_tab.
    *Appending Blank Work Area to Internal table.
    ***********************************************888
    *LOOP AT it_item INTO wa_item.
    **wa_item-itm_number to  bapisditm-itm_number.
    **wa_item-material to bapisditm-material.
    **wa_item-plant to bapisditm-plant.
    **wa_item-target_qty to bapisditm-target_qty.
    **wa_item-target_qu to bapisditm-target_qu.
    **wa_item-target_val to bapisditm-target_val.
    **wa_item-currency to bapisditm-currency.
       APPEND wa_item TO it_item.
    *ENDLOOP.
    **********************************************88
    Do 10 times.
    Append wa_item to it_item.
    enddo.
    "Binding the table
    DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
    DATA lt_material TYPE wd_this->Elements_material.
    navigate from <CONTEXT> to <MATERIAL> via lead selection
      lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
    @TODO handle non existant child
    IF lo_nd_material IS INITIAL.
    ENDIF.
    @TODO compute values
    e.g. call a model function
      lo_nd_order_items->bind_table( new_items =
      it_item set_initial_elements = abap_true ).
    endmethod.

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of  data sale order is getting created in  va01 for multiple line items.
    Pls give me some idea to resolve this issue,
    here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2'
    method CREATE_SALES_ORDER .
    Declaration for Order Header Node
    DATA: node_order_header TYPE REF TO if_wd_context_node,
           elem_order_header TYPE REF TO if_wd_context_element,
           stru_order_header TYPE if_componentcontroller=>element_order_header .
    Declaration for Order Items Node
    DATA: node_order_items TYPE REF TO if_wd_context_node,
           elem_order_items TYPE REF TO if_wd_context_element,
           stru_order_items TYPE if_componentcontroller=>element_order_items .
    Declaration for Order Partners Node
    DATA: node_order_partners TYPE REF TO if_wd_context_node,
    elem_order_partners TYPE REF TO if_wd_context_element,
    stru_order_partners TYPE if_componentcontroller=>element_order_partners .
    node_order_header = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_header
    elem_order_header = node_order_header->get_element( ).
    elem_order_header->get_static_attributes(
    IMPORTING static_attributes = stru_order_header
    <ORDER_ITEMS> via lead selection
    node_order_items = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_items ).
    elem_order_items = node_order_items->get_element( ).
    elem_order_items->get_static_attributes(
    IMPORTING static_attributes = stru_order_items ).
    <ORDER_PARTNERS> via lead selection
    node_order_partners = wd_context->get_child_node(
    name = if_componentcontroller=>wdctx_order_partners ).
    elem_order_partners = node_order_partners->get_element( ).
    elem_order_partners->get_static_attributes(
    IMPORTING static_attributes = stru_order_partners ).
    DATA: v_sales_doc TYPE bapivbeln-vbeln.
    DATA: w_order_header_in TYPE bapisdhd1,
          i_order_header_in TYPE table of bapisdhd1,"
          i_order_partners TYPE TABLE OF bapiparnr,
          w_order_partners TYPE bapiparnr,
          i_return TYPE TABLE OF bapiret2,
          w_return TYPE bapiret2,
          i_order_items_in TYPE TABLE OF bapisditm,
          w_order_items_in TYPE bapisditm,
          i_order_conditions_in TYPE TABLE OF bapicond,
          w_order_conditions_in TYPE bapicond,
          w_order_SCHDL type  BAPISCHDL,
          i_order_SCHDL type table of BAPISCHDL.
    Order Header Details
    CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, w_order_SCHDL, i_order_SCHDL.
    refresh : i_order_partners, i_return, i_order_items_in,
              i_order_conditions_in, i_order_SCHDL.
    w_order_header_in-doc_type = stru_order_header-doc_type.
    w_order_header_in-sales_org = stru_order_header-sales_org.
    w_order_header_in-distr_chan = stru_order_header-distr_chan.
    w_order_header_in-division = stru_order_header-division.
    w_order_header_in-req_date_h = stru_order_header-req_date_h.
    w_order_header_in-sales_dist = stru_order_header-sales_dist.
    w_order_header_in-purch_no_c = stru_order_header-purch_no_c.
    Order Item Details
      CLEAR: i_order_items_in,w_order_items_in.
    w_order_items_in-itm_num = stru_order_items-itm_num.
    w_order_items_in-ITM_NUMBER =  stru_order_items-ITM_NUMBER.
    w_order_items_in-material = stru_order_items-material.
    w_order_items_in-target_qty = stru_order_items-target_qty."'5'.
    w_order_items_in-target_qu = stru_order_items-target_qu."'5'.
    w_order_items_in-plant = stru_order_items-plant.
    w_order_items_in-target_val = stru_order_items-target_val.
    w_order_items_in-currency = stru_order_items-currency.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
       input = w_order_items_in-material
       IMPORTING output = w_order_items_in-material.
    APPEND w_order_items_in TO i_order_items_in.
    Order Partner Details
    CLEAR: i_order_partners,w_order_partners.
    w_order_partners-partn_role = stru_order_partners-partn_role.
    w_order_partners-partn_numb = stru_order_partners-partn_numb.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING input = w_order_partners-partn_numb
       IMPORTING output = w_order_partners-partn_numb.
    APPEND w_order_partners TO i_order_partners.
    Order Condition Details
    w_order_SCHDL-ITM_NUMBER  = stru_order_items-itm_number." '000010'.
             w_order_SCHDL-req_qty     = stru_order_items-target_qty." '5'.
              APPEND w_order_SCHDL to i_order_SCHDL.
    Create Sales Order BAPI Call
    *loop at i_order_header_in into  w_order_header_in.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTING
       order_header_in = w_order_header_in
       IMPORTING
         salesdocument = v_sales_doc
         TABLES
           return = i_return
           order_items_in = i_order_items_in
           order_partners = i_order_partners
            order_schedules_in  = i_order_SCHDL
           order_conditions_in = i_order_conditions_in.
    Get message manager
      DATA: l_current_controller TYPE REF TO if_wd_controller,
            l_message_manager    TYPE REF TO if_wd_message_manager.
      l_current_controller ?= wd_this->wd_get_api( ).
      CALL METHOD l_current_controller->get_message_manager
        RECEIVING
          message_manager = l_message_manager.
      DATA: v_message_text TYPE string.
    When Sales Order is created commit the data
    IF NOT v_sales_doc IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
          wait = 'X'.
        CONCATENATE 'Sales Document' v_sales_doc 'has been created.'
        INTO v_message_text SEPARATED BY space.
    Report Success message
        CALL METHOD l_message_manager->report_success
        EXPORTING message_text = v_message_text.
        ELSE.
          v_message_text = 'Error Creating Sales Order'.
    Report Error message
          CALL METHOD l_message_manager->report_error_message
          EXPORTING message_text = v_message_text.
          ENDIF.
    *endloop.
    endmethod.
    and code for table control i am using is
    method WDDOINIT .
      Types : Begin of item_tab,
            itm_number  type bapisditm-itm_number,
            material type bapisditm-material,
            plant type bapisditm-plant ,
            target_qty type bapisditm-target_qty,
            target_qu type bapisditm-target_qu,
            target_val type bapisditm-target_val,
        currency type bapisditm-currency,
            end of item_tab.
    *Creating internal table and Work Area of the same structure
    *as that of the Node created.
    Data : it_item type standard table of item_tab,
            wa_item type item_tab.
    *Appending Blank Work Area to Internal table.
    ***********************************************888
    *LOOP AT it_item INTO wa_item.
    **wa_item-itm_number to  bapisditm-itm_number.
    **wa_item-material to bapisditm-material.
    **wa_item-plant to bapisditm-plant.
    **wa_item-target_qty to bapisditm-target_qty.
    **wa_item-target_qu to bapisditm-target_qu.
    **wa_item-target_val to bapisditm-target_val.
    **wa_item-currency to bapisditm-currency.
       APPEND wa_item TO it_item.
    *ENDLOOP.
    **********************************************88
    Do 10 times.
    Append wa_item to it_item.
    enddo.
    "Binding the table
    DATA lo_nd_order_items TYPE REF TO if_wd_context_node.
    DATA lt_material TYPE wd_this->Elements_material.
    navigate from <CONTEXT> to <MATERIAL> via lead selection
      lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ).
    @TODO handle non existant child
    IF lo_nd_material IS INITIAL.
    ENDIF.
    @TODO compute values
    e.g. call a model function
      lo_nd_order_items->bind_table( new_items =
      it_item set_initial_elements = abap_true ).
    endmethod.

  • New material creation with workflow approval

    the scenario is when the new material master(mm01) is being created, the request will sent to manager for approval. so the manager can either approve or reject it. if it were rejected, is it possiable to resubmit this material master for approve after the amendement? any information on this config will be appreciated!

    You can put your approval in a loop and loop till it is approved. In rejection branch put a dialog step for creator of material and give to person who is responsible to changeing and call MM02 or something from that step and yes also give an option here where creator of approver can choose to abondone the material totaly which will bring it out of loop and completes teh workflow, which will other wise complete only on approval.
    Warm Regards,
    Anuj Nagpal.

  • Material Master Creation Using BAPI

    Hi,
    I m using BAPI_MATERIAL_SAVEDATA for Material creation using BAPI.
    Now the problem is , i have created a Screen exit long back in Purchasing view.. the corresponding Z field is created in table MARC..
    How can i pass value to this Z field using BAPI.
    i tried with BAPI_MARC.. my Z field is not coming in that structure.
    Can anyone guide me how can this be achieved.
    Thanks in Advance
    Aravindh Mani

    Hi,
    The Function Module BAPI_MATERIAL_SAVEDATA has the options to pass the Z fields. There exits a structure parameters
    EXTENSIONIN
    EXTENSIONINX
    in BPAI. In EXTENSIONIN pass the data and value part you can pass  in EXTENSIONINX. So this will update the Z fileds in material
    master .

  • Error in pipeline material creation

    hi,
    we want to create one pipeline material as per our new requirement for showing gas consumption.during material creation with mat type PIPE, it's showing an error:The field Profit Center is defined as a required field; it does not contain
    an entry.
    Procedure
        If the field is the material group or unit of weight, and the field is not ready for input, check whether the material is locked. If it is locked, you cannot extend the Purchasing view or the Sales view. If either of these views needs to be extended, the material must first be unlocked. This can be done only by a user with special authorization.
    thanx,
    sheetal

    Hi
    In your client if Profit center accounting(PCA) is activated ,then you need to maintain the Profit center for the material.
    Option 1: goto OMS2, got details of pipleine material & select the Costing View of the material.
    Now goto MM01 in creation of pipeline material & maintain the profit center in Cotsing 1 View.
    Deactivating the field from mandatory to optional will not serve your purpose as PCA will get affected.
    Thanks & Regards
    Kishore

  • How to create SynBO with  BAPIs from R/3 server?

    Hi,
    Can I get any documents or links regarding Syncbo creation with BAPIs from another R/3 server. I think I have to create RFC destination for this. The steps for creating RFC destination in Netweaver 2004s is also helpful for me.
    Also I need the required configurations also.
    Regards
    Shemim

    Hi Shemin,
    Refer the following link for Mobile Development Kit
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/21eba3a7-0601-0010-b982-92f1fca3258a
    This will provide you with rules of creating BAPI wrappers and sample BAPI wrappers.
    For creating RFC destination, contact your BASIS team member. You may not rights to do it by yourself. They will also tell the exact prodecure. It start with transaction SM59.
    Regards,
    Rahul

  • BAPI for Outbound Delivery Creation with reference to Sales Order - VL01N

    Hi Everybody,
           We are in ECC 5.0 version.
           I want to create a enhancement for Outbound Delivery Creation with reference to a Sales Order.
           Is any BAPI available for this ?
           Any input on this will be very much helpfull.
           Please suggest any BAPI available for this, or should I go for BDC using VL01N or VL04 ?
           Thanks in advance.
    regards,
    Nagarajan.J

    Hi Nagarajan,
    The BAPI BAPI_DELIVERYPROCESSING_EXEC meets your requirement. You can create delivery with reference to sales order.
    The below is the sample code...
      data:lt_request      like bapideliciousrequest
                                    occurs 0 with header line,
           lt_createditems like bapideliciouscreateditems
                                    occurs 0 with header line,
           lt_return       like bapiret2
                                    occurs 0 with header line.
        lt_request-document_type      = 'A'.
        lt_request-document_numb      = vbeln.
        lt_request-document_item      = posnr.
      lt_request-material           = matnr.
      lt_request-plant              = werks.
      lt_request-stge_loc           = lgort.
      lt_request-quantity_base__uom = base_uom_qty.
      lt_request-delivery_date      = sy-datum.
      append lt_request.
      call function 'BAPI_DELIVERYPROCESSING_EXEC'
      EXPORTING
        DELIVERY_EXTEND       =
        TECHN_CONTROL         =
        tables
          request               = lt_request
          createditems          = lt_createditems
          return                = lt_return.
      loop at lt_return where type = 'A'
                          or  type = 'E'.
        exit.
      endloop.
      if sy-subrc <> 0.
    Use the BAPI for Commit
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'H'.
      endif.
    Thanks
    Ramakrishna

  • Creation of Material Documents With Mvt Type

    On Performing Post Goods Issue (PGI) in one Plant in case of Plant to Plant Dispatches, there should be Inbound delivery created for already created Purchase Order (PO). In addition after creation of inbound delivery, there should be material document created with 103 movement. This Material document is triggered when the inbound delivery is saved. Once Warehouse processes are finished, then Post Goods Receipt (PGR) happens, so 101 Movement Type happens for Purchase Order. PGR document should trigger one more material document with 104 movements; this document is reversal for material document with 103 movement type.
    can any one suggest to enhance SAP for this?
    Moderator message : Requirements dumping is not allowed, show the work you have already done. Thread locked.
    Edited by: Vinod Kumar on Oct 21, 2011 5:18 PM

    Hi Nitin,
    Before creating the Service type of product, you have to define the Base category for Service type product. Generally the category for service will be created under the R3 hierarchy R3PRODSTYPE. You can create this category using the TCode:
    COMM_HIERARCHY. Here you have to select the product type as Service and have to assign the set types to the category.
    You can create a service product using the transaction : COMMPR01 -> Click on Service ICON -> Select the Category for Service Type. Then fill in the details for Service Product description, Service ID(Based on number range settings for products), Language.
    Also fill other details like Base Unit of measure, Pricing condition for different sales areas for the service product.
    Since you are using CRM7.0, you can do all these activities using a POWER USER role.
    For more information about Set types and hierarchies please refer the following help link:
    http://help.sap.com/saphelp_crm70/helpdata/EN/46/57672501a208e7e10000000a114a6b/frameset.htm
    Hope this helps!
    Regards,
    Chethan

  • What are the parameters have to pass to bapi material creation?

    can any one help me in creating material by using bapi.....
    which is 'BAPI_MATERIAL_SAVEDATA'.....by using the above bapi wen i am creating material....how to pass data to that bapi....what are the thing s i ahve to pass.........

    hi
    please chk this code
    TYPES : BEGIN OF S_BAPI,
            MATNR LIKE MARA-MATNR,
            MBRSH LIKE MARA-MBRSH,
            MTART LIKE MARA-MTART,
            MAKTX LIKE MAKT-MAKTX,
            MEINS LIKE MARA-MEINS,
            MATKL LIKE MARA-MATKL,
            END OF S_BAPI.
    DATA : I_BAPI TYPE STANDARD TABLE OF S_BAPI WITH HEADER LINE.
    PARAMETER : P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\Documents and Settings\mansi_makhijani\Desktop\upload.txt'.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                      = P_FILE
       FILETYPE                      = 'DAT'
      HEADLEN                       = ' '
      LINE_EXIT                     = ' '
      TRUNCLEN                      = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      DAT_D_FORMAT                  = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = I_BAPI
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      FILE_OPEN_ERROR               = 2
      FILE_READ_ERROR               = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA : S_HEADDATA TYPE BAPIMATHEAD,
           S_CLIENTDATA TYPE BAPI_MARA,
           S_CLIENTDATAX TYPE BAPI_MARAX,
           I_MAKT TYPE STANDARD TABLE OF BAPI_MAKT WITH HEADER LINE.
    LOOP AT I_BAPI.
      S_HEADDATA-MATERIAL = I_BAPI-MATNR.
      S_HEADDATA-IND_SECTOR = I_BAPI-MBRSH.
      S_HEADDATA-MATL_TYPE = I_BAPI-MTART.
      S_CLIENTDATA-MATL_GROUP = I_BAPI-MATKL.
      S_CLIENTDATA-BASE_UOM = I_BAPI-MEINS.
      S_CLIENTDATAX-MATL_GROUP ='X'.
      S_CLIENTDATAX-BASE_UOM ='X'.
      I_MAKT-MATL_DESC = I_BAPI-MAKTX.
      I_MAKT-LANGU_ISO ='EN'.
      I_MAKT-LANGU ='EN'.
      I_MAKT-DEL_FLAG =' '.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          HEADDATA                  = S_HEADDATA
       CLIENTDATA                  = S_CLIENTDATA
       CLIENTDATAX                 = S_CLIENTDATAX
      PLANTDATA                   =
      PLANTDATAX                  =
      FORECASTPARAMETERS          =
      FORECASTPARAMETERSX         =
      PLANNINGDATA                =
      PLANNINGDATAX               =
      STORAGELOCATIONDATA         =
      STORAGELOCATIONDATAX        =
      VALUATIONDATA               =
      VALUATIONDATAX              =
      WAREHOUSENUMBERDATA         =
      WAREHOUSENUMBERDATAX        =
      SALESDATA                   =
      SALESDATAX                  =
      STORAGETYPEDATA             =
      STORAGETYPEDATAX            =
      FLAG_ONLINE                 = ' '
      FLAG_CAD_CALL               = ' '
      NO_DEQUEUE                  = ' '
    IMPORTING
      RETURN                      =
    TABLES
       MATERIALDESCRIPTION         = I_MAKT
      UNITSOFMEASURE              =
      UNITSOFMEASUREX             =
      INTERNATIONALARTNOS         =
      MATERIALLONGTEXT            =
      TAXCLASSIFICATIONS          =
      RETURNMESSAGES              =
      PRTDATA                     =
      PRTDATAX                    =
      EXTENSIONIN                 =
      EXTENSIONINX                =
      NFMCHARGEWEIGHTS            =
      NFMCHARGEWEIGHTSX           =
      NFMSTRUCTURALWEIGHTS        =
    NFMSTRUCTURALWEIGHTSX       =
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT          =
    IMPORTING
    RETURN        =
    ENDLOOP.
    ~hitesh
    If your queries are solved try to close the thread

  • BAPI for Outbound Delivery Creation with reference to Sales Order

    Dear all,
    I'm on R/3 4.6B platform and to develop an RFC for outbound Delivery creation instead of using the standard VL01N transaction.
    I've review BAPI for Outbound Delivery Creation with reference to Sales Order - VL01N thread which suggest BAPI_DELIVERYPROCESSING_EXEC .
    However, in 4.6B, that function module doesn't exist. Appreciate any suggestion and or workaround.
    Thanks.
    Steven
    Edited by: Steven Khoo on Mar 25, 2010 7:13 AM
    Edited by: Steven Khoo on Mar 25, 2010 7:14 AM

    Not required anymore

  • Avoid substitute material.., while creating sales order with BAPI?

    Hi experts.
    I use BAPI_SALESDOCU_CREATEFROMDATA1 function module to create a sales order.
    Material A has a substitute material B with substitute reason 0005.
    So if I use material A when creating sales order with above BAPI function, the order is created with material B.
    I don't want to substitute the material automatically. I want to create the sales order with material A.
    What should I do? Help me please.
    Thanks in Advance.

    Hi bvrn Reddy,
    I know, your message is almost two years old, but, did you find a solution? I'm facing the same problem. The material A has B as substitute, but in va01 a popup appears (its customizing inside the substitution reason, strategy = A). Of course, we have no popup inside the bapi, but there must be a way to decide which material the bapi should use. At the moment I only get the substitute, never the old mat (even there is something in stock).
    Maybe you've got a helpful hint for me, thanks!
    Ben

Maybe you are looking for

  • Weblogic Managed Server not starting from the ./startManagedWebLogic.sh

    We have installed weblogic 9.2 in unix environment, and created one admin server and a managed server My admin server is in running state, while starting the managed server, the folllowing message is showing <Jun 18, 2010 1:30:45 PM BST> <Info> <Mess

  • N95 sync using windows media player

    Hi - when I sync my N95 (with an 8GB disc) with windows media player it no longer copies over the album art to my device, even though I can see it on my PC. This is largely for allbums where I have ripped the CD and  downloaded the media info file fr

  • Broadcasting  - No suitable variables in email subject

    We need to include exit variables in email subject in broadcasting.        We created exit variables which are automtically calculated by the user    exit for broadcasting purposes. These variables are time variables that    indicates for example de

  • Unable to share (any format) of iMovie 10.0.7

    Share worked 2 weeks ago with similar project. Tried reinstall of iMovie, creating new library, clearing desktop as recommended in older posts regarding previous iMovie share problems. Did not solve problem. Cannot share (any option) new or old proje

  • ActionTec M1424-WR Rev F Router USB port

    Does anybody know if Verizon ever plans to support the USB port to connect prionters, hard drives, etc? The Verizon Installer hooked up my printer to this port, then called me from his truck after leaving my house to tell me that it wouldn't work!