‎2008 May 12 10:41 AM
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.
‎2008 May 12 11:00 AM
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
‎2008 May 12 11:06 AM
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[].