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

How To Display ABAP Variable Value

Hi,

I have a BSP and am using ABAP for scripting. I have a variable and I want to display the value on the webpage. What's the ABAP scripting syntax?

I tried:

<%

DATA: l_dat TYPE string.

l_dat = request->get_form_field( 'SELECTION' ).

WRITE: l_dat.

%>

I need the syntax to display l_dat.

Also, is there a ABAP scripting reference that shows syntax?

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 05:18 AM

    yes there is a way to put the things in one abap section.

    but for that you have to use MVC.

    since a controller class has a method write(). using that you can write to the view i.e html page.

    e.g.

    in do_request method of controller:

    -


    DATA: l_dat TYPE string,

    fields type TIHTTPNVP,

    wa_fields like line of fields.

    CALL METHOD request->if_http_entity~get_form_fields

    CHANGING

    fields = fields.

    loop at fields into wa_fields where name = 'SELECTION'.

    l_dat = wa_fields-value.

    endloop.

    write( '<html><body><H1>' ).

    WRITE( l_dat ).

    write( '</H1></body></html>' ).

    -


    everything else is already mentioned.

    regards,

    Hemendra

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi Audrey,

    Did you try this way

    <%= I_data %>

    Shailaja

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 05:00 AM

    HI Audrey,

    You can't use

    <b>write: l_dat <b> in Web Pages,the syntax to display a variable in ABAP would be

    <%=l_dat%> or via using a textview as

    <htmlb:textView text = "<%=l_dat %>"

    id = "txt1"

    design = "EMPHASIZED" />

    in your layout.

    If you are submitting the value on same page and want to show it then in the onInputProcessing or onrequest,depending on requirement ,you have to use

    l_dat = request->get_form_field( 'txt1' )

    where l_dat is a page attribute.

    Hope this helps,

    Regards,

    Siddhartha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2005 at 05:32 AM

    HI Audrey,

    In the code you are using ,in layout itself,you just change your code as

    <% DATA: l_dat TYPE string.

    l_dat = request->get_form_field( 'SELECTION' ).

    if l_dat is not initial.

    %>

    <htmlb:textView text = "<%= l_dat %>"

    design = "EMPHASIZED" />

    <%

    endif.

    %>

    Regards,

    Siddhartha

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2005 at 07:00 AM

    Hi Audrey,

    it seems to me that you are new to BSP programming, so I hope you let me give you some starting advice.

    Give the help on BSP a good read:

    Business" target="_blank">http://help.sap.com/saphelp_nw04/helpdata/en/e9/bb153aab4a0c0ee10000000a114084/frameset.htm">Business Server Pages

    While you can still come here for questions anytime, you might be better off doing some research on your own first.

    Because even though the answers above are right and they do work, they will only confuse you, because there are many different ways to achieve the same goal - and without a proper understanding of the concepts it will be hard for you to find out by yourself which is the right way for your goal.

    Therefore don't hesitate to ask, but be ready to get an overview yourself, as this will improve your understanding and answer most questions you have already.

    Cheers,

    Max

    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.