ORDER_PARTNER BAPI_SALESORDER_CREATEFROMDAT2
Dear everyone,
I tried different approach of filling the order partner parameter for the BAPI_SALESORDER_CREATEFROMDAT2 function. Unfortunately, i encounter the
following error:
When calling the function module "BAPI_SALESORDER_CREATEFROMDAT2", one of the
parameters
needed according to the interface description was not specified.
This parameter was "ORDER_PARTNERS".
* Sold-to AG partner mandatory fields
MOVE 'SP' TO L_PARTNER-PARTN_ROLE.
MOVE '0000100075' TO L_PARTNER-PARTN_NUMB.
APPEND L_PARTNER.
* Ship-to WE partner mandatory fields
MOVE 'SH' TO L_PARTNER-PARTN_ROLE.
MOVE '0000100075' TO L_PARTNER-PARTN_NUMB.
APPEND L_PARTNER.
* EC partner mandatory fields
MOVE 'EC' TO L_PARTNER-PARTN_ROLE.
MOVE '0000022053' TO L_PARTNER-PARTN_NUMB.
APPEND L_PARTNER.
* RE partner mandatory fields
MOVE 'BP' TO L_PARTNER-PARTN_ROLE.
MOVE '0000100075' TO L_PARTNER-PARTN_NUMB.
APPEND L_PARTNER.
* RG partner mandatory fields
MOVE 'PY' TO L_PARTNER-PARTN_ROLE.
MOVE '0000100075' TO L_PARTNER-PARTN_NUMB.
APPEND L_PARTNER.
Regards,
Kit
hi kit,
Their is no problem with order partners,
instead of move statement, try assignment statements.
kindly give total program, may be u assigned structures in wrong way while calling bapi, or you might forgot to give 'BAPI_TRANSACTION_COMMIT'
comeback with your observations
regards,
Pavan
Similar Messages
-
BAPI_SalesOrder_CreateFromDat2 fails for items with free goods
Hi all, I have a very weird problem when I am trying to create a sales order using SAP .net connector with the BAPI function BAPI_SalesOrder_CreateFromDat2(). The problem happens through the following scenario:
1 - Item X has a free good rule on it that states "If user buys 5 Cartoons of Item X he will take 1 pack of Item Y free of charge" while Item Z has no rules like this
2 - using BAPI and .net connector, an order is needed to be created with following details:
a - Item X with quantity 6 Cartoons.
b- Item Z with quantity 3 Cartoons
3 - If BAPI_SalesOrder_CreateFromDat2() assigns these details to Order_Items_In with the same order (a then b), SAP will return an error for Item z that states "No item category available (Table T184 ZKE NORM KEN)."; while if the function tries to create the order with details in reverse order (b then a ), the order will be created successfully.
I have done the following steps:
1 - Tried the same order in SAP GUI but it succeeded. (So no problem in Item Category Determination)
2 - Tries the same order with the suspicious order in the BAPI function Test inside SAP GUI (using tcode BAPI or SE37) but the function had not return any errors also.
3 - Tried to send Item Category in code when calling the bapi function (Forced the code to KEN), but the same message appeared as SAP insist on redetermining the Item Category and return this meaningless message.
thanksHi Mohamed Abd Elbaset,
I am facing the same issue while creating the Sales order through "BAPI_SALESORDER_CREATEFROMDAT2" All is going well in normal cases but when I process the contract with FREE GOODS line items for which free goods condition record is maintained it fails
to create the Sales order. Is there any special treatment for this Free goods case..
Regards, -
Problem with STORE_LOC in BAPI_SALESORDER_CREATEFROMDAT2
Hi gurus.
I'm using BAPI_SALESORDER_CREATEFROMDAT2 to create sales orders and it works almost fine ...
I've only one problem: is it possible to get automatically the storage?
If I set the field STORE_LOC in the item, I get that storage in my order, otherwise the storage in the row order is empty.
But if I insert rows by the transactionVA01/02 I get automatically the storage, I don't need to force it.
Thanks for your help ...Hi
If Storage Location is assigned against the particular Plant and Shipping point functionally, then using VA01 transaction, it will
pick the storage location automatically. So when using your BAPI try with passing PLANT or SHIPPING POINT and see whether
storage location getting populated or not.
Regards,
Murali -
Order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I'm using BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' to create a sale order.
But the order quantity isn't upadate when I check the sales order number.
The field I used is target_qty in BAPISDITM.
Is the field wrong or some other problems?
Best Regards,
RachelHi,
I created SO using BAPI_SALESDOCU_CREATEFROMDATA1. while filling the header and item data, i used to do the following,
If you are passing some value to 'target_qty', make sure that you are filling the sales_items_inx-req_qty with 'X'. then pass them to the tables import parameters. Please refer the following code.
fs_sorder-doc_type = w_auart.
fs_sorderx-doc_type = c_flag.
fs_sorder-sales_org = w_vkorg.
fs_sorderx-sales_org = c_flag.
fs_sorder-distr_chan = w_vtweg.
fs_sorderx-distr_chan = c_flag.
fs_sorder-division = w_spart.
fs_sorderx-division = c_flag.
fs_sorderx-updateflag = c_flag.
fs_partner-partn_role = c_pship.
fs_partner-partn_numb = w_pship.
APPEND fs_partner TO t_partner.
fs_partner-partn_role = c_psold.
fs_partner-partn_numb = w_psold.
APPEND fs_partner TO t_partner.
loop at t_mdata into fs_mdata.
fs_item-itm_number = fs_mdata-posnr.
fs_itemx-itm_number = c_flag.
fs_item-material = fs_mdata-matnr.
fs_itemx-material = c_flag.
fs_item-target_qty = fs_mdata-kwmeng.
fs_itemx-target_qty = c_flag.
fs_item-item_categ = fs_mdata-pstyv.
fs_itemx-item_categ = c_flag.
fs_itemx-updateflag = c_flag.
APPEND fs_item TO t_item.
APPEND fs_itemx TO t_itemx.
fs_sline-ITM_NUMBER = fs_mdata-posnr.
fs_slinex-ITM_NUMBER = c_flag.
fs_sline-SCHED_LINE = c_sline.
fs_slinex-SCHED_LINE = c_flag.
fs_sline-REQ_QTY = fs_mdata-kwmeng.
fs_slinex-REQ_QTY = c_flag.
APPEND fs_sline TO t_sline.
APPEND fs_slinex TO t_slinex.
endloop. " Loop t_mdata
ENDFORM. " data_fill
* FORM CREATE_SO *
* This subroutine calls a BAPI BAPI_SALESDOCU_CREATEFROMDATA1 for *
* creating a sales document. *
* There are no interface parameters to be passed to this subroutine. *
FORM create_so .
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = fs_sorder
sales_header_inx = fs_sorderx
IMPORTING
salesdocument_ex = w_sonum
TABLES
return = t_return
sales_items_in = t_item
sales_items_inx = t_itemx
sales_partners = t_partner
sales_schedules_in = t_sline
sales_schedules_inx = t_slinex.
ENDFORM. " create_SO
Hope this helps. -
Sale order item text through BAPI_SALESORDER_CREATEFROMDAT2
Hi,
We are creating a sale order through a 'Zprogram'. Uploading the required details from a excel sheet and passing to a BAPI_SALESORDER_CREATEFROMDAT2.
We are using the 'order_text' parameter to create the item text. If there are multiple lines in the same item text likes this
(we are passing it in a single line)
Order type ORDER_ID PO number u2026u2026 Item Note - Zi01
STD 2 10 Currency - RS
Test order -1
Test item - 2
It is creating the sale order with the item text and the item text when viewed normally its appears one below one. But if we click the 'detail' button and view it through the editor mode it is appearing in the same line with # characters in between.
TAX_CURRENCY = Rupees #TAX_UNIT_PRICE =0.0000# Test order = 1
It is replacing the enter statement with '#.' We can split the text where # appears and pass it as a separate line .but this will create a problem when the data itself contains a # character.
Please advise how we can avoid this and can create the sale order item text correctly.
Regards,
Charumathi BalachandranAs you said, How are creating single line text from the multi line text.
I hope you are using a CONTACTENATE statemetn to do so. Please the SEPARATOR being used for this.
I hope you have copied texts from excel sheet to SE38 editor. Please copy text from Excel to Notepad, then Notepad to SE38.
Edited by: Priyanka Chowdry on Dec 20, 2010 11:21 AM -
Not able to create sales order using BAPI - BAPI_SALESORDER_CREATEFROMDAT2
Hi Experts,
I am not able to create sales order . I am using BAPI - BAPI_SALESORDER_CREATEFROMDAT2
to create sales order .I am passing external sales order number to the parameter
SALESDOCUMENTIN.
I am getting following error.
"524 |Only quantity 1 EA is allowed (Item 00001"
Here EA is UOM(Unit of measurement).
Below is the sample program through which i am trying to create the sales order.
*& Report ZSDC_SALES_TEST
report zsdc_sales_test.
*DATA: wa_bapi_header TYPE bapisdhd1.
Include Name - ZSDC_SALES_ORD_UPLOAD_TOP
Program Name - ZSDC_SALES_ORD_UPLOAD_1393
Program Title - Include for Data Declaration and selection screen
Created by - Lalitha W
Created on - 18-Nov-2008
Object ID - SD_C_1393_SALES_ORDER_UPLOAD
Request Id - SD3K905579
Description - This is a common INCLUDE for data declarations and
*selection screen details.
HISTORY
Date |Developer |Req by | Description |Reference ID
| | | |
| | | |
TYPE-POOLS
*TYPE-POOLS: truxs, abap, slis.
TABLES
*TABLES: t100.
TYPES
types:begin of ty_header,
auart(4) type c, " Sales Order Type
vkorg(4) type c, " Sales Organization
vtweg(2) type c, " Distrubution Channel
spart(2) type c, " Division
kunnr_1(10) type c, " Sold to Party
kunnr_2(10) type c, " Ship to Party
augru(3) type c, " Order Reason
bstkd(35) type c, " PO Number
bstdk(10) type c, " PO Date
ketdat(10) type c, " Required Delivery Date
zterm(4) type c, " Payment Terms
inco1(3) type c, " Inco Terms -1
inco2(28) type c, " Inco Terms -2
prsdt(10) type c, " pricing date
waerk(5) type c, " Document Currency
vkbur(4) type c, " Sales Office
vkgrp(3) type c, " Sales group
pltyp(2) type c, " Price List type
kdgrp(2) type c, " Customer Group
bstkd_e(35) type c, " Ship-to-party PO number
submi(10) type c, " Collective Number
bname(35) type c, " Name
ihrez(12) type c, " Your Reference
kschl_1(4) type c, " Condition Type
kbetr_1(11) type c, " Amount
kschl_2(4) type c, " Condition Type
kbetr_2(11) type c, " Amount
kschl_3(4) type c, " Condition Type
kbetr_3(11) type c, " Amount
partner_1(25) TYPE c, " Partner(Bill To Party Number)
partner_2(25) TYPE c, " Partner(Payer Number)
partner_3(25) TYPE c, " Partner(Sales Responsible Number)
partner_4(25) TYPE c, " Partner(Order admin)
partner_5(25) TYPE c, " Partner(Contact person)
partner_1(10) type c, " Partner(Bill To Party Number)
partner_2(10) type c, " Partner(Payer Number)
partner_3(10) type c, " Partner(Sales Responsible Number)
partner_4(10) type c, " Partner(Order admin)
partner_5(10) type c, " Partner(Contact person)
tdspras_1(2) type c,
text_1(500) type c, " Text Before Items Z012
tdspras_2(2) type c,
text_2(500) type c, " Invocie Up Z034
tdspras_3(2) type c,
text_3(500) type c, " Invocie Down Z035
tdspras_4(2) type c,
text_4(500) type c, " Customer Reference Continue Z018
tdspras_5(2) type c,
text_5(500) type c, " Dispatch Marks/ Order Z019
tdspras_6(2) type c,
text_6(500) type c, " Ordered By Z003
tdspras_7(2) type c,
text_7(500) type c, " Sales Parameters Z002
kvgr1(3) type c, " Industry
kvgr2(3) type c, " customer BU
end of ty_header.
types: begin of ty_item,
bstkd(35) type c, " PO Number
bstdk(10) type c, " PO Date
bstkd_e(35) type c, " Ship-to-party PO number
posnr(6) type c, " POSTION NUMBER
matnr(18) type c, " Material Number
kwmeng(18) type c, " Order Quantity
pstyv(4) type c, " Sales doc. item categ
kursk(18) type c, " EXCHANGE RATE****
ffprf(8) type c, " DIP PROFILE
werks(4) type c, " Delivering Plant
vstel(4) type c, " SHIPPING POINT
lgort(4) type c, " STORAGE LOCATION
route(6) type c, " Route
kurrf(18) type c, " EXCHANGE RATE-FI
ntgew(18) type c, " Net Weight
brgew(18) type c, " Gross Weight
gewei(3) type c, " Weight Unit
prctr(10) type c, " profit center
abgrs(6) type c, " RESULT ANALYSIS KEY
kalsm_k(4) type c, " COSTING SHEET
kschl_1(4) type c, " Condition Type
kbetr_1(11) type c, " Amount
kschl_2(4) type c, " Condition Type
kbetr_2(11) type c, " Amount
kschl_3(4) type c, " Condition Type
kbetr_3(11) type c, " Amount
text_1(500) type c, " material Text 0001
tdspras_1(1) type c,
text_2(500) type c, " Pr Text 9001
tdspras_2(1) type c,
end of ty_item.
types: begin of ty_schedule_line,
bstkd(35) type c, "PO number
bstdk(10) type c, "PO date
bstkd_e(35) type c, "Ship-to-party PO number
posnr(6) type c, "sales doc.Item
etdat(10) type c, "Schedule line date
wmeng(2) type c, "Order Quantity
end of ty_schedule_line.
types: begin of ty_err ,
auart(4) type c, " Sales Order Type
vkorg(4) type c, " Sales Organization
vtweg(2) type c, " Distrubution Channel
spart(2) type c, " Division
kunnr_1(10) type c, " Sold to Party
kunnr_2(10) type c, " Ship to Party
augru(3) type c, " Order Reason
bstkd(35) type c, " PO Number
bstdk(10) type c, " PO Date
ketdat(10) type c, " Required Delivery Date
zterm(4) type c, " Payment Terms
inco1(3) type c, " Inco Terms -1
inco2(28) type c, " Inco Terms -2
prsdt(10) type c, " pricing date
waerk(5) type c, " Document Currency
vkbur(2) type c, " Sales Office
vkgrp(3) type c, " Sales group
pltyp(2) type c, " Price List type
kdgrp(2) type c, " Customer Group
bstkd_e(35) type c, " Ship-to-party PO number
submi(10) type c, " Collective Number
bname(35) type c, " Name
ihrez(12) type c, " Your Reference
kschl_1(4) type c, " Condition Type
kbetr_1(11) type c, " Amount
kschl_2(4) type c, " Condition Type
kbetr_2(11) type c, " Amount
kschl_3(4) type c, " Condition Type
kbetr_3(11) type c, " Amount
partner_1(25) type c, " Partner(Bill To Party Number)
partner_2(25) type c, " Partner(Payer Number)
partner_3(25) type c, " Partner(Sales Responsible Number)
partner_4(25) type c, " Partner(Order admin)
partner_5(25) type c, " Partner(Contact person)
tdspras_1(2) type c,
text_1(500) type c, " Text Before Items Z012
tdspras_2(2) type c,
text_2(500) type c, " Invocie Up Z034
tdspras_3(2) type c,
text_3(500) type c, " Invocie Down Z035
tdspras_4(2) type c,
text_4(500) type c, " Customer Reference Continue Z018
tdspras_5(2) type c,
text_5(500) type c, " Dispatch Marks/ Order Z019
tdspras_6(2) type c,
text_6(500) type c, " Ordered By Z003
tdspras_7(2) type c,
text_7(500) type c, " Sales Parameters Z002
kvgr1(3) type c, " Industry
kvgr2(3) type c, " customer BU
message(600) type c,
end of ty_err.
types: begin of ty_t685a,
kschl type kschl,
krech type krech,
end of ty_t685a.
INTERNAL TABLES
***header
data: g_krech_1(4) type c, " Calculation type for condition
g_krech_2(4) type c, " Calculation type for condition
g_krech_3(4) type c. " Calculation type for condition
g_krech_4(4) TYPE c, " Calculation type for condition
g_krech_5(4) TYPE c, " Calculation type for condition
g_krech_6(4) TYPE c, " Calculation type for condition
g_krech_7(4) TYPE c, " Calculation type for condition
g_krech_8(4) TYPE c, " Calculation type for condition
g_krech_9(4) TYPE c, " Calculation type for condition
g_krech_10(4) TYPE c, " Calculation type for condition
g_krech_11(4) TYPE c, " Calculation type for condition
g_krech_12(4) TYPE c, " Calculation type for condition
g_krech_13(4) TYPE c, " Calculation type for condition
g_krech_14(4) TYPE c, " Calculation type for condition
g_krech_15(4) TYPE c, " Calculation type for condition
g_krech_16(4) TYPE c, " Calculation type for condition
g_krech_17(4) TYPE c, " Calculation type for condition
g_krech_18(4) TYPE c, " Calculation type for condition
g_krech_19(4) TYPE c, " Calculation type for condition
g_krech_20(4) TYPE c. " Calculation type for condition
Items
data: g_krech_item_1(4) type c, " Calculation type for condition
g_krech_item_2(4) type c, " Calculation type for condition
g_krech_item_3(4) type c. " Calculation type for condition
g_krech_item_4(4) TYPE c, " Calculation type for condition
g_krech_item_5(4) TYPE c, " Calculation type for condition
g_krech_item_6(4) TYPE c, " Calculation type for condition
g_krech_item_7(4) TYPE c, " Calculation type for condition
g_krech_item_8(4) TYPE c, " Calculation type for condition
g_krech_item_9(4) TYPE c, " Calculation type for condition
g_krech_item_10(4) TYPE c, " Calculation type for condition
g_krech_item_11(4) TYPE c, " Calculation type for condition
g_krech_item_12(4) TYPE c, " Calculation type for condition
g_krech_item_13(4) TYPE c, " Calculation type for condition
g_krech_item_14(4) TYPE c, " Calculation type for condition
g_krech_item_15(4) TYPE c, " Calculation type for condition
g_krech_item_16(4) TYPE c. " Calculation type for condition
data: it_t685a type standard table of ty_t685a.
data: wa_bapi_header type bapisdhd1,
wa_bapi_headerx TYPE bapisdhd1x,
it_bapi_item type table of bapisditm,
it_bapi_itemx TYPE TABLE OF bapisditmx,
it_bapi_cond type table of bapicond,
it_bapi_condx TYPE TABLE OF bapicondx,
it_bapi_partner type table of bapiparnr,
it_bapi_shdl type table of bapischdl,
it_bapi_shdlx TYPE TABLE OF bapischdlx,
it_bapi_order_text type TABLE OF BAPISDTEXT,
it_bapireturn type table of bapiret2.
data: wa_bapi_item like line of it_bapi_item,
wa_bapi_itemx LIKE LINE OF it_bapi_itemx,
wa_bapi_cond like line of it_bapi_cond,
wa_bapi_condx LIKE LINE OF it_bapi_condx,
wa_bapi_partner like line of it_bapi_partner,
wa_bapi_shdl like line of it_bapi_shdl,
wa_bapi_shdlx LIKE LINE OF it_bapi_shdlx,
wa_bapi_order_text like LINE OF it_bapi_order_text,
wa_bapireturn like line of it_bapireturn.
*DATA: zmode(1) VALUE 'N'.
data: it_header type standard table of ty_header.
*DATA: it_temp_header TYPE STANDARD TABLE OF ty_header.
data: it_item type standard table of ty_item.
*DATA: it_temp_item TYPE STANDARD TABLE OF ty_item.
data: it_err type standard table of ty_err.
data: it_fline1 type standard table of tline,
wa_fline1 type tline.
data: it_thead1 type thead.
data: it_fline2 type standard table of tline,
wa_fline2 type tline.
data: it_thead2 type thead.
data: it_fline3 type standard table of tline,
wa_fline3 type tline.
data: it_thead3 type thead.
data: it_fline4 type standard table of tline,
wa_fline4 type tline.
data: it_thead4 type thead.
data: it_fline5 type standard table of tline,
wa_fline5 type tline.
data: it_thead5 type thead.
data: wa_header like line of it_header,
wa_item like line of it_item,
wa_err type ty_err,
wa_bill LIKE LINE OF it_bill,
wa_bill1 LIKE LINE OF it_bill,
wa_iterr like line of it_err,
wa_t685a like line of it_t685a.
wa_bill_item TYPE ty_bill_item.
data: it_schedule_line type standard table of ty_schedule_line,
wa_schedule_line type ty_schedule_line.
data: sales_order_no type bapivbeln-vbeln.
data: ext_sales_order_no type bapivbeln-vbeln.
Variable to be used to separate the fields which are concatenated by a
runtime character
*DATA: g_tabchar(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
*DATA: wa_truxs_t_text_data TYPE truxs_t_text_data.
*DATA: g_filename TYPE string,
g_path TYPE string,
g_fullpath TYPE string,
g_user_action TYPE i,
g_file_encoding TYPE abap_encoding.
*DATA : g_text(8192),
data : g_mstring1(100) type c,
g_mstring2(100) type c,
g_mstring3(100) type c,
g_mstring4(100) type c,
g_mstring5(100) type c.
data: g_count1 type ebelp,
g_str_count1(6) type c.
data: g_count type ebelp,
g_str_count(6) type c.
*DATA: f_subrc LIKE sy-subrc,
f_subrc1 LIKE sy-subrc,
f_error(500) TYPE c,
item1(27) TYPE c,
item2(27) TYPE c,
item3(27) TYPE c,
item4(27) TYPE c,
i TYPE ekpo-ebelp.
*DATA: g_billplan_header TYPE c,
g_billplan_item TYPE c.
data : g_external_so type vbak-vbeln. "SO
SELECTION-SCREEN
selection-screen begin of block frame1 with frame title text-001 .
parameters:p_file1 type rlgrap-filename, "OBLIGATORY, "Header data.
p_file2 type rlgrap-filename, "OBLIGATORY, "Item Data.
p_file3 type rlgrap-filename, "Schedule line.
p_file4 type rlgrap-filename ."OBLIGATORY. "Error file.
selection-screen end of block frame1.
start-of-selection.
wa_bapi_header-doc_type = 'Z0MX'. "order type
wa_bapi_header-sales_org = '0130'."sales org
wa_bapi_header-distr_chan = '13'. "distr channel
wa_bapi_header-division = '13'. "division
Old code from copied program
wa_bapi_header-purch_no_s = wa_header-kunnr_2. " Ship to party
New code as required in Finland project
We are using to Header ->Order Tab -> Ship to Party -> Purchase order no (BSTKD_E) to store Old legacy SO number
wa_bapi_header-purch_no_s = 'MX100443'. "External SO i.e Old legacey SO number
wa_bapi_header-ref_1_s = '0000666666'. "Sold to party
wa_bapi_header-ord_reason = wa_header-augru.
wa_bapi_header-purch_no_c = 'ddr1234'. " PO number
wa_bapi_header-purch_date = sy-datum. " PO date
wa_bapi_header-req_date_h = sy-datum. " Required Delivery Date
wa_bapi_header-pmnttrms = '01'. " Payment Terms
wa_bapi_header-incoterms1 = wa_header-inco1.
wa_bapi_header-incoterms2 = wa_header-inco2.
wa_bapi_header-price_date = wa_header-prsdt. " Pricing date
wa_bapi_header-currency = wa_header-waerk. " Document Currency
wa_bapi_header-sales_grp = wa_header-vkgrp. " Sales group
wa_bapi_header-price_list = wa_header-pltyp. " Price list type
wa_bapi_header-cust_group = wa_header-kdgrp. " Cust Group
wa_bapi_header-ship_type = wa_header-vsart. " Shipping Type
wa_bapi_header-purch_no_s = wa_header-bstkd_e. " Ship-to-party po number
wa_bapi_header-collect_no = wa_header-submi. " Collective No.
wa_bapi_header-name = wa_header-bname. " Name
wa_bapi_header-ref_1 = wa_header-ihrez. " Your Reference
wa_bapi_header-cust_grp1 = wa_header-kvgr1. " Industry
wa_bapi_header-cust_grp2 = wa_header-kvgr2. " Customer BU
*ENDFORM. " f_header
IF wa_header-partner_1 IS NOT INITIAL.
wa_bapi_partner-partn_role = 'AG'.
wa_bapi_partner-partn_numb = '0000666666'.
wa_bapi_partner-itm_number = '000000'.
append wa_bapi_partner to it_bapi_partner.
clear wa_bapi_partner.
ENDIF.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = wa_header-partner_2
importing
output = wa_header-partner_2.
IF wa_header-partner_2 IS NOT INITIAL.
wa_bapi_partner-partn_role = 'WE'.
wa_bapi_partner-partn_numb = '0000666666'.
wa_bapi_partner-itm_number = '000000'.
append wa_bapi_partner to it_bapi_partner.
clear wa_bapi_partner.
ENDIF.
perform f_item.
data : order_items_inx type table of bapisditmx with header line.
order_items_inx-material = 'X'. "
order_items_inx-target_qty = 'X'. "
order_items_inx-comp_quant = 'X'. "
order_items_inx-trgqty_den = 'X'.
order_items_inx-rnddlv_qty = 'X'.
order_items_inx-updateflag = 'I'.
order_items_inx-target_qu = 'X'.
order_items_inx-plant = 'X'. "
append order_items_inx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
salesdocumentin = 'MX11111152'
order_header_in = wa_bapi_header
order_header_inx = wa_bapi_headerx
importing
salesdocument = sales_order_no
tables
return = it_bapireturn
order_items_in = it_bapi_item
order_items_inx = order_items_inx
order_partners = it_bapi_partner
order_conditions_in = it_bapi_cond.
if sy-subrc is initial.
commit work.
endif.
*& Form f_item
text
form f_item .
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = wa_item-posnr
importing
output = wa_item-posnr.
wa_item-posnr = '000010'.
IF sy-subrc EQ 0. "IS INITIAL.
move wa_item-posnr to g_str_count."commented out by shakti
ENDIF.
wa_bapi_item-itm_number = wa_item-posnr. " Line item
WA_BAPI_ITEM-PO_ITM_NO = WA_ITEM-EBELP.
wa_bapi_item-division = wa_item-spart.
wa_bapi_item-purch_no_c = 'ddr1234'. " po number
wa_bapi_item-purch_date = sy-datum. " po date
wa_bapi_item-purch_no_s = 'MX11111112'. " Ship-to-party po number
wa_item-matnr = 'MAXIMO_SERVICE'.
call function 'CONVERSION_EXIT_MATN1_INPUT'
exporting
input = wa_item-matnr
importing
output = wa_item-matnr
exceptions
length_error = 1
others = 2.
if sy-subrc is initial.
wa_bapi_item-material = wa_item-matnr. "material
endif.
wa_bapi_item-target_qty = '1'. " Order qty
wa_bapi_item-comp_quant = '1'.
wa_bapi_item-target_qu = 'EA'.
wa_bapi_item-fixed_quan = '1'.
wa_bapi_item-comp_quant = wa_item-kwmeng.
wa_bapi_item-trgqty_den = '1'.
wa_bapi_item-rnddlv_qty = wa_item-kwmeng.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_item-ps_psp_pnr
IMPORTING
output = wa_item-ps_psp_pnr.
IF sy-subrc = 0.
wa_bapi_item-wbs_elem = wa_item-ps_psp_pnr.
ENDIF.
wa_bapi_item-item_categ = 'ZMAX'.
wa_bapi_item-ex_rate_fi = wa_item-kurrf.
wa_bapi_item-dli_profil = wa_item-ffprf. " Dynamic item processor profile
wa_bapi_item-route = wa_item-route. " route
wa_bapi_item-exchg_rate = wa_item-kursk.
wa_bapi_item-plant = '2090'. " Plant
wa_bapi_item-ship_point = 'FN11'. " Shipping point
wa_bapi_item-store_loc = wa_item-lgort. " stg loc
REPLACE ALL OCCURRENCES OF ',' IN wa_item-ntgew WITH '.'.
REPLACE ALL OCCURRENCES OF ',' IN wa_item-brgew WITH '.'.
wa_bapi_item-net_weight = wa_item-ntgew. "
wa_bapi_item-gross_wght = wa_item-brgew. "
call function 'CONVERSION_EXIT_CUNIT_INPUT'
exporting
input = wa_item-gewei
language = sy-langu
importing
output = wa_item-gewei.
EXCEPTIONS
unit_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
wa_bapi_item-untof_wght = 'KG'. " weight unit
replace all occurrences of ',' in wa_item-kursk with '.'.
replace all occurrences of ',' in wa_item-kurrf with '.'.
wa_bapi_item-profit_ctr = wa_item-prctr. " Profit center
wa_bapi_item-resanalkey = wa_item-abgrs. " RESULT ANALYSIS KEY
wa_bapi_item-cstg_sheet = wa_item-kalsm_k. " COSTING SHEET
append wa_bapi_item to it_bapi_item.
endform. " f_item
Thanks & regards,
Chetansee the following to create sales order:-
*& Report ZSALESORDER
*&DEVELOPED BY JANI KRUPA 4.10.2008
REPORT ZSALESORDER.
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 .
SELECTION-SCREEN END OF LINE.
Complete Deliver
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(20) v_text10 FOR FIELD p_autlf.
PARAMETERS: p_autlf TYPE autlf DEFAULT 'X'.
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.
DATA: lt_schedules_ink TYPE STANDARD TABLE OF bapisdhead1
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'.
v_text10 = 'Complete delivery'.
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'.
*Complete delivery
header-COMPL_DLV = p_autlf.
header-COMPL_DLV = 'X'.
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'.
item category
itemx-ITEM_CATEG = 'X'.
APPEND item.
APPEND itemx.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000020'.
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.
Fill schedule lines
lt_schedules_in-itm_number = '000020'.
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 = '000020'.
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. -
Clear WBS field in sales order using bapi_salesorder_createfromdat2.
Hi,
Situation is this, I have a sales order, where the WBS element in the line item is populated. I want to clear that field to blank and save the sales order.
When I try to do that using the bapi_salesorder_createfromdat2, it says that it is successful, but when I go back to the sales order and see that field is still populated and not cleared. But the same field if I clear it through VA02 it works fine.
Header level update flag is set as 'U'.
I have tried setting up 'D' 'U' and 'I' for the update flag for the line item. Still no luck.
Given below is the sample code, did anybody else also faced the same issue.
Data Section.
data : sal_t_in type standard table of BAPISDHD1,
sal_s_in like line of sal_t_in.
*data : sal_t_in type standard table of BAPISDH1,
* sal_s_in like line of sal_t_in.
data : ret_t type standard table of bapiret2,
ret_s like line of ret_t.
data : partner_t type standard table of bapiparnr,
partner_s like line of partner_t.
data : item_t type standard table of bapisditm,
item_s like line of item_t.
data : item_t_inx type standard table of BAPISDITMX,
item_s_inx like line of item_t_inx.
data : schdl_t type standard table of BAPISCHDL,
schdl_s like line of schdl_t.
data : schdl_t_inx type standard table of BAPISCHDLX,
schdl_s_inx like line of schdl_t_inx.
data : ord_view type order_view.
data : sal_t_key type standard table of sales_key,
sal_s_key like line of sal_t_key.
data : ord_t_hdr type standard table of bapisdhd,
ord_s_hdr like line of ord_t_hdr.
data : ord_t_itm type standard table of bapisdit,
ord_s_itm like line of ord_t_itm.
data : hdr_inx type BAPISDHD1X.
data : hdr2_inx type BAPISDH1X.
data : qty type DZMENG.
data : logic_switch type BAPISDLS.
data : sd_doc_out type BAPIVBELN-VBELN.
data : sd_hdr_out type BAPISDHD.
data : sd_hdr_stat type BAPISDHDST.
Logic Section.
sal_s_in-doc_type = 'ZOR'.
hdr_inx-updateflag = 'U'.
ord_view-header = 'X'.
ord_view-item = 'X'.
sal_s_key-vbeln = '0000001067'.
append sal_s_key to sal_t_key.
call function 'BAPISDORDER_GETDETAILEDLIST'
exporting
i_bapi_view = ord_view
* I_MEMORY_READ =
tables
sales_documents = sal_t_key
ORDER_HEADERS_OUT = ord_t_hdr
ORDER_ITEMS_OUT = ord_t_itm
* ORDER_SCHEDULES_OUT =
* ORDER_BUSINESS_OUT =
* ORDER_PARTNERS_OUT =
* ORDER_ADDRESS_OUT =
* ORDER_STATUSHEADERS_OUT =
* ORDER_STATUSITEMS_OUT =
* ORDER_CONDITIONS_OUT =
* ORDER_COND_HEAD =
* ORDER_COND_ITEM =
* ORDER_COND_QTY_SCALE =
* ORDER_COND_VAL_SCALE =
* ORDER_CONTRACTS_OUT =
* ORDER_TEXTHEADERS_OUT =
* ORDER_TEXTLINES_OUT =
* ORDER_FLOWS_OUT =
* ORDER_CFGS_CUREFS_OUT =
* ORDER_CFGS_CUCFGS_OUT =
* ORDER_CFGS_CUINS_OUT =
* ORDER_CFGS_CUPRTS_OUT =
* ORDER_CFGS_CUVALS_OUT =
* ORDER_CFGS_CUBLBS_OUT =
* ORDER_CFGS_CUVKS_OUT =
* ORDER_BILLINGPLANS_OUT =
* ORDER_BILLINGDATES_OUT =
* ORDER_CREDITCARDS_OUT =
* EXTENSIONOUT =
loop at ord_t_itm into ord_s_itm.
move-corresponding ord_s_itm to item_s.
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = item_s-WBS_ELEM
IMPORTING
OUTPUT = item_s-WBS_ELEM
*move space to item_s-WBS_ELEM.
append item_s to item_t.
endloop.
clear item_s_inx.
item_s_inx-updateflag = 'D'.
item_s_inx-wbs_elem = 'X'.
append item_s_inx to item_t_inx.
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
SALESDOCUMENTIN = '0000001067'
order_header_in = sal_s_in
ORDER_HEADER_INX = hdr_inx
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* TESTRUN =
* CONVERT = ' '
* IMPORTING
* SALESDOCUMENT =
tables
RETURN = ret_t
ORDER_ITEMS_IN = item_t
ORDER_ITEMS_INX = item_t_inx
order_partners = partner_t
* ORDER_SCHEDULES_IN =
* ORDER_SCHEDULES_INX =
* ORDER_CONDITIONS_IN =
* ORDER_CONDITIONS_INX =
* 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 =
call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
Result I get when I execute is
S V4 233 SALES_HEADER_IN has been processed successfully VBAKKOM
S V4 233 SALES_ITEM_IN has been processed successfully VBAPKOM 000001
S V1 311 Standard order 1067 has been saved Standard order 1067
Which means it says it save successfully..but data is not changed.
Any Ideas??
Thanks and Regards,
Mahesh.Hi,
The problem is fixed. The item inx table I was not passing the item number field, so the bapi was not knowing which line item to update.
It was a stupid overlook on my part.
Thanks and Regards,
Mahesh. -
Order schedule lines not created using BAPI_SALESORDER_CREATEFROMDAT2
Hi experts,
I am creating sales order using BAPI_SALESORDER_CREATEFROMDAT2. I want to update the Order quantity in VBAP-KWMENG.I got the information from SDN when including the Schedule line in BAPI 'BAPI_SALESORDER_CREATEFROMDAT2 '.
I tried by using Update flag = 'I'.I am not able to update, what are the values to be passed and how to update the field.
Is there any other way..Please suggest me..
Thanks&Regards,
Karthik.Hi, In the BAPI if you look at the tables parameter you will find ORDER_ITEMS_IN and ORDER_ITEMS_INX as well as ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX. To update KWMENG you will have to pass that value to ORDER_ITEMS_IN-TARGET_QTY and update the same in the table ORDER_ITEMS_INX (ORDER_ITEMS_INX-TARGET_QTY) with 'X'.
For updating schedule line go for ORDER_SCHEDULES_IN-SCHED_LINE and update X for the same in ORDER_SCHEDULES_INX.
Try looking into the following code, I am filling in both the Item data as well as the Schedule line data.
loop at t_mdata into fs_mdata.
fs_item-itm_number = fs_mdata-posnr.
fs_itemx-itm_number = c_flag.
fs_item-material = fs_mdata-matnr.
fs_itemx-material = c_flag.
fs_item-target_qty = fs_mdata-kwmeng.
fs_itemx-target_qty = c_flag.
fs_item-item_categ = fs_mdata-pstyv.
fs_itemx-item_categ = c_flag.
fs_itemx-updateflag = c_flag.
APPEND fs_item TO t_item.
APPEND fs_itemx TO t_itemx.
fs_sline-ITM_NUMBER = fs_mdata-posnr.
fs_slinex-ITM_NUMBER = c_flag.
fs_sline-SCHED_LINE = c_sline.
fs_slinex-SCHED_LINE = c_flag.
fs_sline-REQ_QTY = fs_mdata-kwmeng.
fs_slinex-REQ_QTY = c_flag.
APPEND fs_sline TO t_sline.
APPEND fs_slinex TO t_slinex.
endloop. " Loop t_mdata
c_flag contains 'X'.
fs_item is of structure ORDER_ITEMS_IN.
fs_sline is of structure ORDER_SCHEDULES_IN. -
Quantity is not updating while using BAPI_SALESORDER_CREATEFROMDAT2
Hi all,
i am Creating Sales Order using BAPI_SALESORDER_CREATEFROMDAT2 BAPI,
Here i am passing all required fields. Sales order also created, but in the created order; quantiy value is updating as 0 only. Even though i passed the value.(BAPISDITM-ARGET_QTY)
My bapi is returning...
SALES_HEADER_IN has been processed successfully
SALES_ITEM_IN has been processed successfully
The sales document is not yet complete: Edit data
Standard Order 12323 has been saved
Help me to solve it.
Thanks
RegardsYou cannot update quantinty from that field
use the REQ_QTY field in ORDER_SCHEDULES_IN
and set its corresponding flag in ORDER_SCHEDULES_INX to X
It will work -
How to gen Schedule line automatical.y by BAPI_SALESORDER_CREATEFROMDAT2
Dears,
I am using BAPI_SALESORDER_CREATEFROMDAT2 to create Sales Order,
everything goes on well, but the only problem is i have to input the schedule line myself by providing the SCHEDULE_LINES& SCHEDULE_LINESX parameter.
Just wondering...is there any way to let
BAPI_SALESORDER_CREATEFROMDAT2 create schedule line automatically,
just like what we do in frontend, after we input the order quantity in line item , the
schedule line will be generated automatically...Hello,
You can use FM: BAPI_SALESORDER_CHANGE with update indicator I (insert)
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = l_vbeln
order_header_inx = l_wa_order_header_inx
simulation = l_simulation
tables
return = l_i_return
order_item_in = l_i_order_item
order_item_inx = l_i_order_item_inx
partners = l_i_partners
schedule_lines = l_i_schedule_lines
schedule_linesx = l_i_schedule_linesx
extensionin = l_i_extensionin.
Thanks
Subhankar -
Error while creating a sales order BAPI_SALESORDER_CREATEFROMDAT2
Hi All,
I am using the BAPI BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order.
I am passing all the required fields and also the rejection code at the item level.
Also I am using a variant configuration material and hence ai am filling the VC config tables.
When I execute this BAPI it is giving me the error 'Item 000010's configuration can no longer be changed' although configuration is maintained for this material.
When I try the same case with no rejection code and with VC configuration, the sales order is created.
When I try the same case again with rejection code and NO VC configuration, the sales order is created.
When I maintain both the rejection code and VC configuration I am getting the error.
Does anyone have any idea what is causing this error or I am supposed to populate any flag in ORDER_ITEMS_INX to get this correctly.
Any answers will be greatly apppreciated!
Thanks
SandeepSandeep,
There are a few SAP Notes that you should investigate, some of which you may have already seen. First, I'd suggest you look at [Note 481102|https://service.sap.com/sap/support/notes/481102] and its three related Notes: [774346|https://service.sap.com/sap/support/notes/774346], [550431|https://service.sap.com/sap/support/notes/550431], [366265|https://service.sap.com/sap/support/notes/366265].
If these Notes do not help then check if [Note 1099414|https://service.sap.com/sap/support/notes/1099414] has been applied in your system. If it has been applied, then [Note 1116144|https://service.sap.com/sap/support/notes/1116144] might solve your issue. If neither of these two notes are applied, then it could be that they both need to be applied. However, if both notes are already applied, then you may want to consider opening a customer message with SAP. Since these two SAP Notes are relatively new, it makes me think that you might have discovered a related error that has not been reported to SAP yet.
Best Regards,
Jamie -
BAPI_SALESORDER_CREATEFROMDAT2 & Confirmed Qty NOT being set
Good day!
Creating orders via BAPI_SALESORDER_CREATEFROMDAT2. Orders are being created successfully. However, CONFIRMED QTY is set to 0, and NOT triggering.
The following settings have been confirmed.
- Majority of all communication field settings are set to "X" at Header, Item, schedule, and condition.
- All itm_number are set accordingly to respective posnr
- All updateflag are set accordingly
- Set comp_dlv and part_dlv to ' '.
From a functional perspective, what configurations HAVE to be completed to ensure Deliveries are triggered via respective BAPI? I understand, availability check is performed in background so screens cannot be performed--thus, no partial or full delivery can be filled.
Any pointers will be appreciative. Thanks in advance.I seem to remember having that issue before. I believe the fix in that particular case was that the storage location was not specified in the BAPI call for items that were ATP-relevant. Of course, if your ATP check is at the shipping point level, if you don't specify the shipping point, you won't get a confirmation either. As usual, I believe I tracked it down with the good old debugger.
-
Changing PSTYV in sales order with BAPI_SALESORDER_CREATEFROMDAT2
hi all,
I'm having this trouble...
we are creating a Sales Order from PI calling directly the BAPI_SALESORDER_CREATEFROMDAT2...
but, theres a field than I have to change... the PSTYV must be TANN when the VBAP-NETWR is 0.
I've used the MV45AFZZ program for the exit... but no in the move_field_to_vbap ('cause it doesn't work form me), I used this one:
FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
data: l_tabix type i VALUE 0.
if xvbak-AUART = 'ZCO'.
loop at xvbap.
add 1 to l_tabix.
if xvbap-netwr EQ 0.
xvbap-PSTYV = 'TANN'.
modify xvbap index l_tabix TRANSPORTING pstyv .
endif.
endloop.
endif.
ENDFORM.
and with this, when the sales order is created, my PSTYV field if NETWR = 0, now is TANN.... but this is NOT the solution 'cause I can't make an Invoice... I have an incompletion LOG....
but, if I change the field manually appears a message: New pricing carried out ( Message no. V1209 ).
and with this... I fix the problem.... but, you can see than I need it automatically....
so I think, than with my exit, I'm only changing the PSTYV value, but no all the changes than this need...
thanks in advance...
Regards..Apart from that and also
ORDER_ITEMS_IN-ITEM_CATEG = " Value here
ORDER_ITEMS_INX-ITEM_CATEG = " Value here
a® -
Usage of 'BAPI_SALESORDER_CREATEFROMDAT2' for Sales Order Creation
Dear Friends,
We are using following BAPI for creation of sales order
BAPI_SALESORDER_CREATEFROMDAT2
The sales order is being created by passing data to a program where this BAPI is used.
The order is getting created successfully. We have addtional requirement that Scehdule line number (Length 4) is also to be passed while creation of sales order. We are pushing the external schedule line number in structure ORDER_SCHEDULES_IN & ORDER_SCHEDULES_INX, but still the schedule is not getting updated, even though sales order is created.
Please help.
Regrads,
Dhananjay
Moderator message: please use more descriptive subject lines for your posts.
Edited by: Thomas Zloch on Dec 14, 2010 10:23 AM
Edited by: Dhananjay. on Dec 14, 2010 3:44 PMPlease make a note of the ABAP code
**//////////schedule line Data for SO///////////////
**--Schdule Line Item SCHED_LINE
schedule-itm_number = itemno.
schedulex-itm_number = itemno.
schedule-sched_line = it_edidd-etenr.
schedulex-sched_line = it_edidd-etenr.
schedule-REQ_DATE = sy-datum.
schedulex-REQ_DATE = sy-datum.
****schedule line target quantity.
schedule-req_qty = it_edidd-wmeng.
schedulex-req_qty = 'X'.
append schedule.
clear schedule.
append schedulex.
clear schedulex.
itemno = itemno + 10 . -
Error in sales order creation using BAPI_SALESORDER_CREATEFROMDAT2
Hi all,
Pl look into below code :
Here order is getting created , however ship to party and sold to party shows the same value.
*& Report ZSD_SALEORDCRE
report zsd_saleordcre.
Order header:*
- Order type: OR Important you must use the german code TA*
- Sales org: 1000*
- Distrb. chan.: 10*
- Division: 00*
- Sold to party: 1032*
- Ship to party: 1032*
- Purch order: DG-19970626-3*
Order item:*
- Material: P-100*
- Qty: 1*
data:
Order partners*
li_order_partners type standard table of bapiparnr,
l_order_partners like bapiparnr,
Structures for order header*
l_order_header_in like bapisdhd1,
l_order_header_inx like bapisdhd1x,
Tables for order items*
li_order_items_in type standard table of bapisditm,
l_order_items_in like bapisditm,
li_order_items_inx type standard table of bapisditmx,
l_order_items_inx like bapisditmx,
schedules*
li_order_schedules_in type standard table of bapischdl,
l_order_schedules_in like bapischdl,
li_order_schedules_inx type standard table of bapischdl,
l_order_schedules_inx like bapischdl,
Return table from bapi call*
li_return type standard table of bapiret2,
l_return type bapiret2,
Sales document number*
l_vbeln like bapivbeln-vbeln,
Error flag*
l_errflag(1) type c.
start-of-selection.
Build partner information*
clear l_order_partners.
l_order_partners-partn_role = 'WE'. "Remember German codes !
l_order_partners-partn_numb = '0000000101'.
append l_order_partners to li_order_partners.
l_order_partners-partn_role = 'SP'. "Remember German codes !
l_order_partners-partn_numb = '0000000107'.
append l_order_partners to li_order_partners.
Build order header*
Update flag*
l_order_header_inx-updateflag = 'I'.
Sales document type*
l_order_header_in-doc_type = 'ZOD2'. "Remember German codes !
l_order_header_inx-doc_type = 'X'.
Sales organization*
l_order_header_in-sales_org = '1100'.
l_order_header_inx-sales_org = 'X'.
Distribution channel*
l_order_header_in-distr_chan = '20'.
l_order_header_inx-distr_chan = 'X'.
Division*
l_order_header_in-division = '10'.
l_order_header_inx-division = 'X'.
Purchase order*
l_order_header_in-purch_no_c = 'DG-19970626-300'.
l_order_header_inx-purch_no_c = 'X'.
l_order_header_in-purch_date = '20090817'.
l_order_header_inx-purch_date = 'X'.
Build order item(s) - Only 1 is used in this example*
l_order_items_in-itm_number = '10'.
l_order_items_inx-itm_number = 'X'.
l_order_items_in-material = '29019501AA'.
l_order_items_inx-material = 'X'.
l_order_items_in-plant = 'WH03'.
l_order_items_inx-plant = 'X'.
append l_order_items_in to li_order_items_in.
l_order_items_in-itm_number = '20'.
l_order_items_inx-itm_number = 'X'.
l_order_items_in-material = '29066641'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = l_order_items_in-material
importing
output = l_order_items_in-material.
l_order_items_inx-material = 'X'.
l_order_items_in-plant = 'WH03'.
l_order_items_inx-plant = 'X'.
append l_order_items_in to li_order_items_in.
l_order_items_inx-updateflag = 'I'.
append l_order_items_inx to li_order_items_inx.
l_order_schedules_in-itm_number = '10'.
l_order_schedules_in-req_qty = '10.00'.
append l_order_schedules_in to li_order_schedules_in.
l_order_schedules_in-itm_number = '20'.
l_order_schedules_in-req_qty = '20.00'.
append l_order_schedules_in to li_order_schedules_in.
CALL Bapi*
call function 'BAPI_SALESORDER_CREATEFROMDAT2'
exporting
order_header_in = l_order_header_in
order_header_inx = l_order_header_inx
testrun = ' '
importing
salesdocument = l_vbeln
tables
return = li_return
order_items_in = li_order_items_in
order_items_inx = li_order_items_inx
order_partners = li_order_partners
order_schedules_in = li_order_schedules_in.
order_schedules_inx = li_order_schedules_inx.*
end-of-selection.
Check and write Return table*
clear l_errflag.
write: / 'Sales dcoument: ', l_vbeln.
loop at li_return into l_return.
write: / l_return-type, l_return-message(50).
if l_return-type = 'E'.
l_errflag = 'X'.
endif.
endloop.
No errors - Commit*
if l_errflag is initial.
call function 'BAPI_TRANSACTION_COMMIT'.
endif.
What could be problem ?
Pl help
Regards
NagarajanHi,
Go through this sample code
LOOP AT t_salesorder INTO wa_salesorder.
t_header-sales_org = wa_salesorder-vkorg.
t_header-distr_chan = wa_salesorder-vtweg.
t_header-division = wa_salesorder-spart.
t_header-doc_type = wa_salesorder-auart.
APPEND t_header.
t_headerx-sales_org = 'X'.
t_headerx-distr_chan = 'X'.
t_headerx-division = 'X'.
t_headerx-doc_type = 'X'.
APPEND t_headerx.
t_itemx-material = 'X'.
t_itemx-target_qty = 'X'.
APPEND t_itemx.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_salesorder-kunnr
IMPORTING
output = wa_alpha-kunnr.
wa_partner-partn_role = 'AG'.
wa_partner-partn_numb = wa_alpha-kunnr.
APPEND wa_partner TO t_partner.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_salesorder-kunnr1
IMPORTING
output = wa_alpha-kunnr1.
wa_partner-partn_role = 'WE'.
wa_partner-partn_numb = wa_alpha-kunnr1.
APPEND wa_partner TO t_partner.
wa_item-po_itm_no = wa_salesorder-bstnk.
wa_item-itm_number = wa_salesorder-posnr.
wa_item-material = wa_salesorder-matnr.
wa_item-target_qty = wa_salesorder-kwmeng.
APPEND wa_item TO t_item.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = t_header
order_header_inx = t_headerx
IMPORTING
salesdocument = gv_doc_no
TABLES
return = t_return
order_items_in = t_item[]
order_items_inx = t_itemx
order_partners = t_partner[].
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = t_return.
ENDLOOP.
Please paste only the portion of your code that gives you trouble.
Maybe you are looking for
-
I have just upgraded to iOS7 and when I open my apps some have data saved and some (Eden, Survivalcraft) do not. My son is distraught that all his hard work has gone so does anyone know why this would be and how do I fix it please?
-
How distinguish between downpayment related to a downp. request from a DP
Hi to all, please, I need to find a criteria (usable in validation or substitution ) to dinstinguish a downpayemt (F-48) from a downpayment related to a downpayment request. Any idea or suggestion ? thanks to advance. Andrew
-
Hi All, I have to update one field(Header- User defined) in journal entry using DI API for each and every transaction. I know how to update journal entries using DI API but my issue is under which event i will write my update code when system post Jo
-
Hello, I am trying to convert a grayscale image (pixelBits = 8 numComponents = 1) to an rgb image (pixelBits = 24 numComponents = 3). There are many tutorials to convert RBG to grayscale but not the opposite... Any idea ? Thanks.
-
J2EE Shared Libraries - Multiple Versions
WLP 10.2, Studio 1.1 Below is the list of shared libraries in the wl console. There are multiple versions of some libraries. Does the performance improve if we remove them? beehive-controls-1.0(1.0,1.0) Active Library 1 beehive-controls-1.0-war(1.0,1