2005 Sep 26 3:08 PM
Hi,
I assume that the question is a little bit confusing, but what I want to do is very simple, suppose that I list an internal table (t_int) into a form. To show the fields I write things like this:
&t_int-kunnr&
and if I need to determine the width of the column, a way of doing this is:
&t_int-kunnr(10)&
but, what if I need a variable width that it is determined in the control program with a variable, suppose something like:
&t_int-kunnr(&width&)&
but this doesn't work, so my question is, how can I put a variable inside another variable in a sapscript form?
thanks in advance
2005 Sep 26 5:07 PM
There is no way of not hardcoding in sapscript.
You can use like t_int-numc to pass the length of the output .
In SAPSCRIPT you can use
/: CASE &t_int_numc&
/: WHEN 10
&t_int-kunnr(10)&
/: WHEN 8
&T_INT-KUNNR(8)&
/: ENDCASE.
Or you can achieve by creating different text elements and calling these elements conditionally.
/E TEXT10
&t_int-kunnr(10)&
/E TEXT8
&T_INT-KUNNR(8)&
However there is no way you can define the output length of a field dynamically.
Cheers.
Why do you want to put one variable into another in the sapscript. Make all your changes in program in one variable i.e. to be used in SAPSCRIPT. Say
wa_kunnr = t_int-kunnr.
clear t_int-kunnr.
t_int-kunnr = wa_kunnr(8) .
<Shift left right etc>
Later in SAPSCRIPT simply use &t_int-kunnr(10)&
Hope this helps. If not give exact scenario.
Cheers
2005 Sep 26 3:12 PM
2005 Sep 26 3:20 PM
thanks it solves perfectly the problem,
but I have a problem when I try to give you the points of the forum,
thanks again,
2005 Sep 26 3:49 PM
I'm sorry but I think I've spoken too quick, it seems that the solution of sasikumar doesn't work properly.
any other ideas?, thanks again
2005 Sep 26 4:13 PM
Why do you want to put one variable into another in the sapscript. Make all your changes in program in one variable i.e. to be used in SAPSCRIPT. Say
wa_kunnr = t_int-kunnr.
clear t_int-kunnr.
t_int-kunnr = wa_kunnr(8) .
<Shift left right etc>
Later in SAPSCRIPT simply use &t_int-kunnr(10)&
Hope this helps. If not give exact scenario.
Cheers
2005 Sep 26 4:16 PM
that's a good idea, but what I'm looking for is a way of set the width of the columns from the control program instead of <i>hardcoding</i> it in the form.
2005 Sep 26 5:07 PM
There is no way of not hardcoding in sapscript.
You can use like t_int-numc to pass the length of the output .
In SAPSCRIPT you can use
/: CASE &t_int_numc&
/: WHEN 10
&t_int-kunnr(10)&
/: WHEN 8
&T_INT-KUNNR(8)&
/: ENDCASE.
Or you can achieve by creating different text elements and calling these elements conditionally.
/E TEXT10
&t_int-kunnr(10)&
/E TEXT8
&T_INT-KUNNR(8)&
However there is no way you can define the output length of a field dynamically.
Cheers.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |