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

Selection screen range

Former Member
0 Likes
2,634

Hi Folks,

In my selection screen iam selecting range of posting period(YYYYMM).i want to fetch the document no(belnr) from bkpf, in bkpf v dnt have posting period field so v have to take year in gjahr and month in monat.so for year and month im taking range tables and the my code is as follows..

{

IF NOT s_period[] IS INITIAL.

LOOP AT s_period.

*Year

r_gjahr-sign = s_period-sign.

r_gjahr-option = s_period-option.

r_gjahr-low = s_period-low+0(4).

r_gjahr-high = s_period-high+0(4).

APPEND r_gjahr. CLEAR r_gjahr.

  • Month

r_monat-sign = s_period-sign.

r_monat-option = s_period-option.

r_monat-low = s_period-low+4(2).

r_monat-high = s_period-high+4(2).

APPEND r_monat. CLEAR r_monat.

CLEAR s_period.

ENDLOOP.

ENDIF.

  • Get the Accounting Doc

SELECT belnr FROM bkpf INTO TABLE gt_bkpf WHERE bukrs = p_bukrs AND

gjahr IN r_gjahr AND

monat IN r_monat.

}

but i want as for example in selection screen if 200904 201002

it has to fetch the document numbers between apr01 2009 to feb 28 2010.

how can i achieve this please give some inputs <removed by moderator>

Thanks

Edited by: Thomas Zloch on May 11, 2010 7:49 AM

11 REPLIES 11
Read only

Former Member
0 Likes
1,910

Hi,

I think we can get:

- First day of s_period-low

- Last day of s_period-high

so we can build a range of first day - last day for selection.

That was my suggestion, please discuss.

Thanks,

Thien

Read only

0 Likes
1,910

Hi,

what you told is exactly my requirement,but how to build a range of the first day-last day of selection.

Please help me it is very urgernt.

Thx.

Read only

0 Likes
1,910

Hi,

Do your work as a®s said. It's what I have said.

Thank a®s for clearing code.

BR,

Thien

Read only

0 Likes
1,910

Hi,

Thanks for ur replies a®s and Thien..stil i have got one doubt.i got the firstday of low value and last day of the high value.

but where can i use this dates. and in my select statement i want to use the index 002 of bkpf.where exactly i can use these low and high dates.please explain me.

Thanks.

Read only

0 Likes
1,910

Hi,

To me, I think you can pass this selection to Posting date (field BUDAT), that meets your requirement above.

BR,

Thien

Read only

0 Likes
1,910

HI Thein,

but which one i have to pass budat = v_date_low or v_Date_high.

Please advice.

Thanks.

Read only

0 Likes
1,910

Hi,

Please can anyone help on this.

Thanks

Read only

0 Likes
1,910

Hello,

If you need data between the date range and you have a range created for BUDAT, assign Low as the lower value and high with the higher value and set OPTION as BT. Now pass the range to BUDAT field in the select query.

select fields into table where budat IN r_budat.

where r_budat-low = lower value

r_budat-high = higher value

r_option = 'BT'

r_sign = 'I'.

or

select fields into table where budat between v_low and v_high.

Hope this helps

Regards

Sachin

Read only

0 Likes
1,910

Hi swetha,

Please build a range of the v_date_low and v_date_high.

Example:


RANGE r_date for bkpf-bdat.

r_date-sign , r_date-options must meet sign and option of s_period that user enter in selection-screen. You must take care of this case if you don't want your report turn to wrong.


r_date-low = v_date_low
r_date-high = v_date_high.

This is a solution not a real correct code, your implementation must check some cases on this.

Hope this help.

BR,

Thien

Read only

0 Likes
1,910

Hi,

Thanks for everyone.i got the solution.

closing.

Read only

former_member194669
Active Contributor
0 Likes
1,910

Try this way


concatenate r_gjahr-low r_monat-low '01' into v_date_low.

v_month = r_monat-high + 1.

concatenate r_gjahr-high v_month '01' into v_date_high.

v_date_high = v_date_high - 1.

If user enter exclude values in your range , then your have problem