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

select query

Former Member
0 Likes
326

hi all,

i have a problem writing the select statement for a condition please help.

If account group = Z001, Z008, or Z009, Select from VBAK using KUNNR = Customer Account Number where AUDAT is most recent.

Else

Select from VBPA using KUNNR = Customer Account Number where Sales Order number is most recent. Then select Sales Order VBAK where VBELN = VBPA-VBELN to obtain SO doc date.

2 REPLIES 2
Read only

Former Member
0 Likes
298

hi do one thing..

if accgrp = 'Z001' or accgrp = 'Z008' accgrp = 'Z009' .

select kunnr

accgrp

audat

from VBAK

into table it_vbrp

where kunnr in s_kunnr

and audat in s_audat .

sort itab by audat .

  • then you will get the recent record ..

*here you can use the read or loop statement..

else.

select vbeln

kunnr

from VBPA

where vbeln in s_vbeln .

sort itab1 by vbeln .

*here you can use the read or loop statement..

regards,

venkat

Read only

0 Likes
298

i do not have anything on the selection screen . i need to format it in select query itself. base on for all entries in some itab[].