‎2006 Dec 26 7:59 PM
Hi Experts,
Am learning abap, could someone please explain the following code;
IF i_step EQ 0 OR " without popup
i_step EQ 1 OR " before popup
i_step EQ 2. " after popup
REFRESH e_t_range.
CLEAR: l_s_range.
CLEAR : s1, s2.
DATA v_pm(6) TYPE c.
s1 = sy-datum.
s2 = sy-datum.
*Date must be in YYYYMM format
IF i_vnam = 'ZUEPOSTM' AND s1+6(2) = '01'.
s1 = s1 - 1.
s1+6(2) = '01'.
s1 = s1 - 1.
v_pm(4) = s1+0(4).
v_pm4(2) = s14(2).
ELSE.
s1+6(2) = '01'.
s1 = s1 - 1.
v_pm(4) = s1+0(4).
v_pm4(2) = s14(2).
ENDIF.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_pm.
APPEND l_s_range TO e_t_range.
ENDIF.
I appreciate your time with points,
Thanks
‎2006 Dec 26 8:36 PM
Hi,
Check the documentation..
If the I_STEP is equal to 0 or 1 or 2..Then the do the following..
IF i_step EQ 0 OR " without popup
i_step EQ 1 OR " before popup
i_step EQ 2. " after popup
REFRESH e_t_range.
CLEAR: l_s_range.
CLEAR : s1, s2.
DATA v_pm(6) TYPE c.
Store the current date in the variables S1 and S2.
s1 = sy-datum.
s2 = sy-datum.
If the i_vnam = 'ZUEPOSTM' and if it is start of the month..Means 01
*Date must be in YYYYMM format
IF i_vnam = 'ZUEPOSTM' AND s1+6(2) = '01'.
Decrement the date by 1 day...Means if 01 - feb - 2006 then it will be 01 - Jan - 2006
current date = 12/26/2006
s1 = s1 - 1. "s1 = 20061225
s1+6(2) = '01'. "s1 = 20061201
s1 = s1 - 1. "s1 = 20061130
v_pm(4) = s1+0(4). " v_pm = 2006
v_pm4(2) = s14(2). " v_pm = 200611
ELSE.
s1+6(2) = '01'. "s1 = 20061201
s1 = s1 - 1. "s1 = 20061130
v_pm(4) = s1+0(4). " v_pm = 2006
v_pm4(2) = s14(2). " v_pm = 200611
ENDIF.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_pm.
APPEND l_s_range TO e_t_range.
ENDIF.
Basically it is getting the previous month and year..Build a range with it..
Thanks,
Naren
‎2006 Dec 26 8:05 PM
Hi,
I believe they are building a range with the previous month and year..
Thanks,
Naren
‎2006 Dec 26 8:08 PM
Nothing wrong with the code it was used in one of the reports and am trying to undertstand the code. i need someone to walk me thru the code.
‎2006 Dec 26 8:07 PM
Hi,
Or debug the code and check what is happening...
Thanks,
Naren
‎2006 Dec 26 8:36 PM
Hi,
Check the documentation..
If the I_STEP is equal to 0 or 1 or 2..Then the do the following..
IF i_step EQ 0 OR " without popup
i_step EQ 1 OR " before popup
i_step EQ 2. " after popup
REFRESH e_t_range.
CLEAR: l_s_range.
CLEAR : s1, s2.
DATA v_pm(6) TYPE c.
Store the current date in the variables S1 and S2.
s1 = sy-datum.
s2 = sy-datum.
If the i_vnam = 'ZUEPOSTM' and if it is start of the month..Means 01
*Date must be in YYYYMM format
IF i_vnam = 'ZUEPOSTM' AND s1+6(2) = '01'.
Decrement the date by 1 day...Means if 01 - feb - 2006 then it will be 01 - Jan - 2006
current date = 12/26/2006
s1 = s1 - 1. "s1 = 20061225
s1+6(2) = '01'. "s1 = 20061201
s1 = s1 - 1. "s1 = 20061130
v_pm(4) = s1+0(4). " v_pm = 2006
v_pm4(2) = s14(2). " v_pm = 200611
ELSE.
s1+6(2) = '01'. "s1 = 20061201
s1 = s1 - 1. "s1 = 20061130
v_pm(4) = s1+0(4). " v_pm = 2006
v_pm4(2) = s14(2). " v_pm = 200611
ENDIF.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_pm.
APPEND l_s_range TO e_t_range.
ENDIF.
Basically it is getting the previous month and year..Build a range with it..
Thanks,
Naren
‎2006 Dec 26 9:01 PM
Naren,
Thanks a ton for your time, also could you please tell me what the following will
do;
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_pm.
APPEND l_s_range TO e_t_range.
Full points to u.
‎2006 Dec 26 9:09 PM
Hi,
This will build a range internal table..
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_pm.
APPEND l_s_range TO e_t_range.
Which means..You can check if the year and month is with in the range..You have to use IN operator to check the data..
The ranges are similar to select-options..Only think is the ranges will not be displayed in the selection-screen..
Example.
-
IF '200611' IN e_t_range.
True.
ELSE.
False.
ENDIF.
Thanks,
Naren
‎2006 Dec 26 9:19 PM
Basically when u run the report and enter 200612 in variable "ZUEPOSTM", the report output will be from 200611 to 200612. am i correct?
‎2006 Dec 26 9:31 PM
Hi,
I am not sure about that..You have to post the entire code for me to check..
But the code building a range with the previous month and year..
Thanks,
Naren