2013 Aug 20 5:02 PM
Hi Experts,
I want to create variable names dynamically in my program.
i know what should be the type of my variable.
eg: I want to create variable of pattern time.001, time.002, time.003 etc.
i get values 001, 002 from one of my source.
then I loop that source,
loop at it_table.
wa_table-period holds this number.
now i want to concatenate that number(001) with time and use this time.001 as a variable for further calculations.
endloop.
this time.001 then time.002 should have type c length 7 and should be able to store values in those variables.
i want this variables are seperate and not in any internal table.
in short, data: time.001(7) type c,
time.002(7) type c. needs to be created dynamically in program.
Can anyone help.
Please
thanks,
Sonali
Hello Sonali,
Try with these following links. May be you got some idea to get rid of your problem
http://scn.sap.com/thread/1823076
https://www.google.co.in/search?q=Dynamic+variable+name+in+sap+site:scn.sap.com&biw=1920&bih=950
BR
Chandra..
2013 Aug 20 5:23 PM
Hi Sonali,
For this instead of creating variables dynamically, you can make use of field symbols.
loop at it_table into wa_table.
CONCATENATE 'TIME' wa_table-period into lv_temp.
ASSIGN (lv_temp) to <fs_time>.
ENDLOOP.
Now <fs_time> holds time001(if wa_table-period is 001). Whenever you want to use time001, you can use field symbol <fs_time>.
Hope this helps
Sreedhar
2013 Aug 20 10:02 PM
hi Sreedhar,
Thanks for your reply.
this was just an example i gave for time.
assume I need to create variable on the fly for GL accounts.
user can enter data in any number of GL accounts, then I just have these all GL account together in one string seperated by ','.
ie GL001,GL005,GL0056,GL0089
Now I want to store these individual GL's in dynamically created 4 variables.
I want to know how to create these variable if number of accounts is not known.
2013 Aug 21 6:28 AM
Hello Sonali,
Try with these following links. May be you got some idea to get rid of your problem
http://scn.sap.com/thread/1823076
https://www.google.co.in/search?q=Dynamic+variable+name+in+sap+site:scn.sap.com&biw=1920&bih=950
BR
Chandra..
2013 Aug 21 6:06 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |