2014 Oct 24 10:42 AM
Hello,
in my startroutine I'd like to interpret an argument as number. Problem is, that the name of the argument should be created during runtime. During dataload I got the error message, that argument can not interpreted as number.
Here is the code:
DATA:
lv_time TYPE N LENGTH 3,
lv_validfrom TYPE N LENGTH 2,
lv_month TYPE C LENGTH 30.
DO 3 TIMES.
CONCATENATE 'wa_source_package-month' lv_time INTO lv_month.
wa_source_package-amount = lv_month.
COLLECT wa_source_package INTO SOURCE_PACKAGE.
lv_time = lv_time + 1.
ENDDO.
Many thanks for your help.
Ella
2014 Oct 24 12:35 PM
Use a field-symbol :
FIELD-SYMBOLS: <value> TYPE wa_source_package-amount. " Adapt
CONCATENATE 'MONTH' lv_time INTO lv_month.
ASSIGN COMPONENT lv_month OF STRUCTURE wa_source_package TO <value>.
wa_source_package-amount = <value>.Alternative : use a DO VARYING (beware : obsolete form of statement)
DO 3 TIMES VARYING lv_month FROM wa_source_package-month1 NEXT wa_source_package-month2.
wa_source_package-amount = lv_month.
COLLECT wa_source_package INTO source_package.
ENDDO.Regards,
Raymond
Hello,
in my startroutine I'd like to interpret an argument as number. Problem is, that the name of the argument should be created during runtime. During dataload I got the error message, that argument can not interpreted as number.
Here is the code:
DATA:
lv_time TYPE N LENGTH 3,
lv_validfrom TYPE N LENGTH 2,
lv_month TYPE C LENGTH 30.
DO 3 TIMES.
CONCATENATE 'wa_source_package-month' lv_time INTO lv_month.
wa_source_package-amount = lv_month.
COLLECT wa_source_package INTO SOURCE_PACKAGE.
lv_time = lv_time + 1.
ENDDO.
Many thanks for your help.
Ella
2014 Oct 24 10:50 AM
lv_time TYPE N LENGTH 3,
this would have leading zeroes, pls check in debug once, better to have type i
2014 Oct 24 11:00 AM
Hello Kartik,
I checked that and get the same error message.
Kind regards
Ella
2014 Oct 24 11:16 AM
Hi Ella Rose,
After this Line.
CONCATENATE 'wa_source_package-month' lv_time INTO lv_month
You can check with Condense with NO-GAPS.
Condense lv_month NO-GAPS.
wa_source_package = lv_month.
COLLECT wa_source_package INTO SOURCE_PACKAGE.
Check with the tabel type also .
I hope this will be helpful.
Thanks & Regards,
Raghunadh Kodali.
2014 Oct 24 11:21 AM
2014 Oct 24 11:53 AM
I get the an error message again.
In debug I see following values:
lv_time -> 1
lv_month -> wa_source_package-month1
In lv_month I need the value of wa_source_package-month1 (in this example it would be 1000,00) and not the argument.
2014 Oct 24 11:54 AM
I mean that system should interpret wa_source_package-month1.
2014 Oct 24 12:25 PM
ohh ofcourse.
Remove the quotes from 'wa_source_package-month' in the concatenate.
Raymond's code makes sense, I missed pay attention to the o/p u were trying to achieve
Message was edited by: Kartik Tarla
2014 Oct 24 12:35 PM
Use a field-symbol :
FIELD-SYMBOLS: <value> TYPE wa_source_package-amount. " Adapt
CONCATENATE 'MONTH' lv_time INTO lv_month.
ASSIGN COMPONENT lv_month OF STRUCTURE wa_source_package TO <value>.
wa_source_package-amount = <value>.Alternative : use a DO VARYING (beware : obsolete form of statement)
DO 3 TIMES VARYING lv_month FROM wa_source_package-month1 NEXT wa_source_package-month2.
wa_source_package-amount = lv_month.
COLLECT wa_source_package INTO source_package.
ENDDO.Regards,
Raymond
2014 Oct 24 1:44 PM
Hello Raymond,
with field symbols it works. There is a little misstake in your code.
DO 3 TIMES VARYING lv_month FROM wa_source_package-month1 NEXT wa_source_package-month2.
wa_source_package-amount = lv_month.
COLLECT wa_source_package INTO source_package.
ENDDO.
I get an error message but with following code it works fine.
DO 3 TIMES VARYING <value> FROM wa_source_package-month1 NEXT wa_source_package-month2.
wa_source_package-amount = <value>.
COLLECT wa_source_package INTO source_package.
ENDDO.
Many thanks for your answer.
2014 Oct 27 7:15 AM