‎2006 Sep 14 8:03 PM
I am writing a program for using bapi_salesorder_simulate.I have to take the input like customer no,material no,sales area details from user and populate the tables order_header_in,order_items_in,order_partners,order_schedule_in .apart from this i have to take some other data from vbak,vbap,vbpa and vbep.I dont understand how to fill in the internal tables for bapi.I have written code like this but donno how far this is correct.
selection-screen begin of block b1 with frame title text-001.
parameters : kunnr like kna1-kunnr,
matnr like vbap-matnr,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
spart like vbak-spart.
selection-screen end of block b1.
data: order_header_in like bapisdhead occurs 0,
order_items_in like bapiitemin occurs 0,
order_schedule_in like bapischdl occurs 0,
order_partners like bapipartnr occurs 0,
order_condition_ex like bapicond occurs 0,
wa like bapicond.
select auart vkorg vtweg spart erdat from vbak into corresponding fields
of table order_header_in .
select posnr matnr zmeng from vbap into corresponding fields of table
order_items_in.
select parvw kunnr posnr from vbpa into corresponding fields of table
order_partners.
select wmeng posnr from vbep into corresponding fields of table
order_schedule_in.
I appreciate your help.
‎2006 Sep 14 8:13 PM
Hi Priya,
1) I think your select statements didnt achieve your requirement.
2) INTO CORRESPONDING will work for some fields which have same field names in both structures.
3) Eg; BAPISDHEAD and VBAK are different to use INTO CORRESPONDING option.
4) First populate internal table for VBAK and LOOP this intetnal table and assign the respective fields to BAPISDHEAD with MOVE statements.
Thanks,
Vinay
‎2006 Sep 14 8:13 PM
Hi Priya,
1) I think your select statements didnt achieve your requirement.
2) INTO CORRESPONDING will work for some fields which have same field names in both structures.
3) Eg; BAPISDHEAD and VBAK are different to use INTO CORRESPONDING option.
4) First populate internal table for VBAK and LOOP this intetnal table and assign the respective fields to BAPISDHEAD with MOVE statements.
Thanks,
Vinay
‎2006 Sep 14 9:01 PM
‎2006 Sep 14 9:06 PM
Hi,
YOu shouldnot populate BAPI tables like that.Because fieldnames in the table and fieldnames in the BAPI table are diffrent.
You first need to get the data to internal table and move manually all corresponding fields and the append the BAPI table.
You have good BAPI_SALESORDER_SIMULATE documentation in SE37.
Thanks,
ramakrishna
‎2006 Sep 15 4:09 AM
Hi Priya
Kindly refer to the details that i have given in your
other post. BAPI: BAPI_SALESORDER_SIMULATE is used to
simulate and see how the order is going to be when itz
created.
Just pass according to the details give there. You
need not extract the details from VBAK, VBAP & VBEP.
You can simulate doing this by creating a variant in
SE37 for this BAPI with various combinations and check
the output.
Kind Regards
Eswar