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

doubt in selection

Former Member
0 Likes
694

Hi folks,

I want to pick the data from payr table where pridt(creation date) IN sel_cpud ( selection screen field)and

voidd > sel_cpud.

I mean , i need to get checks from payer for the period of creation date and need to include voided checks whose void date is greater than creation date which we enter in selection screen.

How to write a query.

thanks in advance.

regards

Vishal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
659

Hi vishal,

select f1 f2 ... from payr into table itab where

pridt in se_cpud.

loop at itab.

delete itab where voidd < sel_cpud.

endloop.

hope this helps.

reward if helpful.

regards,

keerthi.

5 REPLIES 5
Read only

Former Member
0 Likes
659

If i say

select * from payr where pridt IN sel_cpud

AND voidd > sel_cpud , its not picking any data even data is avilable between this pridt period which we enter in selection screen.

Read only

0 Likes
659

You will need a second parameter field on your screen for "Voided Check Date Cutoff".

parameters: p_vccd type sy-datum.

select * from payr 
   where pridt IN sel_cpud
     AND voidd > p_vccd.

Regards,

Rich Heilman

Read only

0 Likes
659

You have to use OR not AND. Also, 'voidd > selcpud' will not work because selcpud is a select option. So if the user enters a range of dates, are you saying your voided date should be greater than every one of them? Think again if it makes sense. If it is a single date(parameter) entered in the selection screen, then it is ok no if it is a range.

Read only

Former Member
0 Likes
660

Hi vishal,

select f1 f2 ... from payr into table itab where

pridt in se_cpud.

loop at itab.

delete itab where voidd < sel_cpud.

endloop.

hope this helps.

reward if helpful.

regards,

keerthi.

Read only

abdul_hakim
Active Contributor
0 Likes
659

hi you cannot use > if your selection screen field is a defined using SELECT-OPTIONS.

if it is defined using PARAMETERS then your code should look like

select * from payr into table int_payr where pridt eq sel_cpud and voidd gt sel_cpud.

if you have defined the SELECT-OPTIONS then your code should look like.

RANGES r_voidd FOR payr-voidd.

START-OF-SELECTION.

LOOP AT SEL_CPUD.

MOVE: SEL_CPUD-LOW TO R_VOIDD-LOW,

SEL_CPUD-HIGH TO R_VOIDD-HIGH,

'EQ' TO R_VOIDD-OPTION,

'I' TO R_VOIDD-SIGN.

APPEND R_VOIDD.

ENDLOOP.

select * from payr into table int_payr where pridt in sel_cpud and voidd in R_VOIDD.

Cheers,

Abdul Hakim