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

SQL Stmts for sales order.

Former Member
0 Likes
941

Hi, How do I select

sales order no,

stock loc,

promised date,

requested date,

date entered,

Customer number,

Line No,

Material,

order Qty,

Shipped Qty,

Bin location.

for the sales order report.

I have problem with the dates, in the schedule line level.

How can they be captured regardingly. Order quantity is also not been captured, into internal table.

Regards,

Ajju

Hi, How do I select

sales order no,

stock loc,

promised date,

requested date,

date entered,

Customer number,

Line No,

Material,

order Qty,

Shipped Qty,

Bin location.

for the sales order report.

I have problem with the dates, in the schedule line level.

How can they be captured regardingly. Order quantity is also not been captured, into internal table.

Regards,

Ajju

3 REPLIES 3
Read only

Former Member
0 Likes
635

Hi Syed,

The details that you wish to obtain are not all stored in the same table. You will have to go to three different tables -

VBAK - Sales Order Header

VBAP - Sales Order Item Details

VBEP - Schedule Line Data

Regards,

Anand Mandalika.

Read only

0 Likes
635

Thanks for the reply,

I wanted to know, how to join all the fields together.

can it be done with nested select statements or individual select statements. and how?

hope U could provide some more light on it

Regards,

Ajju

Read only

0 Likes
635

Hi,

I suggest you to retrive records(required fields) from VBAK first.

Then use for all entries(I_VBAK) to retrive records(required fields) from VBAP .

Then use for all entries for the second itab i_VBAP to fetch records from VBEP.

Then combine the internal tables.

Select fields from VBAK into table I_VBAK.

select fields from VBAP into table I_VBAP for all entries in I_VBAK where vbeln = I_VBAK-vbeln.

select fields from VBEP into table I_VBEK for all

entries in I_VBAP where vbeln = I_VBAP-vbeln

and posnr = I_VBAP-posnr.

Loop at I_VBAK."Assumed that table with header line

I_OUTPUT-field1 = I_VBAK-field1.

...

Loop at I_VBAP where vbeln = I_VBAK-vbeln.

I_OUTPUT-field2 = I_VBAK-field2.

...

Loop at I_VBEP where vbeln = I_VBAP-vbeln

and posnr = I_VBAP-posnr.

I_OUTPUT-field3 = I_VBAK-field3.

append I_OUTPUT.

Endloop.

Endloop.

Endloop.

Hope this helps.If not , get back to me.

Rgds,

J.Jayanthi