on 2008 Sep 20 10:13 AM
Hi All.
I am trying to use a routine in the selection criteria of a DTP. I use the same code as per Info Package routines. However, although there are no syntax errors, the values for the selection criteria are not generated and the DTP fails with an error. It seems I am missing something. Can some one please give me some sample code. Here is the code I am using:
form compute_CALMONTH
tables l_t_range structure rssdlrange
changing p_subrc like sy-subrc.
Insert source code to current selection field
$$ begin of routine - insert your code only below this line -
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = ' '.
*NOTE: I have also tried to insert CALMONTH between the quotes, but it *makes no difference. ' ' is the way it is generated by default.
l_idx = sy-tabix.
*....
DATA: zdate like sy-datum,
zcalmonth(6) type n.
move sy-datum to zdate.
zcalmonth = zdate(6).
l_t_range-low = zcalmonth.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
if l_idx <> 0.
modify l_t_range index l_idx.
else.
append l_t_range.
endif.
p_subrc = 0.
$$ end of routine - insert your code only before this line -
endform.
Thanks.
Johan Loock
Hi
Pls try this
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALMONTH'.
l_idx = sy-tabix.
DATA: zcalmonth(6) type n.
zcalmonth = sy-datum(6).
l_t_range-iobjnm = '0CALMONTH'.
l_t_range-FIELDNAME = 'CALMONTH'.
l_t_range-low = zcalmonth.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
if l_idx 0.
modify l_t_range index l_idx.
else.
append l_t_range.
endif.
p_subrc = 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jürgen/Rohit, thanks for the replies.
Jürgen, thanks for the programming tips. I am not an Abaper, but but make do with limited knowledge, so I problably do many strange things. I take take note of how I can simplify my code. However that did not change the result of the routine. Even if I hardcode the calmonth like '200807' it did not pick it up.
Rohit, what you suggested resulted in the routine actually working. More specific, the statement, l_t_range-FIELDNAME = 'CALMONTH', is the one that is required. The other one, l_t_range-iobjnm = '0CALMONTH', makes no difference, whether it is there or not.
Thanks for you input.
Regards,
JL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Johan,
I have two suggestions:
First: Put CALMONTH in the read table statement:
read table l_t_range with key
fieldname = 'CALMONTH'.
If in doubt, in the comment above the 'form compute' you can see the fieldname you have to use. No idea why this was not filled in per default.
Second: Simply assign sy-datum instead of your type conversion. I find it very strange that you convert to n instead of c. So I would simply use:
l_t_range-low = sy-datum(6).
For security reasons I normaly set l_t_range-high too.
l_t_range-high = sy-datum(6).
Everything else should work.
Kind regards,
Jürgen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Raj, the Form code was generated by BI and is not changable in the routine. I added only the following lines, the rest being out of my control, except for the modify & append statements at the end:
DATA: zdate like sy-datum,
zcalmonth(6) type n.
move sy-datum to zdate.
zcalmonth = zdate(6).
l_t_range-low = zcalmonth.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
FORMs are no longer used in the new 7.0.
see this:
http://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.