2006 Sep 15 3:56 PM
i have written the following code but i dont see any result in the condition_ex.
selection-screen begin of block b1 with frame title text-001.
parameters : p_kunnr like kna1-kunnr,
p_matnr like vbap-matnr,
p_vkorg like vbak-vkorg,
p_vtweg like vbak-vtweg,
p_spart like vbak-spart.
selection-screen end of block b1.
data: doctype(4) value 'OR',
itemno(6) type N value '000010',
quantity(13) type N value '0000000000001',
partnertype like knvp-parvw value 'AG'.
data : order_condition_ex like bapicond occurs 0 with header line.
data: order_header_in like bapisdhead occurs 1 with header line,
order_items_in like bapiitemin occurs 1 with header line,
order_schedule_in like bapischdl occurs 1 with header line,
order_partners like bapipartnr occurs 1 with header line.
order_header_in-doc_type = doctype.
order_header_in-sales_org = p_vkorg.
order_header_in-distr_chan = p_vtweg.
order_header_in-division = p_spart.
order_header_in-purch_date = sy-datum.
append order_header_in.
order_items_in-itm_number = itemno.
order_items_in-material = p_matnr.
order_items_in-req_qty = quantity.
append order_items_in.
order_schedule_in-itm_number = itemno.
order_schedule_in-req_qty = quantity.
append order_schedule_in.
order_schedule_in-req_date = sy-datum.
order_partners-partn_role = partnertype.
order_partners-partn_numb = p_kunnr.
order_partners-itm_number = itemno.
append order_partners.
CALL FUNCTION 'Z_BAPI_SALESORDER_SIMULATE'
EXPORTING
ORDER_HEADER_IN = order_header_in
CONVERT_PARVW_AUART = ' '
DELAY = 0
IMPORTING
SALESDOCUMENT =
ORDER_HEADER_EX =
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
RETURN =
ORDER_HEADER =
TABLES
ORDER_ITEMS_IN = order_items_in
ORDER_PARTNERS = order_partners
ORDER_SCHEDULE_IN = order_schedule_in
ORDER_CONDITIONS_IN =
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CCARD =
ORDER_CCARD_EX =
ORDER_SCHEDULE_EX =
ORDER_CONDITION_EX = order_condition_ex
ORDER_INCOMPLETE =
MESSAGETABLE =
EXTENSIONIN =
PARTNERADDRESSES =
WMDVSX =
WMDVEX =
Z_AVAIL_OUT =
ORDER_SCHEDULE_IN2 =
ORDER_SCHEDULE_EX2 =
ORDER_ITEMS_IN2 =
ORDER_PARTNERS2 =
.
loop at order_condition_ex .
write:/ order_condition_ex.
write: / 'output'.
endloop.
2006 Sep 15 4:01 PM
Hi Priyanka,
To check if the bapi behaved as expected, you should not loop at the order_condition_ex but check the return table.<b>In you case the MESSAGES table</b>
In a normal bapi, areturn table will be there which decribes what has happened .
If this is just simulation, then you cannot find the entries in the database.
If you want to see the changes in the database,then commit the transaction using
bapi_transaction_commit.
Regards,
ravi
Message was edited by: Ravi Kanth Talagana
Hi
Check material existence through table MVKE for sales
area. Nothing specific like existence w.r.t customer.
Kindly confirm the same with your functional consultant.
Kind Regards
Eswar
2006 Sep 15 4:00 PM
hi Priyanka,
<b>loop at order_condition_ex .
*write:/ order_condition_ex. " since it is an internal table
*write: / 'output'.
write : order_condition_ex-field1,
order_condition_ex-field2.
endloop.</b>
2006 Sep 15 4:01 PM
You will need to change your quantity to 0000000001000 to set it to 1. There is an inherent 3 decimal places on the quantity fields.
2006 Sep 15 4:01 PM
Hi Priyanka,
To check if the bapi behaved as expected, you should not loop at the order_condition_ex but check the return table.<b>In you case the MESSAGES table</b>
In a normal bapi, areturn table will be there which decribes what has happened .
If this is just simulation, then you cannot find the entries in the database.
If you want to see the changes in the database,then commit the transaction using
bapi_transaction_commit.
Regards,
ravi
Message was edited by: Ravi Kanth Talagana
2006 Sep 15 6:14 PM
how can we check the 'sold to' customer no for a given material.I am told to give customer no,material no and sales area as input.
2006 Sep 15 6:37 PM
2006 Sep 15 7:04 PM
Hi
Check material existence through table MVKE for sales
area. Nothing specific like existence w.r.t customer.
Kindly confirm the same with your functional consultant.
Kind Regards
Eswar
2006 Sep 15 10:08 PM
i am getting the error document type 'OR' not found in messages table.I have tried to run using the same data in se37 and got the output in order_condition_ex.
selection-screen begin of block b1 with frame title text-001.
parameters : p_kunnr like kna1-kunnr,
p_matnr like vbap-matnr,
p_vkorg like vbak-vkorg,
p_vtweg like vbak-vtweg,
p_spart like vbak-spart.
selection-screen end of block b1.
data: doctype like bapisdhead-doc_type value 'OR',
itemno like bapiitemin-itm_number value '000010',
quantity(13) type N value '0000000000001',
partnertype like knvp-parvw value 'AG'.
data :count type i.
data : begin of order_condition_ex occurs 0.
include structure bapicond.
data: end of order_condition_ex.
data: begin of order_header_in.
include structure bapisdhead.
data: end of order_header_in.
data: begin of order_items_in occurs 1.
include structure bapiitemin.
data: end of order_items_in.
data: begin of order_partners occurs 1.
include structure bapipartnr.
data:end of order_partners.
data: begin of order_schedule_in occurs 1.
include structure bapischdl.
data:end of order_schedule_in.
data: begin of messagetable occurs 0 .
Include structure bapiret2.
data: end of messagetable.
order_header_in-doc_type = doctype.
order_header_in-sales_org = p_vkorg.
order_header_in-distr_chan = p_vtweg.
order_header_in-division = p_spart.
order_header_in-purch_date = sy-datum .
order_header_in-req_date_h = sy-datum.
order_items_in-itm_number = itemno.
order_items_in-material = p_matnr.
order_items_in-req_qty = quantity.
append order_items_in.
order_schedule_in-itm_number = itemno.
order_schedule_in-req_qty = quantity.
append order_schedule_in.
order_schedule_in-req_date = sy-datum.
order_partners-partn_role = partnertype.
order_partners-partn_numb = p_kunnr.
append order_partners.
order_partners-itm_number = itemno.
CALL FUNCTION 'Z_BAPI_SALESORDER_SIMULATE'
EXPORTING
ORDER_HEADER_IN = order_header_in
CONVERT_PARVW_AUART = ' '
DELAY = 0
IMPORTING
SALESDOCUMENT =
ORDER_HEADER_EX =
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
RETURN =
ORDER_HEADER =
TABLES
ORDER_ITEMS_IN = order_items_in
ORDER_PARTNERS = order_partners
ORDER_SCHEDULE_IN = order_schedule_in
ORDER_CONDITIONS_IN =
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CCARD =
ORDER_CCARD_EX =
ORDER_SCHEDULE_EX =
ORDER_CONDITION_EX = order_condition_ex
ORDER_INCOMPLETE =
MESSAGETABLE = messagetable
EXTENSIONIN =
PARTNERADDRESSES =
WMDVSX =
WMDVEX =
Z_AVAIL_OUT =
ORDER_SCHEDULE_IN2 =
ORDER_SCHEDULE_EX2 =
ORDER_ITEMS_IN2 =
ORDER_PARTNERS2 =
I really appreciate if anyone can help me in solving this problem.
2006 Sep 15 11:02 PM
thanks all for your help.Its just a silly mistake.doctype 'OR' is internally stored as 'TA' and i didnt knew that.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |