on 11-06-2013 2:10 PM
Hello Experts,
I have followed a document from SDN and created routine for a Date field in DTP.
But when I activate it and execute DTP, I dont see the filter condtion generated in the Date field.
Logic is the routine should generate Date range between current date to Date three years before. Below is the code I used
******************************************************************
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = ''.
l_idx = sy-tabix.
data: zdate_start LIKE sy-datum,
zlv_date LIKE sy-datum,
zdate_end LIKE sy-datum.
clear l_t_range-high.
clear l_t_range-low.
clear zdate_start.
clear zdate_end.
zdate_end = sy-datum.
CALL FUNCTION 'Z_ADD_MONTH_TO_DATE'
EXPORTING
MONTHS = -36
OLDDATE = sy-datum
IMPORTING
NEWDATE = zdate_start.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
l_t_range-low = zdate_start.
l_t_range-high = zdate_end.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
APPEND l_t_range.
* IF l_idx <> 0.
* MODIFY l_t_range index l_idx.
* ELSE.
* APPEND l_t_range.
* ENDIF.
p_subrc = 0.
***********************************************************************
In above, I have tested the FM Z_ADD_MONTH_TO_DATE separately and it is working correct.
Please can any one help me what should be the reason I am not able to generate dynamic date range ?
Regards,
Gopi R
read table l_t_range with key
fieldname = ''.
...
l_t_range-fieldname = ' '.
you need to enter a fieldname in the above lines... the first one is not filled in the document either; the other line is not present in your code (but it is in the document as l_t_range-fieldname = 'FISCPER'. )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Raf Boudewijns. Issue resolved
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.