Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

pricing simulation

Former Member
0 Likes
750

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
702

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

4 REPLIES 4
Read only

Former Member
0 Likes
703

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

Read only

0 Likes
702

vinay did u use that bapi before?

Read only

0 Likes
702

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

Read only

0 Likes
702

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