8 Replies Latest reply: Jun 20, 2012 6:44 AM by Vincent Ong RSS

Customer Exit for 1st day of the month til the date user entered

Vincent Ong
Currently Being Moderated

Hi BI Gurus,

 

Currently, I need to display the records from 1st of the month to date entered by the user in the selection screen.

Eg, 

User Entered Date : 23.06.2011

Report should display from:  01.06.2011 to 23.06.2011

 

 

I have created Customer Exit Variable  "ZVAR_1ST_DAY" with Customer Exit (optional) for 0CALDAY inside the structure.

 

 

DATA:

       l_s_range TYPE rrrangesid,
       loc_var_range LIKE rrrangeexit,

        lv_month TYPE d,
       lv_year(4) TYPE n,
       lv_first_day TYPE sy-datum,
       lv_last_day TYPE sy-datum.

 

 

 

*To Calculate First Day of the Month
CASE i_vnam.

WHEN 'ZVAR_1ST_DAY'.

     IF i_step = 2.

     LOOP AT i_t_var_range into loc_var_range WHERE vnam = 'ZVAR_1ST_DAY'.

       lv_month = loc_var_range-low+4(2).
       lv_year = loc_var_range-low+0(4).

       CONCATENATE lv_year lv_month '01' INTO lv_first_day.

       CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
        EXPORTING
          day_in                   = lv_first_day
        IMPORTING
          last_day_of_month = lv_last_day.

       l_s_range-low  = lv_first_day.
       l_s_range-high = lv_last_day.

      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.

       APPEND l_s_range TO e_t_range.

    ENDLOOP.

ENDIF.
   ENDCASE.

 

Although there are no syntax error, but I am not sure is it working, I have limited knowledge in ABAP, can anyone please help me on this codes?

or any advice on how to change this would be great.

 

Many thanks,

Vince

  • Re: Customer Exit for 1st day of the month til the date user entered
    Saravanan Ramasamy
    Currently Being Moderated

    The quick way to check the value for this variable is to execute the query in RSRT with HTML option. In the result screen click on the "Info" to view the variable values

    hope this help

    • Re: Customer Exit for 1st day of the month til the date user entered
      Vincent Ong
      Currently Being Moderated

      Thanks for the advice,

       

      We are able to find out what is the cause.

      The latest code seems to be okay in RSRT, however it displayed error:-

       

      Error for variable  in customer enhancement ZVAR_1ST_DAY

      Message no. BRAIN649

      Diagnosis

      This internal error is an intended termination resulting from an illegal program status.

      The error occuured for variable  in customer enhancement ZVAR_1ST_DAY.

      Procedure

      Check your customer enhancement.

      WHEN 'ZVAR_1ST_DAY'.

               LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'CAL_DAY'.

                 lv_month = loc_var_range-low+4(2).
                 lv_year = loc_var_range-low+0(4).

                 CONCATENATE lv_year lv_month '01' INTO lv_first_day.

                 lv_last_day = loc_var_range-low.
                 l_s_range-low  = lv_first_day.
                 l_s_range-high = lv_last_day.
                 l_s_range-sign = 'I'.
                 l_s_range-opt  = 'BT'.

                 APPEND l_s_range TO e_t_range.
               ENDLOOP.

       

      Any advice on what may be wrong in the codes above would be greatly appreciated.

       

      Many thanks,

      Vince

  • Re: Customer Exit for 1st day of the month til the date user entered
    Ravi Chandra
    Currently Being Moderated

    Hi

     

    U have to create 2 variable . One variable with processing type manual entry ( let say the variable u defined is 'zvar_me' ) and the another variable with processing type customer exit ( let say the variable u created is ' zvar_ce') .  Now replace the above code with

     

    when 'zvar_ce'.' here u have to give the variable name with processing type customer exit.

     

    if i_step = 2.

     

    read table i_t_var_range into loc_var_range with key vnam = 'zvar_me'. " here u have to give the variablename with processing type manual entry.

    ...

    ...

    ...

    ..

     

    endif.

     

    AND THEN EXECUTE THE ABOVE CODE. it will display the output revert back in case of any queries.

     

    Hope u got it,

     

    Regard,

    RaviChandra