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

Modify selection Parameter

Former Member
0 Likes
812

Dear Gurus,

I have one field s_budat in selection screen and i am passing the date 01.02.2007 and all records coming as per selection parameters.

But i need -1 day from date which i m passing in the selection field.

For this i m using following.

s_budat-low = s_budat-low - 1.

select budat

hkont

shkzg

dmbtr

into table result

from bsis

where bsis~hkont in s_gl

and budat in s_budat

and gsber = p_gsber.

but when i m selecting data it is not coming from 31.01.2007.

Please give me solution.

Thanks in Advance.

Regards

Maqsood

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
726

S_BUDAT is essentially a table, but your code here is only updating the header. You need to loop through S_BUDAT and update the row of the table.

Something like;

LOOP AT S_BUDAT ASSIGNING <FS_DATE>.

<FS_budat>-low = <fs_budat>-low - 1.

endloop.

Regards,

Nick

6 REPLIES 6
Read only

Former Member
0 Likes
726

Hi maqsood,

1. Minor mistake.

2. Just do like this.

s_budat-low = s_budat-low - 1.

<b>MODIFY S_BUDAT INDEX 1.</b>

Then it will come.

3. This happens bcos s_budat

is internally an internal table, and we have to modify

the 1st record, and not just the header line.

regards,

amit m.

Read only

Former Member
0 Likes
727

S_BUDAT is essentially a table, but your code here is only updating the header. You need to loop through S_BUDAT and update the row of the table.

Something like;

LOOP AT S_BUDAT ASSIGNING <FS_DATE>.

<FS_budat>-low = <fs_budat>-low - 1.

endloop.

Regards,

Nick

Read only

Former Member
0 Likes
726

a select-option is a range table. You need to do this.

read table s_budat index 1.

s_budat-low = s_budat-low - 1.

modify s_budat.

Read only

Former Member
0 Likes
726

the date format it yyyymmdd

now when you -1 from this 01.02.2007 it is 20070200

you cannot do this by simply putting a minus sign.

you have to know what is happening inside.

try some fm to get the previous date ...

then pass the date

and then the date what the fm returns...pass it to the select command where condition.

reward if helpful

thanks

vivekanand

Read only

varma_narayana
Active Contributor
0 Likes
726

Hi...

Note : SELECT-OPTION creates an internal table ..

This is the Solution..

SELECT-OPTIONS: s_budat-low FOR sy-datum.

INITIALIZATION.

S_BUDAT-LOW = SY-DATUM - 1.

APPEND S_BUDAT.

START-OF-SELECTION.

select budat

hkont

shkzg

dmbtr

into table result

from bsis

where bsis~hkont in s_gl

and budat in s_budat

and gsber = p_gsber.

Reward if Helpful..

Read only

Former Member
0 Likes
726

Hi Maqsood,

You job will complete with the following fm

RP_CALC_DATE_IN_INTERVAL

DATE --- the date you get from sel screen

DAYS --- the number of days you want to reduce.

it will return you the what you are expecting.

<u><i><b>Dont forget reward points which boost us to help others</b></i></u>

Regards

Sreenivasa sharma