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

Initialization Event

Former Member
0 Likes
1,916

Hi AbAp's

Can you please explain about Initialization event with below scinario.

tables: makt.

selection-screen: skip 2,begin of block ini with frame title text-000,

skip 2.

select-options s_matnr for makt-matnr default '401' TO '500'

option BT sign I.

parameters: p_spras type spras default 'EN'.

selection-screen: skip 2,end of block ini.

initialization.

s_matnr-low = 'A1000'.

s_matnr-high = 'A1004'.

s_matnr-option = 'BT'.

s_matnr-sign = 'I'.

append s_matnr.

p_spras = 'JA'.

O/P : s_matnr : 401 to 501.

p_spras : JA.

My Doubt is .

1.Value for p_spras is picking from intialization but s_matnr it setting from default value what the reason for this?

2.Check the value in internal table s_matnr first record is default record and second is appended

value which is from initialization process ,So Which event is occur first initialization or

selection-screen?

regards,

viji

11 REPLIES 11
Read only

Former Member
0 Likes
1,300

Load of program is triggering first and i guess default value is populating from that.

Read only

viquar_iqbal
Active Contributor
0 Likes
1,300

Hi

Initialization is the first event which is triggered . Its used to modify the output before the screen is displayed to the user.

Read only

0 Likes
1,300

Hi Viquar Iqbal ,

In parameters it is modifying from initialization but select-options it is not modifying from initialization.?.

regards,

viji

Read only

0 Likes
1,300

Hi,

For parameters it is overwriting. For select options do like this (add REFRESH s_matnr.)

tables: makt.

selection-screen: skip 2,begin of block ini with frame title text-000,
skip 2.
select-options s_matnr for makt-matnr default '401' TO '500'
option BT sign I.
parameters: p_spras type spras default 'EN'.

selection-screen: skip 2,end of block ini.

initialization.

REFRESH s_matnr.

s_matnr-low = 'A1000'.
s_matnr-high = 'A1004'.
s_matnr-option = 'BT'.
s_matnr-sign = 'I'.
append s_matnr.

p_spras = 'JA'.

Regards

Read only

0 Likes
1,300

I think p_spras = 'JA'. is not under initialization statement.

Try this once.



tables: makt.

selection-screen: skip 2,begin of block ini with frame title text-000,
skip 2.
select-options s_matnr for makt-matnr default '401' TO '500'
option BT sign I.
parameters: p_spras type spras default 'EN'.

selection-screen: skip 2,end of block ini.

p_spras = 'JA'. 

initialization.
s_matnr-low = 'A1000'.
s_matnr-high = 'A1004'.
s_matnr-option = 'BT'.
s_matnr-sign = 'I'.
append s_matnr.

Read only

0 Likes
1,300

Pls chk my coding .

regards,

viji

Read only

Former Member
0 Likes
1,300

Hi Rajviji,

1.Value for p_spras is picking from intialization but s_matnr it setting from default value what the reason for this?

For P_SPRAS you are overwriting the value EN by JA (Check in debugging) for s_matnr you are just appending (Not clearing and appending).

2.Check the value in internal table s_matnr first record is default record and second is appended

value which is from initialization process ,So Which event is occur first initialization or

selection-screen?

INITIALIZATION is a event where as selection-screen is not.

Regards

Read only

0 Likes
1,300

Thanks .

regards,

viji

Read only

Former Member
0 Likes
1,300

Hi.

Initialization event will occur first.

when u execute the program this event is trigerred first and set the values which u have made

in initialization event.

And when u execute ur program the default values will e ignored and values set in initilalization event

will work

Read only

Former Member
0 Likes
1,300

Hi Rajviji,

Try following code.

INITIALIZATION.

refresh s_matnr.----


Additional statement.

s_matnr-low = 'A1000'.

s_matnr-high = 'A1004'.

s_matnr-option = 'BT'.

s_matnr-sign = 'I'.

append s_matnr.

p_spras = 'JA'.

Regards,

Anil

Read only

Former Member
0 Likes
1,300

In Report, INITIALIZATION is the first event. It will trigger before AT SELECTION-SCREEN event.

It used to give default values to the selection screen fields using SELECT-OPTIONS statement.

INITIALIZATION.

REFRESH s_matnr.

s_matnr-low = 'A1000'.

s_matnr-high = 'A1004'.

s_matnr-option = 'BT'.

s_matnr-sign = 'I'.

append s_matnr.

p_spras = 'JA'.

Regards,

Joan

.