To create a Material using BAPI with out passing the material number

Hello Experts,
I am using BAPI_MATERIAL_SAVEDATA to create a material of some Ztype. I am successfully creating a material if I am passing Material Number as input. I want the material number to generated internally.
When I am doing material creation with same input data with out material number using BDC, it is working fine. It is generating the material number.
But, not with the BAPI.
Do, I need to specify this some where in the BAPI to generate the Material number internally? Please let me know.
Please help me in this regard.
Thanks & Regards,
Naresh.

Hi,
Read the BAPI documentation regarding Internal Number range for materials.
When you create material master data, the following fields must always
contain a value in the structure:
o   MATERIAL
    Only external number assignment is supported for the material number
    (MATERIAL). If you want the material number to be assigned
    internally, the method BAPI_MATERIAL_GETINTNUMBER must first be
    called. This method determines an internal number for the material
    to be created. You must enter this internal number in field
    HEADDATA-MATERIAL.
Regards
Vinod

Similar Messages

  • Can you create an app using Adobe DPS, then pass the Folio to a programmer to add interactivity?

    I'd like to know if I can create an app using Adobe DPS, then pass the folio to a programmer to add advanced interactivity that DPS doesn't provide. I would like the programmer to use either XCode or Android SDK because it is a standard, but they can also use C#, JavaScript, and several other coding languages. The folio would serve the purpose of a tight digital comp for the programmer.

    Thanks for your help Bob! I found this article on the Adobe site. Figured I'd share it. http://helpx.adobe.com/digital-publishing-suite/help/import-html-articles.html

  • How to Create Sales Order using BAPI with Variant configurations

    Hi All,
    I need to create a sales order using BAPI BAPI_SALESORDER_CREATEFROMDAT2 with Varaint confiugartions. I will get Header ITEM and variant configuration items in the flat file. Kindly help me in this regard.
    One more thing, is there any way to findout all the Varaint classifications for a particular Material?
    I have done the below coding. Sales order is getting created but variant configurations are not populating.
    *...Configuration: Reference Data
    DATA: gt_order_cfgs_ref TYPE TABLE OF bapicucfg,
          wa_order_cfgs_ref TYPE bapicucfg.
    *...Configuration: Instances
    DATA: gt_order_cfgs_inst TYPE TABLE OF bapicuins,
          wa_order_cfgs_inst TYPE bapicuins.
    *...Configuration: Part-of Specifications
    DATA: gt_order_cfgs_part_of TYPE TABLE OF bapicuprt,
          wa_order_cfgs_part_of TYPE bapicuprt     .
    *...Configuration: Characteristic Values
    DATA: gt_order_cfgs_value TYPE TABLE OF bapicuval,
          wa_order_cfgs_value TYPE bapicuval.
    *...Configuration: BLOB Internal Data (SCE)
    DATA: gt_order_cfgs_blob TYPE TABLE OF bapicublb  ,
          wa_order_cfgs_blob TYPE bapicublb.
    *...Configuration: Variant Condition Key
    DATA: gt_order_cfgs_vk TYPE TABLE OF bapicuvk,
          wa_order_cfgs_vk TYPE bapicuvk.
    *...Configuration: Reference Item / Instance
    DATA: gt_order_cfgs_refinst TYPE TABLE OF bapicuref,
          wa_order_cfgs_refinst TYPE bapicuref.
    *...Configuration: Reference Data
      wa_order_cfgs_ref-posex = '10'.
      wa_order_cfgs_ref-config_id = '1'.
      wa_order_cfgs_ref-root_id = '1'.
      wa_order_cfgs_ref-SCE = '1'.
      wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.
      wa_order_cfgs_ref-CONSISTENT = 'T'.
      wa_order_cfgs_ref-COMPLETE = 'T'.
      APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.
    *..2nd item
      wa_order_cfgs_ref-posex = '20'.
      wa_order_cfgs_ref-config_id = '2'.
      wa_order_cfgs_ref-root_id = '1'.
      wa_order_cfgs_ref-SCE = '1'.
      wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.
      wa_order_cfgs_ref-CONSISTENT = 'T'.
      wa_order_cfgs_ref-COMPLETE = 'T'.
      APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.
    *...Configuration: Instances
      wa_order_cfgs_inst-config_id = '1'.
      wa_order_cfgs_inst-inst_id = '1'.
      wa_order_cfgs_inst-obj_type = 'MARA'.
      wa_order_cfgs_inst-class_type = '300'.
      wa_order_cfgs_inst-obj_key = '2021B'.
      wa_order_cfgs_inst-quantity = 1.
      wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.
      wa_order_cfgs_inst-CONSISTENT = 'T'.
      wa_order_cfgs_inst-COMPLETE = 'T'.
      APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.
    *..2nd item
      wa_order_cfgs_inst-config_id = '2'.
      wa_order_cfgs_inst-inst_id = '1'.
      wa_order_cfgs_inst-obj_type = 'MARA'.
      wa_order_cfgs_inst-class_type = '300'.
      wa_order_cfgs_inst-obj_key = '2021B'.
      wa_order_cfgs_inst-quantity = 1.
      wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.
      wa_order_cfgs_inst-CONSISTENT = 'T'.
      wa_order_cfgs_inst-COMPLETE = 'T'.
      APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.
    *...Configuration: Characteristic Values
      wa_order_cfgs_value-config_id = '1'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BASIC_MACHINE'.
      wa_order_cfgs_value-value = 'L28'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
      wa_order_cfgs_value-config_id = '1'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET'.
      wa_order_cfgs_value-value = 'PL1001'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    *..2nd item
      wa_order_cfgs_value-config_id = '2'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET_FOC'.
      wa_order_cfgs_value-value = '023OP0049'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
      wa_order_cfgs_value-config_id = '2'.
      wa_order_cfgs_value-inst_id = '1'.
      wa_order_cfgs_value-charc = 'BUCKET_HOE'.
      wa_order_cfgs_value-value = '028MS0004'.
      wa_order_cfgs_value-VALCODE = '1'.
      APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    wa_order_cfgs_value-config_id = '2'.
    wa_order_cfgs_value-inst_id = '1'.
    wa_order_cfgs_value-charc = 'TYRE_PRESSURE_GAUGE'.
    wa_order_cfgs_value-value = '81004402'.
    APPEND wa_order_cfgs_value TO gt_order_cfgs_value.
    *...Configuration: Reference Item / Instance
      wa_order_cfgs_refinst-posex = '10'.
      wa_order_cfgs_refinst-config_id = '1'.
      wa_order_cfgs_refinst-inst_id = '1'.
      APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.
    *..2nd item
      wa_order_cfgs_refinst-posex = '20'.
      wa_order_cfgs_refinst-config_id = '2'.
      wa_order_cfgs_refinst-inst_id = '1'.
      APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.
    Regards,
    Rajesh

    Hi all,
    Please help me in solving the issue.
    Rajesh

  • Create an order using BAPI with reference to another one.

    Hi everybody,
    I'm trying to create a new sales order with reference to another one (That's important because of the documents flow).
    I'm using 'BAPI_SALESORDER_CREATEFROMDAT2' but I couldn´t do it yet. I've read some ideas about this kind of creation in this forum; but I still haven´t found the solution yet.
    Some ideas about the BAPI parameters I nedd to complete?
    Thanks in advance!!
    Edited by: Ole ES on Sep 11, 2008 12:32 PM

    Hi,
    Are you sure you can create a sales order with reference to ANOTHER sales order? The reason I ask is that in the front end, sales orders are created with reference to either quotations or contracts. There are settings known as "copying control" that need to be maintained for this to show up as document flow.
    We have been working on a BAPI to create a sales order, but that is without reference to another document, and it works fine.
    Could you please elaborate?
    Cheers.

  • PS Project description when creating sales order using BAPI

    I am trying to create sales orders using BAPI_SALESORDER_CREATE_FROMDAT2.
    Because of the material configuration in table TCN61 the material will trigger a project creation in the project system.
    Now, in order to create a project, we must provide the project description.
    I would like to ask you if anyone knows how to pass the project description in one of the BAPI parameters.
    Thank you for your help.

    Thank you Sreedhar for the answer.
    I tried the CAMPAIGN field but did not work...
    In fact, I am not able to find a field, in any of the of the tables, that could hold the project description (PROJ-POST1).
    An entry is created in PROJ table when we manually create a sales order for materials specified in table TCN61.
    Thanks.

  • How to generate reportdesign dynamically using java with out xml file

    hi
    how can i generate a reportdesign dynamically using java with out passing xml file to jasperDesign , i want to create my reportdesign with out xml file
    how can i ,please help
    thanks

    LiveCycle does provide a Java API to forms; LiveCycle is in fact a suite of programs, mostly enterprise level for running on server (next to which the cost of the master suite is a drop in the ocean). LiveCycle Designer is perhaps the only end user tool, and it is not for server use and doesn't have an API.
    Are you looking for a server solution? If so, nothing in the master suite can help, it isn't for server use.

  • Creating Material Using BAPI

    Hi Friends,
    I want to create a material using BAPI, can anyone give me some sample program or can any one give me links which earlier posted this problem.
    Points for sure for sample program.
    thanks and regards
    Vijaya

    hi
    good
    go through this REPORT z_bapi_salesorder_create.
    Parameters
    Sales document type
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Sales organization
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Distribution channel
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Division.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
    PARAMETERS: p_spart TYPE spart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Sold-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
    PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Ship-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
    PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Material
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
    PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Quantity.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
    PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Plant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    Initialization.
    INITIALIZATION.
    v_text   = 'Order type'.
    v_text1  = 'Sales Org'.
    v_text2  = 'Distribution channel'.
    v_text3  = 'Division'.
    v_text4  = 'Sold-to'.
    v_text5  = 'Ship-to'.
    v_text6  = 'Material'.
    v_text7  = 'Quantity'.
    v_text9  = 'Plant'.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = p_menge.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
           EXPORTING
                sales_header_in     = header
                sales_header_inx    = headerx
           IMPORTING
                salesdocument_ex    = v_vbeln
           TABLES
                return              = return
                sales_items_in      = item
                sales_items_inx     = itemx
                sales_schedules_in  = lt_schedules_in
                sales_schedules_inx = lt_schedules_inx
                sales_partners      = partner.
    Check the return table.
      LOOP AT return WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error in creating document'.
      ELSE.
    Commit the work.
        COMMIT WORK AND WAIT.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.
    thanks
    mrutyun^

  • Problem in Sales order create using BAPI with reference to quotation

    Hi,
    I am creating a sales order from Quotation using BAPI /AFS/BAPI_SALESORD_CREATEFDATA.
    The Sale order is getting created and the document flow is updated. When i check the status of quotation it is "OPEN".
    Ideally when a sale order is created in VA01 with reference to a quotation and if all items are added in the order from quotation, then the status of the quotation must be "Complete".
    When i use the BAPI, the status of the quotation is sill "Open". Has anyone faced this issue?
    Even if anyone has faced this issue with BAPI_SALESORDER_CREATEFROMDAT2, please let me know...
    Regards

    Hi RV,
    I am using BAPI  to create order reference to contracts. I am facing same issue. Its not updating document flow (vbfa-plmin field). After creating orders I am forcing to update plmin field in vbfa. This worked fine. But now status in reference document not updating properly. I saw your thread. It looks like similar issue. I saw your comments "Customization was not maintained properly for the Order types ". Please can you explain little bit more about your solution. It will helps us lot.
    Thanks,
    srini

  • Using Planned order Change BAPI with out changing date

    Hi
    I have a planned order with start date in future.
    With in a program, I want to call the planned order using the FM BAPI_PLANNEDORDER_CHANGE to re-explode the order BOM.
    I find that only if I change the order start date to system/current date, the planned order BOM gets updated/re-exploded. Else there is no change in the order BOM.
    My requirement is to re-explode the BOM with out changing the order dates. In the function module I am maintaining "X' against BOM_EXP_FIX_IND.
    But when I do it manually using MD12 and explode BOM with out changing the future start date, the order BOM gets updated.
    Please help on this. Or is there any other FM/BAPI for this purpose.

    Dear Pradeep,
    you could try to set DET_SCHEDULE = X with out
    FIRMING_IND  --> No
    BOM_EXP_FIX_IND   --> No
    Let me Know if it modification setting have solved your problem and i have useful for you,
    Daniele

  • Accessing BAPI's using JAVA with out using webdynpro URGENT

    hi Experts,
    What is the procedure for calling RFC/BAPI's using JAVA with out using the webdynpro. Please let me know what are the possibilities with step by step implementation.
    Regards
    Vijay

    Hi Boris Rubarth,
    Thaks for relavant information.
    I have kind of the requirement. The clinet is asking for connecting the SAP RFC using java application. The build Jar or .war or .Ear for which are going to develop should be compatible for running on any of the Applications server like they have Tom cat, weblogic, websphere server.
    so the .jar for or .ear file which we are going to develop should be able to run accessing the RFC/ BAPIs from any of these servers other than SAP WAS that is what their target.
    Please give me your suggestion, which is better approach. currently their SAP system is 4.6c . So presently it is not possible the webservice approach. But they have plans to go for upgrade to ECC6.0
    In that case only JCO option is possible. If use this option . Is it possible to access application which is deployed irrespective of the WAS by doing the required configuration.
    Basically i am aware of the ABAP webservice work bech steps and also the JAVA coding also.
    Please suggest me what is the better way to achieve this.
    Regards

  • Create material using bapi ' bapi_material_savedata'

    Hi Experts,
    i was tring to create material using bapi ' bapi_material_savedata' but the material is not updating in the table.
    please find the code and suggest me if any modification
    data: la_headdata type BAPIMATHEAD,
    la_clientdata type BAPI_MARA,
    la_CLIENTDATAX type BAPI_MARAX,
    la_return type BAPIRET2.
    data: i_materialdescription type table of BAPI_MAKT,
    wa_materialdescription like line of i_materialdescription.
    *la_headdata-MATERIAL = int_matnum-MATERIAL.
    *LOOP AT int_matnum.
    la_headdata-MATERIAL = int_matnum-MATERIAL.
    write : int_matnum-material.
    *ENDLOOP.
    la_headdata-MATERIAL = '100000518'."int_matnum-MATERIAL.
    la_headdata-IND_SECTOR = p_indsr.
    la_headdata-MATL_TYPE = p_matype.
    la_clientdata-BASE_UOM = 'FT3'.
    la_clientdata-pur_valkey = ' '.
    la_CLIENTDATAX-BASE_UOM = 'X'.
    la_clientdata-MATL_GROUP = '01'.
    la_CLIENTDATAX-MATL_GROUP = 'X'.
    wa_materialdescription = 'TEST'.
    append wa_materialdescription to i_materialdescription.
    clear: wa_materialdescription.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = la_headdata
    CLIENTDATA = la_clientdata
    CLIENTDATAX = la_CLIENTDATAX
    PLANTDATA =
    PLANTDATAX =
    FORECASTPARAMETERS =
    FORECASTPARAMETERSX =
    PLANNINGDATA =
    PLANNINGDATAX =
    STORAGELOCATIONDATA =
    STORAGELOCATIONDATAX =
    VALUATIONDATA =
    VALUATIONDATAX =
    WAREHOUSENUMBERDATA =
    WAREHOUSENUMBERDATAX =
    SALESDATA =
    SALESDATAX =
    STORAGETYPEDATA =
    STORAGETYPEDATAX =
    FLAG_ONLINE = ' '
    FLAG_CAD_CALL = ' '
    IMPORTING
    RETURN = la_return
    TABLES
    MATERIALDESCRIPTION = i_materialdescription
    UNITSOFMEASURE =
    UNITSOFMEASUREX =
    INTERNATIONALARTNOS =
    MATERIALLONGTEXT =
    TAXCLASSIFICATIONS =
    RETURNMESSAGES =
    PRTDATA =
    PRTDATAX =
    EXTENSIONIN =
    EXTENSIONINX =
    Please Help me
    Regards,
    Naresh

    Hi all,
    Now it is asking me for the other fields,
    E ,
    The field MARA-XCHPF/BAPI_MARA-BATCH_MGMT is defined as a required field; it does not contain an entry
    i have passed this val as
    la_clientdata-batch_mgmt = 'X'.
    even though i am getting the same error.
    can you help me to solve the issue.
    Tthanks
    Naresh
    Edited by: naresh.k.dasari on Jan 4, 2011 10:36 AM

  • Material Movement using BAPI with serial number.

    Hello,
    I am currently doing material movement using BAPI with serial number management, however in some case it works fine and in some cases it given and error message E213(IO). Unable to find the reason, when simulated the same it works fine for 200 serial numbers and gives error when going above 200 serial number.  The confusion is some times it works fine for 3000 serial number as well.
    Tried finding the reasion on every possible site. No results.
    Thanks in advance for some solution.

    Hello,
    I am currently doing material movement using BAPI with serial number management, however in some case it works fine and in some cases it given and error message E213(IO). Unable to find the reason, when simulated the same it works fine for 200 serial numbers and gives error when going above 200 serial number.  The confusion is some times it works fine for 3000 serial number as well.
    Tried finding the reasion on every possible site. No results.
    Thanks in advance for some solution.

  • Problem while creating sales order using BAPI

    Hi all,
    i am creating a sales order from the purchase order data.
    when my client will send a PO in EDI format, my 3rd party edi tool will convert that edi formatted PO to text format. then i will upload that text formatted PO to my program then i will create a SO from those uploaded PO data using BAPI BAPI_SALESORDER_CREATEFROMDAT2.
      but,no sales order is being created.& also i am not getting any return message.by debugging also, i am not getting the error.plz suggest where i am doing mistake.below is the coding.
    DATA:
      gfilename LIKE rlgrap-filename.
    *--Internal tables
    DATA: BEGIN OF i_item OCCURS 50.    "Create Material Document Item
            INCLUDE STRUCTURE BAPISDITM .
    DATA: END OF i_item .
    DATA: BEGIN OF i_partner OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPIPARNR.
    DATA: END OF i_partner.
    DATA: BEGIN OF i_schedule OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPISCHDL .
    DATA: END OF i_schedule.
    DATA: BEGIN OF i_cond OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE BAPICOND .
    DATA: END OF i_cond.
    DATA: BEGIN OF i_part OCCURS 0,     " Internal table for split data
            part(20),
          END OF i_part.
    DATA: BEGIN OF i_return OCCURS 20.  "Return parameter
            INCLUDE STRUCTURE bapiret2.
    DATA: END OF i_return.
    *-- Work areas
    DATA: BEGIN OF wa_header .       "sales Document Header Data
            INCLUDE STRUCTURE BAPISDHD1.
    DATA: END OF wa_header .
    *DATA: BEGIN OF wa_return .       "Output Structure
           INCLUDE STRUCTURE BAPIRET2.
    *DATA: END OF wa_return .
    DATA: begin of sorder.
         INCLUDE STRUCTURE BAPIVBELN.
    DATA: end of sorder.
    data:begin of t_upload,
         ebeln(10),  "PO no(seagate)
         aedat like sy-datum , "PO date
         bsart(4) , "PO type
         vdatu like sy-datum , "requested delivery date
         kunnr(10) , "customer no-sold-to-party
        kunak like vbak-kunnr, "bill-to-party
         name1_s(20), "name1 of sold-to-party
         name2_s(15), "name2 of sold-to-party
         land1_s(3), "country
         ort01_s(10),  "city
         regio_s(3), "region(state/province)
         pstlz_s(10), "postal code
         adrnr_s(10), "address
         bstkd_e(10), "end customer purchase order
         posex(6),     "end customer PO line no(item no)
         kdmat(18),     "end customer material no(part no)
         kunag(10),     "ship-to-party
         name1_c(20),   "name1 of ship-to-party
         name2_c(15),   "name2 of ship-to-party
         land1_c(3),   "country
         ort01_c(10),    "city
         regio_c(3),   "region(state/province)
         pstlz_c(10),   "postal code
         adrnr_c(10),   "address
         posnr(6), "item no(seagate PO line no)
         pstyv(4), "item category
         matnr(18), "material no(seagate 9 digit part no)
         zmeng(13), "Target quantity in sales unit
        vrkme like vbap-vrkme, "sales unit
         meins(3), "UOM
        posnr_tot like vbap-posnr,"Total no. of line items
         werks(4), "plant
        vstel like vbap-vstel, "shipping point
         empst(10), "receiving point
         shtyp(4), "shipment type
         route(6), "route
         vsbed(2), "shipping conds
        rkfkf like vbap-rkfkf, "method of billing for co/ppc orders
         zterm(4), "terms of payment key
         inco1(3), "F.O.B inco term1
         inco2(3), "F.O.B inco term2
         end of t_upload.
    Data: wa_upload like t_upload,
           i_upload like standard table of t_upload.
    Data:v_kunnr like kna1-kunnr,
          v_posnr like vbap-posnr,
          v_matnr like vbap-matnr,
          v_zmeng like vbap-zmeng,
          v_kunag like kna1-kunnr.
    *---Constants
    CONSTANTS: c_comma TYPE c VALUE ',',   " For splitting data at commas
               c_01(2) TYPE c VALUE '01',  " For movement code in Bapi
               c_b     TYPE c VALUE 'B',   " For mvt. Indicator in Bapi
               c_creat(5) TYPE c VALUE 'CREAT', " For button text
               c_clear(5) TYPE c VALUE 'CLEAR', " For clear button
               c_mvmt(4) TYPE c VALUE 'MVMT',
               c_ok(2)   TYPE c VALUE 'OK',
               c_error(5) TYPE c VALUE 'Error'.
    *--SELECTION SCREEN DESIGN--
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS:     
                p_auart LIKE vbak-auart, " order type
                p_vkorg LIKE vbak-vkorg, " sales org
                p_vtweg LIKE vbak-vtweg, " dist channel
                p_spart LIKE vbak-spart, " division
                p_vkgrp LIKE vbak-vkgrp, " sales group
                p_vkbur LIKE vbak-vkbur, "sales office
                p_file(256) default 'c:/saleorder.txt'.         "File name
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN PUSHBUTTON 15(10) v_create USER-COMMAND creat.
    SELECTION-SCREEN PUSHBUTTON 40(10) v_clear USER-COMMAND clear.
      INITIALIZATION -
    INITIALIZATION.
      v_create = c_creat .
      v_clear = c_clear.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    PERFORM selectfile USING p_file.
    *--AT SELECTION_SCREEN--
    AT SELECTION-SCREEN .
      IF sy-ucomm = c_clear.
        PERFORM f_clear.
    ELSE.
       IF sy-ucomm <> c_mvmt.
    **--- Validating the input data.
         PERFORM f_check_inputs.
        ELSEif sy-ucomm = c_creat.
    *--- Validating the input data.
          PERFORM f_check_inputs.
    *-- Uploading the PO data.
          PERFORM f_PO_upload.
    *---checking the PO data
         PERFORM f_check_upload_data.
    *---create sales order from PO data
        PERFORM f_Sales_order_create.
        ENDIF.
    FORM f_PO_upload.
    gfilename = p_file.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = gfilename
                filetype                = 'DAT'
           TABLES
                data_tab                = i_upload
           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.
        MESSAGE i398(00) WITH '(WS_UPLOAD)'
        ' Errors occured with exception '
         sy-subrc.
      ENDIF.
    ENDFORM.                    " f_PO_upload
    *&      Form  selectfile
          text
         -->P_P_FILE  text
    FORM selectfile CHANGING value(filename) TYPE c.
    CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                def_filename     = gfilename
                def_path         = 'C:\'
                mask             = ',*.txt.'
                mode             = 'O'
                title            = 'Select File Name'
           IMPORTING
                filename         = filename
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
    ENDFORM.                    " selectfile
    FORM f_Sales_order_create.
      PERFORM f_fill_header.
      PERFORM f_fill_partner.
      PERFORM f_fill_item.
      PERFORM f_call_BAPI.
    ENDFORM.                    " f_Sales_order_create
    *&      Form  f_fill_header
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_header.
    move p_auart to wa_header-doc_type.
    move p_vkorg to wa_header-sales_org.
    move p_vtweg to wa_header-distr_chan.
    move p_spart to wa_header-division.
    move p_vkgrp to wa_header-sales_grp.
    move p_vkbur to wa_header-sales_off.
    Read table i_upload into wa_upload index 1.
    move wa_upload-ebeln to wa_header-purch_no_c.
    move wa_upload-aedat to wa_header-purch_date.
    move wa_upload-bsart to wa_header-po_method.
    move wa_upload-vdatu to wa_header-req_date_h.
    move wa_upload-bstkd_e to wa_header-purch_no_s.
    *move wa_upload-route to wa_header-route.
    move wa_upload-vsbed to wa_header-ship_cond.
    move wa_upload-empst to wa_header-rec_point.
    move wa_upload-shtyp to wa_header-ship_type.
    move wa_upload-zterm to wa_header-pmnttrms.
    move wa_upload-inco1 to wa_header-incoterms1.
    move wa_upload-inco2 to wa_header-incoterms2.
    ENDFORM.                    " f_fill_header
    *&      Form  f_fill_partner
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_partner.
    if not wa_upload-kunnr is initial.
    select single kunnr from kna1 into v_kunnr
                where kunnr = wa_upload-kunnr.
    if sy-subrc <> 0.
    Message E014 with 'customer does not exist'.
    else.
    move 'AG' to i_partner-partn_role.
    move wa_upload-kunnr to i_partner-partn_numb.
    move wa_upload-land1_s to i_partner-country.
    move wa_upload-name1_s to i_partner-name.
    move wa_upload-name2_s to i_partner-name_2.
    move wa_upload-ort01_s to i_partner-city.
    move wa_upload-regio_s to i_partner-region.
    move wa_upload-pstlz_s to i_partner-postl_code.
    move wa_upload-adrnr_s to i_partner-address.
    append i_partner.
    endif.
    endif.
    if not wa_upload-kunag is initial.
    select single kunnr from kna1 into v_kunag
                where kunnr = wa_upload-kunag.
    if sy-subrc <> 0.
    Message E015 with 'end customer does not exist'.
    else.
    move 'WE' to i_partner-partn_role.
    move wa_upload-kunag to i_partner-partn_numb.
    move wa_upload-land1_c to i_partner-country.
    move wa_upload-name1_c to i_partner-name.
    move wa_upload-name2_c to i_partner-name_2.
    move wa_upload-ort01_c to i_partner-city.
    move wa_upload-regio_c to i_partner-region.
    move wa_upload-pstlz_c to i_partner-postl_code.
    move wa_upload-adrnr_c to i_partner-address.
    append i_partner.
    endif.
    endif.
    ENDFORM.                    " f_fill_partner
    *&      Form  f_fill_item
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_item.
    loop at i_upload into wa_upload.
    if not wa_upload-matnr is initial.
    select single  maramatnr msegmenge into (v_matnr, v_zmeng) from
                       mara inner join mseg on maramatnr = msegmatnr
                       where mara~matnr = wa_upload-matnr.
    if sy-subrc <> 0.
    Message E016 with 'material no does not exist'.
    elseif v_zmeng LT wa_upload-zmeng.
    Message E017 with 'order quantity is greater than the quantity present'.
      endif.
    endif.
    move wa_upload-posnr to i_item-itm_number.
    move wa_upload-pstyv to i_item-item_categ.
    move wa_upload-matnr to i_item-material.
    move wa_upload-zmeng to i_item-target_qty.
    move wa_upload-meins to i_item-target_qu.
    move wa_upload-werks to i_item-plant.
    *move wa_upload-meins to wa_vbap-meins.
    *move wa_upload-posnr_tot to wa_vbap-posnr_tot.
    move wa_upload-posex to i_item-po_itm_no.
    move wa_upload-kdmat to i_item-cust_mat22.
    move wa_upload-inco1 to i_item-incoterms1.
    move wa_upload-inco2 to i_item-incoterms2.
    move wa_upload-zterm to i_item-pmnttrms.
    move wa_upload-empst to i_item-rec_point.
    move wa_upload-shtyp to i_item-ship_type.
    move wa_upload-route to i_item-route.
    append i_item.
    PERFORM f_fill_schedule_line.
    PERFORM f_fill_conditions.
    ENDLOOP.
    ENDFORM.                    " f_fill_item
    *&      Form  f_fill_schedule_line
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_schedule_line.
    move wa_upload-matnr to i_schedule-itm_number.
    move sy-datum to i_schedule-req_date.
    move wa_upload-zmeng to i_schedule-req_qty.
    append i_schedule.
    ENDFORM.                    " f_fill_schedule_line
    *&      Form  f_fill_conditions
          text
    -->  p1        text
    <--  p2        text
    FORM f_fill_conditions.
    move wa_upload-matnr to i_cond-itm_number.
    move sy-datum to i_cond-conpricdat.
    append i_cond.
    ENDFORM.                    " f_fill_conditions
    *&      Form  f_clear
          text
    -->  p1        text
    <--  p2        text
    FORM f_clear.
    clear:p_auart,
          p_vkorg,
          p_vtweg,
          p_spart,
          p_vkgrp,
          p_vkbur.
    ENDFORM.                    " f_clear
    *&      Form  f_call_BAPI
          text
    -->  p1        text
    <--  p2        text
    FORM f_call_BAPI.
    clear:i_item,i_partner,i_schedule.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
      SALESDOCUMENTIN               =
        ORDER_HEADER_IN               = wa_header
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
    IMPORTING
       SALESDOCUMENT                  = sorder
      TABLES
      RETURN                        =
       ORDER_ITEMS_IN                 = i_item
      ORDER_ITEMS_INX               =
        ORDER_PARTNERS                = i_partner
       ORDER_SCHEDULES_IN             = i_schedule
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN            = i_cond.
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
    if not ( sorder-vbeln is initial ).
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    write: /'Order number:', sorder.
    else.
    loop at i_return.
    write: / i_return-id, i_return-number, i_return-message(80).
    endloop.
    *write: /'Error'.
    endif.
    *loop at i_return.
    *write: / i_return-id, i_return-number, i_return-message(80).
    *endloop.
    ENDFORM.                    " f_call_BAPI

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Creation of material using BAPI in LSMW without using material no.

    Hi SAP Gurus,
    I have a requirement of creating materials using the BAPI in LSMW.
    I tried to create a material using the BAPI (Business Object - BUS1001006 , and method - SAVEDATA) which should be created internally, but it is asking the material number to be given externally and my configuration is setup to create the material number internally.
    Even I looked into the material type which is associated with the number range and everything looks good.
    Is there any solution to create the material by using BAPI in LSMW without passing the material no. externally ?
    Appreciate your help.
    Kalikonda.

    Hi,
    it looks like it's not possible to call this BAPI wihtout material number. Here is a quote from BAPI documentation.
    When creating material master data, you must transfer the material
    number, the material type, and the industry sector to the method. You
    must also enter a material description and its language.
    Cheers

  • Create Excise invoice(J1IIN) document while creating billing document using bapi BAPI_BILLINGDOC_CREATEMULTIPLE

    Dear Experts,
    My scenario is:
    We have batch split scenario, where the parent line item of billing document has 0 quantity and its subsequent item (item with batch number) holds actual quantity data.
    When we create billing document using VF01 against delivery document, system creates billing document along with excise invoice document (J1IIN Document). And in excise document contain same number of line items that of billing document. Please see the below attachment: 
    Biiling document screen shot:
    While creating billing document, the J1IIN Document created automatically. Below is the screen-shot for the same.
    Now the issue is:
    When we create billing document using BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE system creating only billing document and not creating excise invoice document.
    When we create excise document manually using J1IIN the zero quantity line items are excluded in excise invoice document.
    Please see the below screen-shot for the same; The z quantity line items are missing.
    We want excise document to be created while creating billing document using BAPI BAPI_BILLINGDOC_CREATEMULTIPLE. Or is there any other BAPI for the same purpose.
    Customization is also maintained for creating excise invoice document automatically.
    Regards,
    Rajesh Sadula.

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

Maybe you are looking for

  • Digital Cinema Desktop Preview?

    Hi there Just wondering if it's possible to run Color with 2 screens using one screen as the UI+Scopes and the second screen as full screen Digi Cinema Desktop Preview? (I see the standard Video out options as FCP has, but they are all ghosted and ca

  • HP 8530w - SSD not detected

    Hello, Recently I managed to get an SSD from work, namely the A-Data S596 (500 SERIES). When putting it into my HP Elitebook 8530w, the disk was not detected. I have already upgraded the BIOS to the newest version. The SSD's firmware has also recentl

  • Alphanumeric sequence for RDA, PO and Receipts

    Hi, My customer ask to have a specific numeric sequence for all the RDA, PO and Receipt created in Oracle The customer use Iproc to generate the RDA and needs to have a dedicated alphanumberic sequence, The same for the PO generated from the RDA and

  • USMT 5.0 Error code 26 during scanstate, not looking in x86 folder

    Hi All, I have recently attempted to perform OSD using SCCM 2012. Bare metal deployments seem to be working fine, but now that I have tried to create a refresh task sequence using USMT 5 the TS fails during Scanstate. From looking at the errors USMT

  • Servlet configuration setting

    I have a question on how to call a servlet from the HTML file under oc4j environment. I get the configuration on the default-web-app\WEB-INF\web.xml, as follows <servlet> <servlet-name>UIBroker</servlet-name> <servlet-class>com.attachmate.mcs.system.