Application Development 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: 

At selection screen

Former Member
0 Kudos
238

Hi,

I have a selection screen with

SELECTION-SCREEN BEGIN OF BLOCK LDB WITH FRAME TITLE TEXT-001.

PARAMETERS : BR_BUKRS LIKE BKPF-BUKRS FOR TABLE BKPF OBLIGATORY.

SELECT-OPTIONS:

BR_BUDAT FOR BKPF-BUDAT ,

BR_MONAT FOR BKPF-MONAT ,

BR_GJAHR FOR BKPF-GJAHR .

SELECTION-SCREEN END OF BLOCK LDB.

In the selection screen when report is ran.

if user enters just budat-low and presses enter then budat-high should fill with same value of low and below monat-low and monat-high and gjahr-low and gjahr-high should get filled with respective period and fiscal year automatically.

now suppose if they are filled as per above requirement,

now if I change budat-high increase to next month and press enter automatically below monat-high and gjahr-high should change without changing low values as I did'nt change budat-low.

Hope you are able to understand.

same way for if budat-low and budat-high is initial.

and I enter mona-low and press enter

monat-high should get filled with same value of monat-low and budat-low and budat-high should get filled resp dates.

please advice on how to write the code,

I am using At selection screen on block LDB but not able to solve all requirements.

Please let me know

Thanks

4 REPLIES 4

venkata_ramisetti
Active Contributor
0 Kudos
91

Hi,

Check the below program. Since SELECT-OPTION is a table, if you have multiple entries, then you have to modify the below code using LOOP AT...

LOOP AT BR_BUDAT.

IF NOT BR_BUDAT-LOW IS INITIAL .

BR_BUDAT-HIGH = BR_BUDAT-LOW.

ELSEIF NOT BR_BUDAT-HIGH IS INITIAL .

BR_BUDAT-LOW = BR_BUDAT-HIGH.

ENDIF.

ENDLOOP.

Similarly for BR_MONAT and MR_GJAHR.

Check the eblow sample program for single input in the selection-screen..

&----


*& Report ZRKPROGRAM2

*&

&----


*&

*&

&----


REPORT ZRKPROGRAM2.

TABLES: BKPF.

SELECTION-SCREEN BEGIN OF BLOCK B1.

SELECT-OPTIONS:

BR_BUDAT FOR BKPF-BUDAT ,

BR_MONAT FOR BKPF-MONAT ,

BR_GJAHR FOR BKPF-GJAHR .

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN.

IF NOT BR_BUDAT-LOW IS INITIAL .

BR_BUDAT-HIGH = BR_BUDAT-LOW.

ELSEIF NOT BR_BUDAT-HIGH IS INITIAL .

BR_BUDAT-LOW = BR_BUDAT-HIGH.

ENDIF.

IF NOT BR_MONAT-LOW IS INITIAL .

BR_MONAT-HIGH = BR_MONAT-LOW.

ELSEIF NOT BR_MONAT-HIGH IS INITIAL .

BR_MONAT-LOW = BR_MONAT-HIGH.

ENDIF.

IF NOT BR_GJAHR-LOW IS INITIAL .

BR_GJAHR-HIGH = BR_GJAHR-LOW.

ELSEIF NOT BR_GJAHR-HIGH IS INITIAL.

BR_GJAHR-LOW = BR_GJAHR-HIGH.

ENDIF.

START-OF-SELECTION.

WRITE: / BR_BUDAT-LOW, BR_BUDAT-HIGH.

WRITE: / BR_MONAT-LOW, BR_MONAT-HIGH.

WRITE: / BR_GJAHR-LOW, BR_GJAHR-HIGH.

Thnks,

Ramakrishna

0 Kudos
91

Heyyyy !!! krishnaaaa, please save me

I need to fill the periods also when I press enter after entering just buday-low.

eg :

CC = 100

budat-low 10/01/2006 high ___________

monat________ ___________

year ________ ___________

if i press enter after entering 10/01/2006

budat-high should become 10/01/2006

and monat-low should have respective period for date 10/01/2006 ie 7 and monat-high should be also 7

and resp year should be 2007 in both fields

Now suppose as I said above after entering 10/01/2006 and pressing enter, if the blanks are filled.

eg like

10/012006 10/01/2006

7 7

2007 2007

now if change budat-high to 12/01/2007

like

10/01/2006 12/01/2007

7 7

2007 2007

now if i press enter it should become

10/01/2006 12/01/2007

7 9

2007 2008

the monat-high year-high should change accordingly,

The same for monat also. budat low and high should get filled accordingly

________ ___________

7 __________

2007 __________

i have given error message if both monat and year are initial so if monat is not initial year will be present.

now if i press enter

10/01/2006 10/01/2006

7 7

2007 2007

now if change monat-high to 10 and press enter

10/01/2006 01/01/2007

7 10

2007 2007

budat-high and year-high should chagne accordingly

here 10 is in same fiscal year.

Please let me know how to code. I am able to do some part

Thanks

0 Kudos
91

please advice on how to proceed.

thanks

0 Kudos
91

Hi

proceed with the following code

AT SELECTION-SCREEN OUTPUT.

IF NOT br_budat-low IS INITIAL.

IF BR_MONAT-LOW IS INITIAL.

PERFORM DATE_TO_PERIOD USING BR_BUDAT-LOW

BR_MONAT-LOW

BR_GJAHR-LOW.

ENDIF.

IF BR_BUDAT-HIGH IS INITIAL.

BR_BUDAT-HIGH = BR_BUDAT-LOW.

PERFORM DATE_TO_PERIOD USING BR_BUDAT-LOW

BR_MONAT-high

BR_GJAHR-HIGH.

ELSE.

PERFORM DATE_TO_PERIOD USING BR_BUDAT-HIGH

BR_MONAT-high

BR_gjahr-high.

ENDIF.

APPEND BR_MONAT.

APPEND BR_GJAHR.

APPEND BR_BUDAT.

IF NAME IS INITIAL.

NAME = SY-UNAME.

ENDIF.

ENDIF.

FORM DATE_TO_PERIOD USING LV_DATE TYPE BUDAT

LV_PERIOD TYPE POPER

LV_GJAHR TYPE GJAHR.

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

EXPORTING

i_date = LV_DATE

i_periv = 'Z1'

IMPORTING

e_buper = LV_PERIOD

e_gjahr = LV_GJAHR

EXCEPTIONS

input_false = 1

t009_notfound = 2

t009b_notfound = 3

OTHERS = 4.

IF SY-SUBRC EQ 0.

ENDIF.

ENDFORM.

you need to get the value of the i_periv in the FM to get the year maintiance that's configured into your system.

and do teh same thing for monat field accordingly.

But i am not syre when the period values are not accodingly like

in the low field if its 8 and in the high field its 2 the system would give an error message on the screen.

Cheers