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

Problem during selection screen

Former Member
0 Likes
682

Dear all,

I have to put defaul value in selection screen,so I have calculated in initialization event.Following are the code:

INITIALIZATION.

CALL FUNCTION 'K_PERIOD_GET_FOR_DATE_KOKRS'

EXPORTING

KOKRS = '9000'

DATE = SY-DATUM

IMPORTING

PERIO = V_PERIO

GJAHR = V_GJAHR

EXCEPTIONS

KOKRS_NOT_FOUND = 1

DATE_INVALID = 2

OTHERS = 3.

and in selection screen I have written like that :

SELECT-OPTIONS SO_GJAHR FOR ZZF08_EPL-GJAHR OBLIGATORY DEFAULT V_GJAHR.

SELECT-OPTIONS SO_MONAT FOR ZZF08_EPL-MONAT OBLIGATORY DEFAULT V_PERIO.

But at the time of execution it is not showing any default value in select option.

Regards,

Amar

1 ACCEPTED SOLUTION
Read only

Marcel_Wahl
Product and Topic Expert
Product and Topic Expert
0 Likes
627

Hi,

this is just a timing isssue...

The "Default" append in your Select-Option definitions are evaluated while

the variables get created at programm loading.

Initialization is after this.

Just set the defaults after your calculation in initialization explicitly

so_gjahr-low = v_gjahr.

APPEND so_gjahr.

so_monat-low = v_perio

APPEND so_monat.

Hope that helps,

br

4 REPLIES 4
Read only

Marcel_Wahl
Product and Topic Expert
Product and Topic Expert
0 Likes
628

Hi,

this is just a timing isssue...

The "Default" append in your Select-Option definitions are evaluated while

the variables get created at programm loading.

Initialization is after this.

Just set the defaults after your calculation in initialization explicitly

so_gjahr-low = v_gjahr.

APPEND so_gjahr.

so_monat-low = v_perio

APPEND so_monat.

Hope that helps,

br

Read only

Former Member
0 Likes
627

hi

try this code

SELECT-OPTIONS SO_GJAHR FOR V_GJAHR OBLIGATORY.
SELECT-OPTIONS SO_MONAT FOR MONAT OBLIGATORY .

INITIALIZATION.

CALL FUNCTION 'K_PERIOD_GET_FOR_DATE_KOKRS'
EXPORTING
KOKRS = 'IN01'
DATE = SY-DATUM
IMPORTING
PERIO = V_PERIO
GJAHR = V_GJAHR
EXCEPTIONS
KOKRS_NOT_FOUND = 1
DATE_INVALID = 2
OTHERS = 3.

so_gjahr-low = v_gjahr.
append so_gjahr.
so_monat-low = v_perio.
append so_monat.

it is working fine

Regards Nilesh

Read only

sravanibellana
Explorer
0 Likes
627

Hi,

Try this.

SELECTION-SCREEN begin of BLOCK A.

SELECT-OPTIONS SO_GJAHR FOR ZZF08_EPL-GJAHR OBLIGATORY .

SELECT-OPTIONS SO_MONAT FOR ZZF08_EPL-MONAT OBLIGATORY .

SELECTION-SCREEN END OF BLOCK A.

INITIALIZATION.

CALL FUNCTION 'K_PERIOD_GET_FOR_DATE_KOKRS'

EXPORTING

KOKRS = '9000'

DATE = SY-DATUM

IMPORTING

PERIO = V_PERIO

GJAHR = V_GJAHR

EXCEPTIONS

KOKRS_NOT_FOUND = 1

DATE_INVALID = 2

OTHERS = 3.

SO_GJAHR-sign = 'I' .

SO_GJAHR-option = 'BT'.

SO_GJAHR-low = V_GJAHR.

SO_GJAHR-high = V_GJAHR.

append SO_GJAHR.

SO_MONAT -sign = 'I' .

SO_MONAT -option = 'BT'.

SO_MONAT -low = V_PERIO.

SO_MONAT -high = V_PERIO.

append SO_MONAT .

Regards,

Sravani.

Read only

Former Member
0 Likes
627
TABLES : bseg,vbrk.
data: BEGIN OF itab,
        monat type T009B-POPER,
      END OF itab.
SELECT-OPTIONS SO_GJAHR FOR BSEG-GJAHR." OBLIGATORY DEFAULT V_GJAHR.
SELECT-OPTIONS SO_MONAT FOR itab-MONAT." OBLIGATORY DEFAULT V_PERIO.

INITIALIZATION.

CALL FUNCTION 'K_PERIOD_GET_FOR_DATE_KOKRS'
EXPORTING
KOKRS = '9000' " make sure you pass correct thing here, this is controlling area
DATE = SY-DATUM
IMPORTING
PERIO = SO_MONAT-low"V_PERIO i am directly passing the SO
GJAHR = SO_GJAHR-low"V_GJAHR here also
EXCEPTIONS
KOKRS_NOT_FOUND = 1
DATE_INVALID = 2
OTHERS = 3.
APPEND : SO_GJAHR, SO_MONAT. " and append