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: 

Regarding Initialization event

Former Member
0 Kudos
183

Hi,

I did some caclutaions to set my parameters some default values. I did these calculations under INITIALIZATION event beofore declaring paramaetres. But these default value are not coming to the screen. Where did it go wrong. Where should i perform those calculation.

Thanks,

Ram.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
130

Hi,

Anybody can suggest me the solution for above prob.

Thanks,

Ram.

10 REPLIES 10

prasanth_kasturi
Active Contributor
0 Kudos
130

Hi,

It doesnt matter where you write the initilization event , It triggers first

other wise use default option of parameters

ex : parameters : p_kunnr like kna1-kunnr default 1002.

could you paste your code so that we can check it

regards

prasanth

0 Kudos
130

Hi Prasanth,

i did some date caclulations and need to make it as default values in my paremeters. Even i used defalut optionits working.

0 Kudos
130

hi,

what are the calculations paste the code we can check it

do this way

parameters : p_date like sy-datum.

INITIALIZATION.

p_date = sy-datum + 10.

you can also use

AT SELECTION-SCREEN OUTPUT.

regards

prasanth

Edited by: prasanth kasturi on Jun 19, 2008 10:36 AM

0 Kudos
130

Hi Prasanth,

Calculation part and selection-screen part is like this. Pls suggest me the chagnes. Thanks.

----- BEGIN OF SELECTION SCREEN DEFINITIONS--


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_perfr like ptrv_head-datv1 OBLIGATORY default date_first,

p_perto like ptrv_head-datb1 OBLIGATORY default date_last.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(19) TEXT-002.

PARAMETERS : P_MAIL AS CHECKBOX DEFAULT ' ' USER-COMMAND flag .

SELECTION-SCREEN END OF LINE.

PARAMETERS : P_LAYOUT type slis_vari.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

PARAMETERS : P_EMAIL like somlreci1-receiver

MODIF ID bl2,

p_online no-display.

SELECTION-SCREEN END OF block B2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF P_MAIL <> 'X' AND

screen-group1 = 'BL2'.

screen-active = '0'.

modify screen.

ENDIF.

ENDLOOP.

--


-
END OF SELECTION SCREEN DEFINITIONS--

--


INITIALIZATION--

INITIALIZATION.

  • Set default values for the Parameters on Selection screen

date_present = sy-datum.

date_first = sy-datum.

date_first+6(2) = '01'. .

date_first4(2) = date_present4(2) - 1.

CALL FUNCTION 'OIL_LAST_DAY_OF_PREVIOUS_MONTH'

EXPORTING

I_DATE_OLD = date_present

IMPORTING

E_DATE_NEW = date_last.

Former Member
0 Kudos
130

declare as :

parameters : p_file like rlgrap-filename.

initialization.

p_file = 'file.txt'.

Former Member
0 Kudos
130

you can do that in the at selection screen output..

REPORT ztest_alv_perc_13317.

parameters:p_test type i .

parameters:p_test1 type i .

at selection-screen output .

p_test = 12 .

p_test1 = p_test .

or do like this...

REPORT ztest_alv_perc_13317.

parameters:p_test type i .

parameters:p_test1 type i .

initialization.

p_test = 12 .

p_test1 = p_test .

Former Member
0 Kudos
130

hiiii

you can use following code.here calculation is done in initialization event.so you can do like this in your program

**********************************************************************
*               INITIALIZATION                                       *
**********************************************************************
INITIALIZATION.


  SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME  TITLE text-001.
  PARAMETERS:

    p_radio2 TYPE c RADIOBUTTON GROUP rad USER-COMMAND rad,
    p_radio1 TYPE c RADIOBUTTON GROUP rad DEFAULT 'X'.
  SELECTION-SCREEN END  OF BLOCK a1 .

  SELECT-OPTIONS
   s_fldate FOR w_fldate.
  MOVE sy-datum TO s_fldate-low.
  MOVE sy-datum TO s_fldate-high.
  w_date = sy-datum.


  s_fldate-low+6(2) = w_date1.
  w_temp = s_fldate-low.
  w_next = s_fldate-low+4(2) + 1.
  w_temp+4(2) = w_next.

  w_last = w_temp - 1.
  s_fldate-high = w_last.
  APPEND s_fldate.

  SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME  TITLE text-002 .
  WRITE: 'Sort By'.
  PARAMETERS:

    p_radio4 TYPE c RADIOBUTTON GROUP rad1 USER-COMMAND rad ,
     p_radio3 TYPE c RADIOBUTTON GROUP rad1 DEFAULT 'X'.
  SELECTION-SCREEN END  OF BLOCK b1 .


  SELECT-OPTIONS
     s_carrid FOR w_carrid MODIF ID abc.


START-OF-SELECTION.

reward if useful

thx

twinkal

Former Member
0 Kudos
131

Hi,

Anybody can suggest me the solution for above prob.

Thanks,

Ram.

0 Kudos
130

Hi Ram,



DATA : date_first TYPE sy-datum ,
date_last TYPE sy-datum,
date_present TYPE sy-datum.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_perfr LIKE ptrv_head-datv1 OBLIGATORY,
p_perto LIKE ptrv_head-datb1 OBLIGATORY .

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(19) text-002.
PARAMETERS : p_mail AS CHECKBOX DEFAULT ' ' USER-COMMAND flag .
SELECTION-SCREEN END OF LINE.

PARAMETERS : p_layout TYPE slis_vari.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

PARAMETERS : p_email LIKE somlreci1-receiver
MODIF ID bl2,
p_online NO-DISPLAY.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF p_mail = 'X' AND

    screen-group1 = 'BL2'.

      screen-active = '0'.

      MODIFY SCREEN.

    ENDIF.
  ENDLOOP.

*-------- --------END OF SELECTION SCREEN DEFINITIONS-----------
*
*------------------------ INITIALIZATION---------------------------
INITIALIZATION.

*Set default values for the Parameters on Selection screen

  date_present = sy-datum.
  date_first = sy-datum.

  date_first+6(2) = '01'. .
  date_first+4(2) = date_present+4(2) - 1.

  MOVE date_first TO p_perfr.


  CALL FUNCTION 'OIL_LAST_DAY_OF_PREVIOUS_MONTH'
    EXPORTING
      i_date_old = date_present
    IMPORTING
      e_date_new = date_last.

  MOVE date_last TO p_perto.

Best regards,

raam

0 Kudos
130

hi Ram,

check this code, You must pass the values of date_first and date_last to parameters p_perfr and p_perto that is the problem you did not pass,

data : date_first type sy-datum ,

date_last type sy-datum,

date_present type sy-datum.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_perfr like ptrv_head-datv1 OBLIGATORY default date_first,

p_perto like ptrv_head-datb1 OBLIGATORY default date_last.

SELECTION-SCREEN END OF block B1.

INITIALIZATION.

*Set default values for the Parameters on Selection screen

date_present = sy-datum.

date_first = sy-datum.

date_first+6(2) = '01'. .

date_first4(2) = date_present4(2) - 1.

p_perfr = date_first.

CALL FUNCTION 'OIL_LAST_DAY_OF_PREVIOUS_MONTH'

EXPORTING

I_DATE_OLD = date_present

IMPORTING

E_DATE_NEW = date_last.

p_perto = date_last.

regards

prasanth