ERROR IN CREATING SALES ORDER,USING IDOC TYPE ORDERS05

I am using exit to write my code for creating sales order of IDOC Type ORDERS05 and order type ZDRX.
IF I proceess the Idoc in background each time error message comes
FIELD kuwev-kunnr(ship to party)is not an input field.
but if i run in foreground in debugging mode,sales order is getting created..
please suggest something.

If thats not working..
try BAPI_SALESORDER_CREATEFROMDAT2
If BAPI is not working. try creating a bdc for the same if there's not error on trying from VA01

Similar Messages

  • Creating sales order using IDOC - Delivery hour

    Hi,
    i've a problem to solve. when creating a sales order i need that when the segment is E1EDK03 and the IDDAT is 002 i need to extract the delivery hour and insert it in the table vbak-vzeit, now what i'm doing in the exit EXIT_SAPLVEDA_001 is:
    DATA: hour LIKE vbak-vzeit.
    CHECK segment-segnam = 'E1EDK03'.
    IF segment-sdata(3) = '002'.
      hour = segment-sdata+11(6).
    ENDIF.
    and now i want to acess the value in hour in the exit EXIT_SAPLVEDA_002 to put it in the dxvbak struct tha i think that is the table correct to then internaly fill the vbak. the problem is that the variable hour is not available in the exit EXIT_SAPLVEDA_002. i do i do to pass the value that i want from the exit EXIT_SAPLVEDA_001  to be available in exit EXIT_SAPLVEDA_002  and then insert that value in the right place to fill vbak.

    Can u tell me the steps to create a sales order using idoc, i've created a bapi but thats a temprory use. I wanted to created a sales order automatically when a purchase order is saved.
    Please let me know if u can help me, i wanted to do it using idoc
    Regards
    Sanju

  • Error while creating sales order using SD_SALESDOCUMENT_CREATE

    Hello All,
    We are using to  SD_SALESDOCUMENT_CREATE function module to create sales order it is working fine for single material.
    When we try to create sales order with multiple matearials we ended up with the following errors
    SALES_HEADER_IN has been processed successfully
    000000
    VBAKKOM
    Internal error in communication between configuration and sales doc.CONFIGURATION_PROCESSING
    000000
    CONFIGURATION_PROCESSING
    Error in SALES_ITEM_IN 000010
    000000
    VBAPKOM
    Internal error in communication between configuration and sales doc.CONFIGURATION_PROCESSING
    000000
    CONFIGURATION_PROCESSING
    Error in SALES_ITEM_IN 000020
    000000
    VBAPKOM
    SALES_ITEM_IN has been processed successfully
    000000
    VBAPKOM
    Could any one help me out to resolve this issue.
    Thanks in advance....
    Cheers,
    Harsha

    Hello,
    Looking at BAPI errors. It looks like you are trying to create sales order with variant configuration.
    Check Below SAP Note.
    900380 - Configurable items in the SD process (idocs & bapis)
    Regards,
    Sameer

  • Problem creating sales order using IDoc ORDERS05 (Inbound)

    Hello Experts,
    We are trying to create a sales order using the IDoc ORDERS05 with process code ORDE for creating sales order. I am getting the following error "VKORG, VTWEG, SPART cannot be determined for customer 0000006000 , vendor
    Diagnosis
    No sales organization, distribution channel or division were sent to the IDOC. This data is necessary if a sales order is to be added automatically. If this data is unavailable, you cannot create a sales order document.
    I was not able to find the fields to fill the distribution channel and divison in the Idoc structure. I have filled in Sales organization in E1EDK14 segment as 3000.
    I am not able to figure out the cause for the error.
    Same data works fine from BAPI_SALESORDER_CREATEFROMDAT2.
    Please help.
    Thanks,
    Suma
    Edited by: Suma B on Jun 17, 2008 11:12 AM

    Hello Suma
    In this case I would recommend to debug the IDoc processing.
    Call transaction WE19 and start the inbound processing of your IDoc in debugging mode. The error message will most likely occur in function module IDOC_INPUT_ORDERS.
      LOOP AT idoc_contrl.
    * SET/GET Parameter und interne Tabellen neu initialisieren
    * initialize SET/GET Parameter and internal tables
        PERFORM initialize_organizational_data.
    * IDOC-Segmente in die entsprechenden Anwendungsdaten übernehmen
    * Move IDOC to internal tables
        PERFORM interpret_idoc_orders.                    "<= check here
    * Prüfen ob gewisse Segmente gefüllt sind
    * check IDOC-Segments
        PERFORM check_idoc_segments.                 "<= check here
    * Prüfen und Ermitteln von Organisationsdaten
    * check internal tables and determine organization data
    Regards
      Uwe

  • Error While Creating Sales Order Using OE_ORDER_PUB.PROCESS_ORDER

    Hi All,
    I am trying to create a sales order using oe_order_pub.process_order api..
    The Procedure i had written is as follows.
    CREATE OR REPLACE PROCEDURE TEST_PROC
    AS
    x_return_status VARCHAR2(250);
    x_msg_count NUMBER;
    x_msg_data VARCHAR2(250);
    F varchar2(2000);
    --out parameters
    x_header_rec OE_Order_PUB.Header_Rec_Type;
    x_header_val_rec OE_Order_PUB.Header_Val_Rec_Type;
    x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
    x_Header_Adj_val_tbl OE_Order_PUB.Header_Adj_Val_Tbl_Type;
    x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
    x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
    x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
    x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
    x_Header_Scredit_val_tbl OE_Order_PUB.Header_Scredit_Val_Tbl_Type;
    x_line_tbl OE_Order_PUB.Line_Tbl_Type;
    x_line_val_tbl OE_Order_PUB.Line_Val_Tbl_Type;
    x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
    x_Line_Adj_val_tbl OE_Order_PUB.Line_Adj_Val_Tbl_Type;
    x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
    x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
    x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
    x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
    x_Line_Scredit_val_tbl OE_Order_PUB.Line_Scredit_Val_Tbl_Type;
    x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
    x_Lot_Serial_val_tbl OE_Order_PUB.Lot_Serial_Val_Tbl_Type;
    x_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
    --in parameters
    l_header_rec OE_Order_PUB.Header_Rec_Type;
    t_line_tbl OE_ORDER_PUB.Line_Tbl_Type;
    BEGIN
    apps.mo_global.set_org_context(204,null,'ONT');
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.ORG_ID := 204;
    l_header_rec.ORDER_TYPE_ID := 1437;
    l_header_rec.SOLD_TO_ORG_ID := 1290;
    l_header_rec.SHIP_TO_ORG_ID:=1425;
    l_header_rec.INVOICE_TO_ORG_ID:=1424;
    l_header_rec.PRICE_LIST_ID := 1000;
    l_header_rec.salesrep_id := 1006;
    l_header_rec.ORDER_CATEGORY_CODE := 'MIXED';
    l_header_rec.VERSION_NUMBER := 0;
    l_header_rec.OPEN_FLAG := 'Y';
    l_header_rec.BOOKED_FLAG := 'Y';
    l_header_rec.PRICING_DATE := sysdate;
    l_header_rec.TRANSACTIONAL_CURR_CODE := 'USD';
    l_header_rec.created_by := FND_GLOBAL.USER_ID;
    l_header_rec.creation_date := sysdate;
    l_header_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
    l_header_rec.LAST_UPDATE_DATE := sysdate;
    l_header_rec.attribute1 := '250';
    l_header_rec.operation := 'CREATE';
    t_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC; ---check
    t_line_tbl(1).inventory_item_id := 193742;
    t_line_tbl(1).ordered_quantity := 1;
    t_line_tbl(1).operation := 'CREATE';
    oe_debug_pub.initialize;
    --oe_debug_pub.SetDebugLevel(1);
    OE_MSG_PUB.INITIALIZE();
    OE_Order_PUB.Process_Order
    ( -- p_org_id =>          204,
    --p_operating_unit                =>          'ONT',
    p_api_version_number =>          1.0,
    p_init_msg_list =>          FND_API.G_TRUE,
    p_return_values =>          FND_API.G_TRUE,
    p_action_commit =>          FND_API.G_TRUE,
    x_return_status =>          x_return_status,
    x_msg_count =>          x_msg_count,
    x_msg_data =>          x_msg_data,
    p_header_rec =>          l_header_rec,
    p_old_header_rec =>          OE_Order_PUB.G_MISS_HEADER_REC,
    p_header_val_rec =>          OE_Order_PUB.G_MISS_HEADER_VAL_REC,
    p_old_header_val_rec =>          OE_Order_PUB.G_MISS_HEADER_VAL_REC,
    p_Header_Adj_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_TBL,
    p_old_Header_Adj_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_TBL,
    p_Header_Adj_val_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_VAL_TBL,
    p_old_Header_Adj_val_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_VAL_TBL,
    p_Header_price_Att_tbl =>          OE_Order_PUB.G_MISS_HEADER_PRICE_ATT_TBL,
    p_old_Header_Price_Att_tbl =>          OE_Order_PUB.G_MISS_HEADER_PRICE_ATT_TBL,
    p_Header_Adj_Att_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_ATT_TBL,
    p_old_Header_Adj_Att_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_ATT_TBL,
    p_Header_Adj_Assoc_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_ASSOC_TBL,
    p_old_Header_Adj_Assoc_tbl =>          OE_Order_PUB.G_MISS_HEADER_ADJ_ASSOC_TBL,
    p_Header_Scredit_tbl =>          OE_Order_PUB.G_MISS_HEADER_SCREDIT_TBL,
    p_old_Header_Scredit_tbl =>          OE_Order_PUB.G_MISS_HEADER_SCREDIT_TBL,
    p_Header_Scredit_val_tbl =>          OE_Order_PUB.G_MISS_HEADER_SCREDIT_VAL_TBL,
    p_old_Header_Scredit_val_tbl =>          OE_Order_PUB.G_MISS_HEADER_SCREDIT_VAL_TBL,
    p_line_tbl =>          t_line_tbl,
    p_old_line_tbl =>          OE_Order_PUB.G_MISS_LINE_TBL,
    p_line_val_tbl =>          OE_Order_PUB.G_MISS_LINE_VAL_TBL,
    p_old_line_val_tbl =>          OE_Order_PUB.G_MISS_LINE_VAL_TBL,
    p_Line_Adj_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_TBL,
    p_old_Line_Adj_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_TBL,
    p_Line_Adj_val_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_VAL_TBL,
    p_old_Line_Adj_val_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_VAL_TBL,
    p_Line_price_Att_tbl =>          OE_Order_PUB.G_MISS_LINE_PRICE_ATT_TBL,
    p_old_Line_Price_Att_tbl =>          OE_Order_PUB.G_MISS_LINE_PRICE_ATT_TBL,
    p_Line_Adj_Att_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_ATT_TBL,
    p_old_Line_Adj_Att_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_ATT_TBL,
    p_Line_Adj_Assoc_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_ASSOC_TBL,
    p_old_Line_Adj_Assoc_tbl =>          OE_Order_PUB.G_MISS_LINE_ADJ_ASSOC_TBL,
    p_Line_Scredit_tbl =>          OE_Order_PUB.G_MISS_LINE_SCREDIT_TBL,
    p_old_Line_Scredit_tbl =>          OE_Order_PUB.G_MISS_LINE_SCREDIT_TBL,
    p_Line_Scredit_val_tbl =>          OE_Order_PUB.G_MISS_LINE_SCREDIT_VAL_TBL,
    p_old_Line_Scredit_val_tbl =>          OE_Order_PUB.G_MISS_LINE_SCREDIT_VAL_TBL,
    p_Lot_Serial_tbl =>          OE_Order_PUB.G_MISS_LOT_SERIAL_TBL,
    p_old_Lot_Serial_tbl =>          OE_Order_PUB.G_MISS_LOT_SERIAL_TBL,
    p_Lot_Serial_val_tbl =>          OE_Order_PUB.G_MISS_LOT_SERIAL_VAL_TBL,
    p_old_Lot_Serial_val_tbl =>          OE_Order_PUB.G_MISS_LOT_SERIAL_VAL_TBL,
    p_action_request_tbl     =>          OE_Order_PUB.G_MISS_REQUEST_TBL,
    x_header_rec =>          x_header_rec,
    x_header_val_rec =>          x_header_val_rec,
    x_Header_Adj_tbl =>          x_Header_Adj_tbl,
    x_Header_Adj_val_tbl =>          x_Header_Adj_val_tbl,
    x_Header_price_Att_tbl =>          x_Header_price_Att_tbl,
    x_Header_Adj_Att_tbl =>          x_Header_Adj_Att_tbl,
    x_Header_Adj_Assoc_tbl =>          x_Header_Adj_Assoc_tbl,
    x_Header_Scredit_tbl =>          x_Header_Scredit_tbl,
    x_Header_Scredit_val_tbl =>          x_Header_Scredit_val_tbl,
    x_line_tbl =>          x_line_tbl,
    x_line_val_tbl =>          x_line_val_tbl,
    x_Line_Adj_tbl =>          x_Line_Adj_tbl,
    x_Line_Adj_val_tbl =>          x_Line_Adj_val_tbl,
    x_Line_price_Att_tbl =>          x_Line_price_Att_tbl,
    x_Line_Adj_Att_tbl =>          x_Line_Adj_Att_tbl,
    x_Line_Adj_Assoc_tbl =>          x_Line_Adj_Assoc_tbl,
    x_Line_Scredit_tbl =>          x_Line_Scredit_tbl,
    x_Line_Scredit_val_tbl =>          x_Line_Scredit_val_tbl,
    x_Lot_Serial_tbl =>          x_Lot_Serial_tbl,
    x_Lot_Serial_val_tbl =>          x_Lot_Serial_val_tbl,
    x_action_request_tbl     =>          x_action_request_tbl,
    --For bug 3390458
    p_rtrim_data => 'N',
    p_validate_desc_flex => 'Y' -- bug4343612
    COMMIT;
    if x_msg_count > 0 then
    for l_index in 1..x_msg_count loop
    x_msg_data := oe_msg_pub.get(p_msg_index => l_index, p_encoded => F);
    PRINT('x_msg_data: '||x_msg_data);
    end loop;
    end if;
    -- Check the return status
    if x_return_status = FND_API.G_RET_STS_SUCCESS then
    PRINT('success');
    else
    PRINT('failure');
    end if;
    PRINT('x_return_status: '||x_return_status);
    PRINT('x_msg_count: '||x_msg_count);
    PRINT('x_msg_data: '||x_msg_data);
    PRINT('x_header_val_rec: '||x_header_val_rec.accounting_rule);
    PRINT('x_header_rec header_id: ' ||x_header_rec.header_id);
    PRINT('x_header_rec order_number: ' ||x_header_rec.order_number);
    PRINT('x_header_rec ship_to_org_id: ' ||x_header_rec.ship_to_org_id);
    PRINT('x_header_rec payment_term_id: ' ||x_header_rec.payment_term_id);
    PRINT('x_header_rec order_source_id: ' ||x_header_rec.order_source_id);
    PRINT('x_header_rec order_type_id: ' ||x_header_rec.order_type_id);
    PRINT('x_header_rec price_list_id: ' ||x_header_rec.price_list_id);
    PRINT('x_header_rec invoicing_rule_id: ' ||x_header_rec.invoicing_rule_id);
    PRINT('x_header_rec accounting_rule_id: ' ||x_header_rec.accounting_rule_id);
    PRINT('x_header_rec org_id: ' ||x_header_rec.org_id);
    PRINT('x_header_rec sold_to_org_id: ' ||x_header_rec.sold_to_org_id);
    PRINT('x_header_rec invoice_to_org_id: ' ||x_header_rec.invoice_to_org_id);
    PRINT('x_header_rec salesrep_id: ' ||x_header_rec.salesrep_id);
    PRINT('x_header_rec invoice_to_org_id: ' ||x_header_rec.invoice_to_org_id);
    PRINT('x_header_rec operation: ' ||x_header_rec.operation);
    PRINT('x_header_rec transactional_curr_code: ' ||x_header_rec.transactional_curr_code);
    PRINT('x_header_rec orig_sys_document_ref: ' ||x_header_rec.orig_sys_document_ref);
    PRINT('x_header_rec request_date: ' ||x_header_rec.request_date);
    PRINT('x_header_rec conversion_rate_date: ' ||x_header_rec.conversion_rate_date);
    PRINT('x_header_rec last_update_date: ' ||x_header_rec.last_update_date);
    PRINT('x_header_rec ordered_date: ' ||x_header_rec.ordered_date);
    PRINT('x_header_rec creation_date: ' ||x_header_rec.creation_date);
    PRINT('x_header_rec created_by: ' ||x_header_rec.created_by);
    END;
    It is throwing the following Error.
    SQL> exec TEST_PROC;
    x_msg_data: ORA-01403: no data found in Package OE_ORDER_WF_UTIL Procedure
    Create_HdrWorkItem
    x_msg_data: User-Defined Exception in Package OE_ORDER_WF_UTIL Procedure
    Start_HdrProcess
    failure
    x_return_status: U
    x_msg_count: 2
    x_msg_data: User-Defined Exception in Package OE_ORDER_WF_UTIL Procedure
    Start_HdrProcess
    x_header_val_rec: Immediate
    x_header_rec header_id: 156408
    x_header_rec order_number: 64097
    x_header_rec ship_to_org_id: 1425
    x_header_rec payment_term_id: 4
    x_header_rec order_source_id: 0
    x_header_rec order_type_id: 1437
    x_header_rec price_list_id: 1000
    x_header_rec invoicing_rule_id: -2
    x_header_rec accounting_rule_id: 1
    x_header_rec org_id: 204
    x_header_rec sold_to_org_id: 1290
    x_header_rec invoice_to_org_id: 1424
    x_header_rec salesrep_id: 1006
    x_header_rec invoice_to_org_id: 1424
    x_header_rec operation: CREATE
    x_header_rec transactional_curr_code: USD
    x_header_rec orig_sys_document_ref: OE_ORDER_HEADERS_ALL156408
    x_header_rec request_date: 02-APR-09
    x_header_rec conversion_rate_date:
    x_header_rec last_update_date: 02-APR-09
    x_header_rec ordered_date: 02-APR-09
    x_header_rec creation_date: 02-APR-09
    x_header_rec created_by: 13615
    Any help on this would be appreciated.
    I am using R12..

    Pl see if MOS Doc 117313.1 (Booking Order from Order Capture Errors at OE_ORDER_WF_UTIL) can help
    HTH
    Srini

  • Error in Creating Sales Order Using BAPI_SALESORDER_CREATEFROMDAT2

    Hi Everyone,
    We have a requirement to create sales order from flat file using BAPI. Everything was working well until we encounter a customer with credit control limit setup.
    Using the partners table for BAPi, the sold to customer is enter at header level, and we have this requirement to add the payer at item level. This is where the error is occuring. Upon debugging, I found out that the customer has a credit limit setup at FD33, and has a record found in KNKK, which is giving the error "Credit limit customer differs from credit limit customer in header".
    However, duting manual creation of sales order via VA01, this error is not encountered.
    Any ideas or suggesstions on how we can move forward with SO creation using BAPI with customers where credit management is setup?
    Thanks,
    Louisse

    If thats not working..
    try BAPI_SALESORDER_CREATEFROMDAT2
    If BAPI is not working. try creating a bdc for the same if there's not error on trying from VA01

  • Create Sales Order using IDoc

    Hi All,
    Based upon customer's input file which contains header and line item details I have to create sales order in our system. We would like to use IDoc for this. Customer will send us file once a day by email or FTP.
    For this I have created a port and partner profile but I am not sure how the process will get initiated?
    Can someone please let me know how can I do this? There is now outbound process involved, I just need to create sales order based upon input file using IDoc.
    Regards,
    Sanjay

    HI,
    You cannot directly call the function modules that process the idoc, because these functions are called dynamically by the ALE layer and the function expects data in a certian format (IDoc format ).
    BAPI would be the best way to go for your scenario.
    However there is a workaround if you want to use IDoc only. You can follow this approach :
    1. Populate an outbound ORDERS05 IDoc from the file data.
    2. Distribute it to the same system, i.e sender system and receiver system is same.
    3. On the Inbound side the Idoc that you created on the outbound side will be received and processed.
    "R3  File----->Outound ORDRES05  -----
    ______________________________________|
    |
    '------> " Inbound ORDERS05 ( in the same R3 system)
    The tricky part is sending an Idoc and receiving in the same system, but you can find how to do this on the wiki pages.
    regards,
    Advait

  • Error when creating sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hello!
    I am using BAPI_SALESORDER_CREATEFROMDAT2 for creating the Sales order. But I have a problem when Iu2019m trying to create configuration. I think that parameter order_items_in-material should be generated before calling BAPI described above. I try to use order_items_in-mat_entrd, but BAPI return error message id = V1, number = 320 (No item category available (Table T184 ZAPC  TEXT )).
    Help me please, How I can solve this problem?

    <P><STRONG>FUNCTION Z_SD_GET_TEH_COST.<BR>"----<BR>"  IMPORTING<BR>"     REFERENCE(IS_COST_ORDER) TYPE  ZWCLIF_COST_ORDER<BR>"  EXPORTING<BR>"     REFERENCE(EV_KBETR) TYPE  KBETR<BR>"----
    </STRONG></P>
    <P><STRONG>  DEFINE fill_prizn.<BR>    IF is_cost_order-&amp;1 IS NOT INITIAL.<BR>      CLEAR: ls_cfgs_value-charc,<BR>             ls_cfgs_value-value.<BR>      ls_cfgs_value-charc = &amp;2.<BR>      ls_cfgs_value-value = is_cost_order-&amp;1.<BR>*      ls_cfgs_value-valcode = '1'.<BR>      APPEND ls_cfgs_value TO lt_cfgs_value.<BR>    ENDIF.<BR>  END-OF-DEFINITION.</STRONG></P>
    <P><STRONG>DATA: ls_header_in TYPE bapisdhd1,<BR>      ls_header_inx TYPE bapisdhd1x,</STRONG></P>
    <P><STRONG>      lt_partners TYPE TABLE OF bapiparnr,<BR>      ls_partners TYPE bapiparnr,</STRONG></P>
    <P><STRONG>      lt_items_in TYPE TABLE OF bapisditm,<BR>      lt_items_inx TYPE TABLE OF bapisditmx,</STRONG></P>
    <P><STRONG>      ls_items_in TYPE bapisditm,<BR>      ls_items_inx TYPE bapisditmx,</STRONG></P>
    <P><STRONG>      ls_cfgs_ref TYPE bapicucfg,<BR>      lt_cfgs_ref TYPE TABLE OF bapicucfg,</STRONG></P>
    <P><STRONG>      lt_cfgs_value TYPE TABLE OF bapicuval,<BR>      ls_cfgs_value TYPE bapicuval,</STRONG></P>
    <P><STRONG>      lt_schedules_in TYPE TABLE OF bapischdl,<BR>      ls_schedules_in TYPE bapischdl,</STRONG></P>
    <P><STRONG>      lt_schedules_inx TYPE TABLE OF bapischdlx,<BR>      ls_schedules_inx TYPE bapischdlx,</STRONG></P>
    <P><STRONG>      lt_cfgs_inst TYPE TABLE OF bapicuins,<BR>      ls_cfgs_inst TYPE bapicuins,<BR>      lt_cfgs_partof TYPE TABLE OF bapicuprt,<BR>      ls_cfgs_partof TYPE bapicuprt,</STRONG></P>
    <P><STRONG>      lv_vbeln TYPE bapivbeln-vbeln,<BR>      lt_return TYPE TABLE OF bapiret2.</STRONG></P>
    <P><STRONG>* fill header<BR>  ls_header_in-doc_type = 'ZAPC'.<BR>  ls_header_in-sales_org = is_cost_order-vkorg.<BR>  ls_header_in-distr_chan = is_cost_order-vtweg.<BR>  ls_header_in-division = '01'.<BR>  ls_header_in-sales_off = '1011'.</STRONG></P>
    <P><STRONG>  ls_header_inx-updateflag = 'I'.<BR>  ls_header_inx-doc_type = 'X'.<BR>  ls_header_inx-sales_org = 'X'.<BR>  ls_header_inx-distr_chan = 'X'.<BR>  ls_header_inx-division = 'X'.<BR>  ls_header_inx-sales_off = 'X'.</STRONG></P>
    <P><STRONG>* fill partners<BR>  ls_partners-partn_role = 'AG'.<BR>  ls_partners-partn_numb = '1000000031'.   " фиктивный заказчик<BR>  APPEND ls_partners TO lt_partners.</STRONG></P>
    <P><STRONG>*  ls_items_in-material = is_cost_order-matnr.<BR>  ls_items_in-mat_entrd = is_cost_order-matnr.<BR>  ls_items_in-target_qty = '1'.<BR>  ls_items_in-itm_number = '000001'.<BR>  ls_items_in-po_itm_no = '000001'.<BR>  ls_items_in-item_categ = 'ZCRM'.<BR>  SELECT SINGLE meins INTO ls_items_in-target_qu<BR>    FROM mara<BR>    WHERE matnr = is_cost_order-matnr.<BR>  APPEND ls_items_in TO lt_items_in.</STRONG></P>
    <P><STRONG>  ls_items_inx-itm_number = '000001'.<BR>  ls_items_inx-item_categ = 'X'.<BR>  ls_items_inx-po_itm_no = 'X'.<BR>*  ls_items_inx-material = 'X'.<BR>  ls_items_inx-mat_entrd = 'X'.<BR>  ls_items_inx-target_qty = 'X'.<BR>  ls_items_inx-target_qu = 'X'.<BR>  ls_items_inx-updateflag = 'I'.<BR>  APPEND ls_items_inx TO lt_items_inx.</STRONG></P>
    <P><STRONG>* fill configuration<BR>  ls_cfgs_ref-posex = '000001'.<BR>  ls_cfgs_ref-config_id = '000001'.<BR>  ls_cfgs_ref-root_id = '00000001'.<BR>  APPEND ls_cfgs_ref TO lt_cfgs_ref.</STRONG></P>
    <P><STRONG> ls_cfgs_value-config_id = '000001'.<BR>  ls_cfgs_value-inst_id = '00000001'.</STRONG></P>
    <P><STRONG>  fill_prizn kod_prod 'KOD_PROD'.<BR>  fill_prizn tlot_min 'TLOT_MIN'.<BR>  fill_prizn tlot_max 'TLOT_MAX'.<BR>  fill_prizn shot_min 'SHOT_MIN'.<BR>  fill_prizn shot_max 'SHOT_MAX'.<BR>  fill_prizn dlot_min 'DLOT_MIN'.<BR>  fill_prizn dlot_max 'DLOT_MAX'.<BR>  fill_prizn marka 'MARKA'.<BR>  fill_prizn stndrt_marka 'STNDRT_MARKA'.<BR>  fill_prizn stndrt_prod  'STNDRT_PROD'.<BR>  fill_prizn tprk 'TPRK'.<BR>  fill_prizn grot 'GROT'.<BR>  fill_prizn vityazhka 'VITYAZHKA'.<BR>  fill_prizn krom 'KROM'.<BR>  fill_prizn chisl_st_pokr 'CHISL_ST_POKR'.<BR>  fill_prizn kls_tol_pokr  'KLS_TOL_POKR'.<BR>  fill_prizn proch_izg_t_lic_max 'PROCH_IZG_T_LIC_MAX'.<BR>  fill_prizn priz_zasch_pov 'PRIZ_ZASCH_POV'.<BR>  fill_prizn vid_pokr  'VID_POKR'.<BR>  fill_prizn mark_pokr 'MARK_POKR'.<BR>  fill_prizn mat_pokr_lic 'MAT_POKR_LIC'.<BR>  fill_prizn plsk 'PLSK'.<BR>  fill_prizn vid_postavki 'VID_POSTAVKI'.<BR>  fill_prizn dressir 'DRESSIR'.<BR>  fill_prizn travl   'TRAVL'.<BR>  fill_prizn fsfr_min 'FSFR_MIN'.<BR>  fill_prizn fsfr_max 'FSFR_MAX'.<BR>  fill_prizn krmn_min 'KRMN_MIN'.<BR>  fill_prizn krmn_max 'KRMN_MAX'.<BR>  fill_prizn mrgn_min 'MRGN_MIN'.<BR>  fill_prizn mrgn_max 'MRGN_MAX'.<BR>  fill_prizn almn_min 'ALMN_MIN'.<BR>  fill_prizn almn_max 'ALMN_MAX'.<BR>  fill_prizn cugl_min 'CUGL_MIN'.<BR>  fill_prizn cugl_max 'CUGL_MAX'.</STRONG></P>
    <P><STRONG>  ls_schedules_in-itm_number = '000001'.<BR>*  ls_schedules_in-req_date = sy-datum.<BR>  ls_schedules_in-sched_line = '0001'.<BR>  ls_schedules_in-req_qty = '1'.<BR>  APPEND ls_schedules_in TO lt_schedules_in.</STRONG></P>
    <P><STRONG>  ls_schedules_inx-itm_number = '000001'.<BR>  ls_schedules_inx-sched_line = '0001'.<BR>*  ls_schedules_inx-req_date = 'X'.<BR>  ls_schedules_inx-req_qty = 'X'.<BR>  ls_schedules_inx-updateflag = 'I'.<BR>  APPEND ls_schedules_inx TO lt_schedules_inx.</STRONG></P>
    <P><STRONG>  ls_cfgs_partof-parent_id = '00000001'.<BR>  ls_cfgs_partof-inst_id = '00000001'.<BR>  ls_cfgs_partof-class_type = '300'.<BR>  ls_cfgs_partof-obj_type = 'MARA'.<BR>  ls_cfgs_partof-obj_key = is_cost_order-matnr.<BR>  APPEND ls_cfgs_partof TO lt_cfgs_partof.</STRONG></P>
    <P><STRONG>  ls_cfgs_inst-config_id = '000001'.<BR>  ls_cfgs_inst-inst_id = '00000001'.<BR>  ls_cfgs_inst-obj_type = 'MARA'.<BR>  ls_cfgs_inst-class_type = '300'.<BR>  ls_cfgs_inst-obj_key = is_cost_order-matnr.<BR>  APPEND ls_cfgs_inst TO lt_cfgs_inst.</STRONG></P>
    <P><STRONG>  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'<BR>    EXPORTING<BR>      order_header_in               = ls_header_in<BR>      order_header_inx              = ls_header_inx<BR>*      testrun                       =<BR>    IMPORTING<BR>      salesdocument                 = lv_vbeln<BR>    TABLES<BR>      return                        = lt_return<BR>      order_items_in                = lt_items_in<BR>      order_items_inx               = lt_items_inx<BR>      order_partners                = lt_partners<BR>      order_schedules_in            = lt_schedules_in<BR>      order_schedules_inx           = lt_schedules_inx<BR>      order_cfgs_ref                = lt_cfgs_ref<BR>      order_cfgs_inst               = lt_cfgs_inst<BR>      order_cfgs_part_of            = lt_cfgs_partof<BR>      order_cfgs_value              = lt_cfgs_value<BR>            .</STRONG></P>
    <P><STRONG>  READ TABLE lt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'.<BR>  IF sy-subrc = 0.<BR>    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'<BR>              .<BR>  ELSE.<BR>    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'<BR>      EXPORTING<BR>        wait          = 'X'<BR>              .<BR>  ENDIF.</STRONG></P>
    <P><STRONG>ENDFUNCTION.</STRONG></P>
    <P><STRONG></STRONG> </P>
    <P><STRONG></STRONG> </P>

  • Error while creating sales order thru IDoc

    Hi,
      While using FM IDOC_WRITE_AND_START_INBOUND, I am getting an error 'Customer not found with DUNS number from IDoc' and the application document is nor posted. I am passing valid customers in the ship to party and sold to party segments but still getting this error.
      Please advice.
    Regards,
    Rajesh

    Hi All,
    Can anybody give me some resolution for the above posted issue!
    Thanks in advance.
    Thanks,
    Deep.

  • Sales Order Using Idoc

    Hello All,
    We are creating Sales Order through Idocs : Basic Type  - ORDERS05   Message Type - ORDERS
    Sales Order is being created but for few Items , Reason for Rejection is set (thts not required in our case).
    I am trying to figure out why for some items its happening ?
    I tried to check the reason by Processing the Idoc in WE19 but could get through.
    Also tried to process the   Idoc using FM IDOC_INPUT_ORDERS in Debugging but not able to process further as getting error message : 'Idoc Has Different Status'.
    Any input on this would be helpful.
    Thanks
    Praveen

    This problem due to your config in the system, try to create a sales order for the item that posted via Idoc then see same item got rejected.. If yes discuss wtih your funtional guys....

  • Creating sales order using bapi

    while creating sales order using bapi serial no is added in dat but its not saving.
    plz reply

    Hi
    See tha sample code for sales order creation
    SALES ORDER INPUT CREATION.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    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.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    PARTNER DATA
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    ITEM DATA
    itemx-updateflag = 'I'.
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    item-material = p_matnr.
    itemx-material = 'X'.
    item-plant = p_plant.
    itemx-plant = 'X'.
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    item-target_qu = 'EA'.
    itemx-target_qu = 'X'.
    item-item_categ = p_itcat.
    itemx-item_categ = '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
    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 WORK AND WAIT.
    WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
    after that check in the table VBAP whether serial number is cretaed or not
    Reward points if useful
    Regards
    Anji

  • How to create sales order using BAPI.

    Hi all,
    I am trying to create sales order using standard BAPI
    "BAPI_SALESORDER_CREATEFROMDAT2". But, even I had entered all mandatory fields, I am unable to create sales order sucessfully.
    I had gone through the documentaion of this BAPI and entered these fields.
    These are the mandatory fields that which I had tried to create,
    ORDER_HEADER_IN :
    DOC_TYPE Sales document type
    SALES_ORG Sales organization
    DISTR_CHAN Distribution channel
    DIVISION Division
    ORDER_PARTNERS..:
    PARTN_ROLE Partner role, SP sold-to party
    PARTN_NUMB Customer number
    ORDER_ITEMS_IN..:
    MATERIAL Material number
    Do we have anymore fields to give as inputs? I am getting this error message as below :
    Msg: Personal number 00007176 does not exit.
    But, I am not giving any personal number manually. This personal number was having connection with partner role field,
    I had reffered this from the VBPA (Sales Document: Partner Table). Now, please suggest me how to solve this?
    Can anyone tell me how to solve this problem and create sales order sucessfully.
    Thanks in advance,
    Surender Batlanki.

    hi surendra ,
    chech with below code.
    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.
    let us know if you have any qauistions.
    ~linganna

  • TO CREATE SALES ORDER USING BAPI PROBLEM

    I am trying to create Sales Order using bapi function, this is giving me error as mentioned below
    *Please enter SHIP-TO-PARTY OR SOLD TO PARTY
    *SALES DOCUMENT WAS NOT CHANGED.
    it does not GIVE ME THE SALES DOCUMENT NO .
    The BAPI I am using is BAPI_SALESORDER_CREATEFROMDAT2.
    Would someone know which parameters I have to papulate,or have any other suggestion
    THE INTERNAL TABLES I AM PASSING TO BAPI FUNCTION ARE
    DATA:  IT_BAPI_HEADER LIKE BAPISDHD1.
    DATA:     IT_BAPI_SOLD_TO_PARTY LIKE BAPIPARNR occurs 0 with header line.
    DATA:  SO_NO LIKE BAPIVBELN-VBELN.
    DATA:  IT_BAPI_ITEMS_IN LIKE BAPISDITM occurs 0 with header line.
    DATA: IT_BAPI_RETURN LIKE BAPIRET2 occurs 0 with header line.
    IS THERE ANYTHING ELSE TO POPULATE OTHER THAN THIS STRUCTURES
    HEADER
          Sales-Document type:      
    *     Sales-Organization
    *     Distrubution-Channel: 
    *     Division          
    PARTNER
            Partner Function     
         Customer Number      
    ITEM DETAIL
             Material Number      
    how to accomplish my task?

    Nandan,
    Please go through the documentation of the BAPI. It gives you details of what needs to be filled in in which structure/parmater. Also, read the documentation associated with each structure, that will tell what to fill.
    It is really hard to explain it in simple terms as to what are required. But, you need the header, items and partners at the minimum. Also, with some of these structures there are also 'X' structures(like ORDER_ITEMS_INX for ORDER_ITEMS_IN) which should also be filled based on what fields you filled in the original structure. For example, if you filled 'MATERIAL' field on the ORDER_ITEMS_IN structure, you should also fill in the same field on the ORDER_ITEMS_INX structure with an 'X' in it.
    All this is well documented in the BAPI.
    Srinivas

  • Create sales order using BAPI

    HI,
    I need to create sales orders using BAPI.
    these sales orders are different sales order type and it need to upload from excel file. anyone send me some sample programs for this one.
    kathir.

    use this code to create salesorder using bapi.
    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'.
    bye

  • Error while create sales order

    Hi,
    Please help.
    I am facing error while create sales order.
    No item category available (Table T184 OR VERP  )
    Message no. V1320
    Diagnosis
    No item category could be determined for the combination OR VERP .
    System Response
    The system does not allow further processing of this item.
    Procedure
    Check the entries in table T184 by means of which item category determination is controlled.
    If you do not have the authorization to do this yourself, contact your system administrator.

    Hi,
    Check in spro whether Item categorygroup VERP is assigned to sales document type.if not assign.
    Path
    SPRO-SD-sales-sales douments-sales document item-assign item categories.

Maybe you are looking for

  • Import Letter of credit

    hi all,        i would like to know whether import cycle is mapped into SAP or not, if so        then how much it is present in SAP and how do we process the same ?        along with that whether mode of payement - letter of credit in import proces i

  • PO Attachment - issue

    Hello All , As we know that manual process of attaching the form to PO is as follows... You can attach manually any document to PO Save you PO in ME23N  and Print preview , now you can see the form . On the form we have 'Services for Object'  button

  • How to trigger the BPM process from WD Application

    Hello All, I have a simple business process with two ui activities. I am able to start the process from NWA -> Process Repository. But, I need to start the process from the application. Here is the requirement: User opens the application. ON completi

  • LMS 3.1 Baseline Template Fails

    NEED HELP! :-) I made a baseline template that basicaly says: If you encounter an interface with a vlan24, apply a port-security mac-address sticky command. TEMPLATE FOLLOWS: In Conditional Block's SUBMODE: interface [#.*Ethernet.*#] CLI Command (of

  • Emailing a movie from iPhoto

    Can someone tell me how to email a movie directly from iPhoto. I cant get the option to show up when i highlight the file. Its grayed out as if not available. The only way i have been able to do it (and its more time consuming) is to play the movie i