Skip to Content
author's profile photo Former Member
Former Member

put a variable inside another variable in sapscript form

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 04: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 02:12 PM

    hi,

    try this

    &t_int-kunnr&+0(&width&)

    i'm not sure.

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2005 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.