Create material with reference using BAPI

Hi
I need to create material using refrence to another material for all material Views. Can I use BAPI_MATERIAL_SAVEREPLICA.
Which parameter I need to fill for reference materia
Moderator message: please do your own research before asking.
Edited by: Thomas Zloch on Jan 12, 2011 3:18 PM

Hi Goutam,
You can use the BAPI BAPI_MATERIAL_SAVEDATA, which will create/update the material. You can pass the reference material in the filed BAPI_MARA-PL_REF_MAT. And you can pass reference material for all view like this.

Similar Messages

  • Creation with Reference using BAPIs

    We're looking into creating an order with reference to a quotation or a return order with reference to an order or invoice.
    According to OSS note 370988 you can only achieve this using a workaround. We're in the process of testing it, so we were wondering whether anybody else out there already has experience with it.
    Specifically:
    - are there any issues in the document flow (based on our testing so far no) ?
    - are there issues with regards to pricing ?
    - do the final documents look as if created using VA01 ?
    Are there other approaches ? E.g. how does the SAP web shop do it ?
    Thanks
    Adrian

    HI Adrian Zehnder,
    1) If you want create order with reference to quotation like ex quotation document type is ymea then create quotation using standard bapi 2) By using bapi get the details of the quotation and pass that data to BAPI_SALESORDER_CREATEFROMDAT2 fill the fields ref_doc, ref_doc_it, and ref_doc_ca  3) There i s no issue with pricing everything will copy.4) It will like created in va01.Post if you need more help in this.
    Regards,
    Madhu.

  • Problem with BOM Quant while creating Sales order with reference using BAPI

    Dear All,
    I am facing problem with creating a slaes order with reference to other sales order by using BAPI_SALESORDER_CREATEFROMDAT2 .
    Sales order is getting created but
    1. It exploding the BOM means the line items which are not there in the reference SO also coming in the new SO ( all BOM items are coming )
    2. Schedule line for BOM header item is getting copied to all sub items of BOM.
    Can any one help me out to prevent the above deviations in creating Sales order with reference by using BAPI_SALESORDER_CREATEFROMDAT2.
    Note: while passing the parameters to BAPI_SALESORDER_CREATEFROMDAT2
    all the data related to items is exactly the same as in the original Sales Order.
    Thanks in advnace.
    Regards,
    John

    Hi All,
    Can any one help me !!!!!!!!!!
    please

  • Create Material with reference

    Hi all. I have the next requeriment:
    On a Z program, a user creates a relation between 2 material in 2 different plants, when the material on the 2nd plant doesn't exist must be created as a copy of the original material. For example:
    Original MATNR --> MATERIAL01
    Original WERKS --> IN55
    Copy MATNR     --> MATERIAL02
    Copy WERKS     --> IN25
    In this case, the material MATERIAL02 doesn't exist in the IN25 Plant, so it must be created as a copy of the MATERIAL01.
    This could be done manually on MM01 trx and adding the MATERIAL01 value as the reference material, but this needs to be done automatically, and the easiest way to do it is using BAPI.
    Does anybody know a BAPI to do this??
    Thanx.
    Jesus

    You can use the BAPI_MATERIAL_SAVEDATA.  You will have to get all of the data for the reference material, then swap the material number,  then call the BAPI.
    Regards,
    Rich Heilman

  • Zprogram to create material master data using bapi

    can anyone send me a zprogram which uses a
    bapi to create\update material master data .
    thanks ,
    Amit

    hi,
    here below a code sample that will help you
    FORM execution .
      DATA: is_headdata TYPE bapimathead.
      DATA: is_clientdata TYPE bapi_mara.
      DATA: is_clientdatax TYPE bapi_marax.
      DATA: is_plantdata TYPE bapi_marc.
      DATA: is_plantdatax TYPE bapi_marcx.
      DATA: is_valuationdata  TYPE bapi_mbew.
      DATA: is_valuationdatax  TYPE bapi_mbewx.
      DATA: it_materialdescription TYPE bapi_makt OCCURS 0 WITH HEADER LINE.
      DATA : is_storagelocationdata TYPE bapi_mard,
             is_storagelocationdatax TYPE bapi_mardx.
    *... views
      is_headdata-material = mara-matnr.
      is_headdata-ind_sector = 'M'.
      is_headdata-matl_type = 'ROH'.
      is_headdata-basic_view = 'X'.
      is_headdata-purchase_view = 'X'.
      is_headdata-mrp_view = 'X'.
      is_headdata-account_view = 'X'.
      is_headdata-cost_view = 'X'.
      is_headdata-storage_view = 'X'.
    *... constants
      is_clientdata-pur_valkey = '3'.
      is_clientdatax-pur_valkey = 'X'.
    *... Données article générales (de l'écran)
      is_clientdata-base_uom = mara-meins.
      is_clientdata-matl_group = mara-matkl.
      is_clientdata-mfr_no = mara-mfrnr.
      is_clientdata-manu_mat = mara-mfrpn.
      is_clientdata-pur_status = mara-mstae.
      is_clientdata-old_mat_no = mara-bismt.
      is_clientdatax-base_uom = 'X'.
      is_clientdatax-matl_group = 'X'.
      is_clientdatax-mfr_no = 'X'.
      is_clientdatax-manu_mat = 'X'.
      is_clientdatax-pur_status = 'X'.
      is_clientdatax-old_mat_no = 'X'.
    *... Description
      it_materialdescription-langu = sy-langu.
      it_materialdescription-matl_desc = makt-maktx.
      APPEND it_materialdescription.
      is_plantdata-sm_key = '000'.
      is_plantdata-dep_req_id = '2'.
      is_plantdata-availcheck = '02'.
      is_plantdata-auto_p_ord = 'X'.
      is_plantdatax-sm_key = 'X'.
      is_plantdatax-dep_req_id = 'X'.
      is_plantdatax-availcheck = 'X'.
      is_plantdatax-auto_p_ord = 'X'.
      is_plantdata-pur_status = mara-mstae.
      is_plantdatax-pur_status = 'X'.
          is_plantdata-profit_ctr = '100012'.
      is_plantdata-proc_type = 'F'.
      is_plantdata-determ_grp = 'Z001'.
      is_plantdata-deploy_horiz = '000'.
      is_plantdatax-proc_type = 'X'.
      is_plantdatax-determ_grp = 'X'.
      is_plantdatax-deploy_horiz = 'X'.
    *... Plant data
      is_plantdata-plant = marc-werks.
      is_plantdata-pur_group = marc-ekgrp.
      is_plantdata-abc_id = marc-maabc.
      is_plantdata-mrp_type = marc-dismm.
      is_plantdata-plnd_delry = marc-plifz.
      is_plantdata-lotsizekey = marc-disls.
      is_plantdata-safety_stk = marc-eisbe.
      is_plantdata-mrp_ctrler = marc-dispo.
      is_plantdata-iss_st_loc = marc-lgpro.
      is_plantdata-sloc_exprc = marc-lgfsb.
      is_plantdata-round_prof = marc-rdprf.
      is_plantdatax-plant = marc-werks.
      is_plantdatax-pur_group = 'X'.
      is_plantdatax-abc_id = 'X'.
      is_plantdatax-mrp_type = 'X'.
      is_plantdatax-plnd_delry = 'X'.
      is_plantdatax-lotsizekey = 'X'.
      is_plantdatax-safety_stk = 'X'.
      is_plantdatax-mrp_ctrler = 'X'.
      is_plantdatax-iss_st_loc = 'X'.
      is_plantdatax-sloc_exprc = 'X'.
      is_plantdatax-round_prof = 'X'.
    *... Valuation
      is_valuationdata-val_area = marc-werks.
      is_valuationdatax-val_area = marc-werks.
      is_valuationdata-price_ctrl = 'V'.
      is_valuationdata-price_unit = '1'.
      is_valuationdata-val_class = '3000'.
      is_valuationdata-qty_struct = 'X'.
      is_valuationdata-orig_mat = 'X'.
      is_valuationdata-price_unit = mbew-peinh.
      is_plantdata-lot_size = mbew-peinh.
      is_valuationdatax-price_ctrl = 'X'.
      is_valuationdatax-price_unit = 'X'.
      is_valuationdatax-val_class = 'X'.
      is_valuationdatax-qty_struct = 'X'.
      is_valuationdatax-orig_mat = 'X'.
      is_valuationdatax-price_unit = 'X'.
      is_plantdatax-lot_size = 'X'.
    Storage
      IF NOT marc-lgpro IS INITIAL.
        is_storagelocationdata-plant = marc-werks.
        is_storagelocationdata-stge_loc = marc-lgpro.
        is_storagelocationdata-stge_bin = mard-lgpbe.
        is_storagelocationdatax-plant = is_storagelocationdata-plant.
        is_storagelocationdatax-stge_loc = is_storagelocationdata-stge_loc.
        is_storagelocationdatax-stge_bin = 'X'.
      ENDIF.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
      headdata                   = is_headdata
      clientdata                 = is_clientdata
      clientdatax                = is_clientdatax
      plantdata                  = is_plantdata
      plantdatax                 = is_plantdatax
      FORECASTPARAMETERS         =
      FORECASTPARAMETERSX        =
      PLANNINGDATA               =
      PLANNINGDATAX              =
       storagelocationdata        = is_storagelocationdata
       storagelocationdatax       = is_storagelocationdatax
      valuationdata              = is_valuationdata
      valuationdatax             = is_valuationdatax
      WAREHOUSENUMBERDATA        =
      WAREHOUSENUMBERDATAX       =
      SALESDATA                  =
      SALESDATAX                 =
      STORAGETYPEDATA            =
      STORAGETYPEDATAX           =
      FLAG_ONLINE                = ' '
      FLAG_CAD_CALL              = ' '
      IMPORTING
      return                     = return
    TABLES
         materialdescription        = it_materialdescription
      UNITSOFMEASURE             =
      UNITSOFMEASUREX            =
      INTERNATIONALARTNOS        =
      MATERIALLONGTEXT           =
      TAXCLASSIFICATIONS         =
         returnmessages             = it_returnmessages
      PRTDATA                    =
      PRTDATAX                   =
      EXTENSIONIN                =
      EXTENSIONINX               =
    endform.
    Regards.
    David

  • Create sales order with reference via BAPI

    Hi all,
    I would like to know if is it possible to create a sales order with reference using BAPI, that is, I want to create an order from a contract, for example, referencing one or more contract itens. If so, what variable or table should I use?
    I think that the most suitable function is
    'BAPI_SALESORDER_CREATEFROMDAT2' or should I use another to do this?
    I am using release SAP ECC 6.0.
    Thanks for any help.
    Paulo

    yes, you are using right BAPI i.e. BAPI_SALESORDER_CREATEFROMDAT2
    You will have to provide ORDER_HEADER_IN in that, Others are optional, even then if you have data for them, Provide it for better performance.
    For any confusion related to chosing BAPI :  You may go to BAPI  transaction and find out the correct BAPI according to ur need. for example sales order relatd BAPI's are
    BAPI_SALESORDER_CHANGE :Change Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2: Create Sales Order
    BAPI_SALESDOCU_CREATEWITHDIA: Create Data Container with Dialog
    BAPI_SALESORDER_GETLIST:List of all Orders for Customer
    and so on.
    Reward if helpful..

  • Bapi to create Invoice with reference to SalesOrder

    Hi All,
    I want to create Invoice with reference to SalesOrder ,
    can anybody help me regarding
    --> what is the Bapi to Create Invoice with reference to SalesOrder
    --> what are the import parameters
    Thanks in Advance
    Regards
    Srinivas

    Hi Giuseppi,
    Thanks to your reply,
    i have used BAPI_BILLINGDOC_CREATEMULTIPLE , i have given the following input values in the BILLINGDATAIN
      -- salesorg,distrchan,division,doc-type,sold-to,plant,material,doc-number,item-number , when  i execute the Bapi , i got the DocNo:0090021983 , but i did not find that DocNo. by executing the Bapi BAPI_BILLINGDOC_GETLIST.
    i found the short description for
    BAPI_BILLINGDOC_CREATEMULTIPLE -- is for Individual Customer Billing Document, is it the correct Bapi to create invoice
    what is the correct Bapi to create invoice based on the salesorder.
    RV_INVOICE_CREATE OR GN_INVOICE_CREATE OR BAPI_BILLINGDOC_CREATEMULTIPLE.
    Can u specify the import parameters for that Bapi.
    Thanks & Regards
    Srinivas

  • Problem when creating a sales order with reference by BAPI

    I am facing one problem when creating Sales Order.
    <b>The scenario is like this while creating SO With reference to an Order type, a new SO will be automatically created with a diff order Type</b>.
    I am using "BAPI_SALESORDER_CREATEFROMDAT2".
    I am calling this BAPI in USEREXIT_REFRESH_DOCUMENT.
    Am I using the right exit to call this Bapi ?
    <b>Problems are like :
    1. Ref Sales Order creating without Sales Unit .
    2. "Object Status does not exist" error msg is coming for Header and Item level(when clicking the status tab and then object status pushbutton).</b> But if testing the bapi from SE37 in test sequence....no such problem persists.
    As for example in case of sales unit,in the debugging mode i have seen that BAPI uses a perform to fill the values in the VBAP structure.But after that when it come back to the main program VBAP remains blank.This ocuurs when the BAPI is called from the exit whereas  if tested from SE37, VBAP retains the value.
    Can u suggest in this ? This is very very urgent............
    Thx in Adv.........................

    Thanks........
    Your suggestion was a great help to me.I have used a custom FM and called it in <b>starting new task</b>.
    Since i am a university fresher working in SAP for nearly 1 year.....can you please explain me the difference between <b>in update task</b> and <b>starting new task</b>.Why the problem was occuring for which you have suggested to call a custom function module.
    what is V1 update and V2 update?Is it attached with asynchronous ans synchronous update.It would be a great help to me if you kindly clear my confusions....
    thanks in advance.

  • How to create PO with reference to Pr through BAPI

    Hi everybody
    I wanted to create PO with reference to PR through BAPI_PO_CREATE (4.6c), but i found there is no field to set PR info in the parameter. Is the bapi right for this case, or there are other functions?
    THANKS FOR ANY ADVICE!
    Best regards,
    Egg

    Hi abappers!
    I'm using bapi BAPI_PO_CREATE1 to create PO with reference to one or more PR. I have a problem with document date:
    If the delivery date of the PR is lower than creation date of PR, the document date of the PO is the delivery date (lower than sy-datum).
    If the delivery date of the PR is the same or higher than creation date of PR, the document date of the PO is the creation date of PR (sy-datum or high).
    I'm trying to change this date in poheader-doc_date, but the system ignores me. I'm sure this is the correct variable, because I use it to create other PO's without reference.
    Another thing confuses me is that if I create the PO with reference to the same PR from ME21N, the system doesn't allow me to indicate a document date lower than sy-datum.
    Thanks in advance,
    Jorge

  • Create a configurable material with reference to another config material

    Hi,
    I want to create a configurable material with reference to another configurable material from different system.
    Please tell me what data i need to check to see if that material has been created (copied manually) successfully.
    Thanks.

    Hi,
    In case of configurable material most important thing is configuration so please check weather the configuration is copied perfectly with all characteristics or not. Similarly check the valuation class and price control is proper or not.
    Regards,
    Umesh

  • Creating a PO with reference (using document overview) with ref to a PO?

    Is this feasible to create a PO with reference to a PO ?????

    Hi Maria,
    Creating a PO with reference to another PO is possible even without the doc. overview. If you scroll your item overview long to the right you will find the columns "Purchasing document" and "Item" aside it (4th nd 3rd columns from the right in my version). Type in your referenced PO number there and the item and press Enter.
    However, I don't think this will help you. If you are not allowed to create PO with reference to another PO, you will not be able to "cheat" on the system. Such limitation is normally introduced by "Functional auth. for buyers": IMG for Purchasing > Authorization Management > Define Function Authorizations for Buyers. Check the frame "Possible Reference Objects". The two-digit key of the "func. auth." is assigned to your user using the parameter ID EFB.
    BR
    Raf

  • Creation of new material with reference to other material

    Hi All,
    I have requirement where i have to create new selling unit material with reference to the given material.
    Now, can any buddy suggest which FM or BADI i have to use to read BOM and ROUTING  info of reference material and same to create BOM and ROUTING for new material.
    Doing this with BDC after reading data directally from tables is one option, But i am looking for any BADI or Fm which will serve the purpose.
    Thanks in Advance,
    Rahul

    Hi,
    ... but if you prefer FM, then you can use BAPI_MATERIAL_MAINTAINDATA_RT or BAPI_MATERIAL_SAVEDATA, depending if you are using Retail or not. BDC is usually not possible for all views - which you would need for complete creation.
    Regards,
    Christian

  • Create a Puchase order using Bapi

    Hi all,
    I have requirent to create  a PO by using Bapi based on text file sent from
    interface system here with the file layout.
    1.plant (ekko-werks)                
    2. material   EKPO-MATNR     
    3. pur.group       EKKO-EKGRP
    4.vendor      EKKO-LIFNR
    5.shiping ins     EKPO-EVERS
    6.quantity  EKPO-MENGE
    please  some one help me step setp coding using by bapi.
    i know using BDC but no idea how to use BAPI.

    Hello,
    U can make use of the
    BAPI_PO_CREATE1                Create purchase order
    BAPI_PO_CREATE                 Create purchase order
    BAPI_PO_GETDETAIL              Display Purchase Order Details
    BAPI_PO_GETITEMS               List Purchase Order Items
    BAPI_PO_GETITEMSREL            List Purchase Orders for Release (Approval): New as of 4.0A
    BAPI_PO_GETRELINFO             Display Detailed Release (Approval) Information on Purchase Order
    BAPI_PO_GET_LIST               List Purchase Orders - Only up to 4.0A
    Regards,
    Vasanth

  • SO IDOC inbound create SO with reference to INV or SO #

    Hi all,
    I have a situation where I will get the inbound SO IDOC, through IDOC_INPUT_ORDERS and create a sales order with reference to a invoice number or another sales order (eg: consignment pick up and consignment fill up).
    Except modifying the standard formed BDC in the FM, by adding additional screen code into the BDC, is there any other way to do so?
    (eg: assign value into certain field in IDOC? Using another IDOC FM?)
    Please advice.
    Thanks.
    Best Regards,
    JL

    Hi ,
    At a high level, the IDOC processing executes in the following manner:
    1.     Interpret IDOC header segments and captures organizational, customer master and purchase
                    order header details. Performs user exits for each segment to process customizations to data
                    processing.
    2.     Interprets item level segments and captures item level details like material information. Again, it
                   performs user exits for each segment.
    3.     Sums up the order data and determines the posting criterion viz. creating order with reference
                  etc.
    4.     Builds up batch data communication sequence (BDC) with respect to the required screen
                    sequence of posting a sales order.
    5.     While building up the BDC data, system performs user exit to process customizations to BDC
                      data.
    6.     Calls transactions VA01 using the BDC data.
    7.     If the processing fails, an appropriate workitem is generated for workflow processing.
    User Exit - ZXVEDU03
    This user exit will be performed after each segment read in the IDOC processing function module. Exit is called during the perform interpret_idoc_orders in the idoc processing function module. The exit is executed before the BDC data building process and it is here where the invoice  number would be retrieved into a variable from segment E1EDK02.
    IF SEGMENT-SEGNAM = 'E1EDK02'.
        IF SEGMENT-SDATA(3) = 'Z43'.
           Save the  you Number XXXXXXXXXX into a temporary variable.
        Endif.
    Endif.
    User Exit - ZXVEDU04
    In the function module IDOC_INPUT_ORDERS, form call_va01_new_orders is performed wherein BDC data is built up for every screen required to post a sales order. User Exit ZXVEDU04 is performed at various stages during the built up of BDC data. It is here in this user exit that a coding needs to be performed to insert BDC data for assigning sales order to the invoice
    The BDC data for assign to invoice  should be added soon after the BDC data for purchase order type is generated. The following BDC data logic should be coded in the user exit to facilitate assign to invoice
    if you give me brief i can help you out more.
    if helpful REWARD points
    Thank you .
    Regards
    Ramana

  • Create SO with reference

    Recently I get a requirement to create new sale order reference from old sale order.
    VA01 have a button to do this work,but abap develop have no FM to get the same effect.
    Is there have the only way by bdc to resovle,  3q!

    you can use the Bapi BAPI_SALESORDER_CREATEFROMDAT2 for creating SO with reference. Pass ref_doc in header data.
    Regards,
    sivaganesh

Maybe you are looking for

  • How to Add new fields to Shopping cart?.

    Hi SRM GURU'S, I am using SRM 5.5 and ECC 6.0 and Extended Classic scenario. As per business, I want to add New fields to Shopping cart. How can I add?. Please any one give me clear details about this I am planning to add 2 fields 1. Commitment Item

  • Can we create scroll bar Table in ADE?

    Hi All, Can we create scroll bar Table in ADE. Please refer the enclosed attachment Table.JPG. We used the following CSS property, which is displaying the scroll bar table in HTML but not in ADE. #table_data {width:400px; overflow:auto; } Please Sugg

  • Editing DVD video

    I have a client who is providing to me DVDs of various videos he has had produced, and wishes me to include them in a website. Since I got Premiere Pro as part of my CS4 package, I thought, no problem - I can just import the DVD video and edit out th

  • System Refresh for  ECC & PI in Oracle MCOD database

    Hi All, We are running our ECC system on linux and oracle. Our ECC Development system and PI Develeopment system is running on one box and on the same database (MCOD).  The same is with the ECC production and PI production running on the same system

  • Norton Vault disappeared after update to 2014 with Firefox 27.0

    I just checked my Add-ons Manager to discover that NIS 2014 and Firefox v27.0 are not compatible so Norton has been disable. I'm not sure who's responsible for making it compatible but the issue needs to be addressed quickly. I use Firefox as my defa