Skip to Content
author's profile photo Former Member
Former Member

Regarding Initialization event

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 08:55 AM

    Hi,

    Anybody can suggest me the solution for above prob.

    Thanks,

    Ram.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • Posted on Jun 19, 2008 at 08:27 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Prasanth Kasturi

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 08:28 AM

    declare as :

    parameters : p_file like rlgrap-filename.

    initialization.

    p_file = 'file.txt'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 08:30 AM

    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 .

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 08:30 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.