Skip to Content

SmartForm: How to populate data into row and column ?

Hi Experts,

Lets say I have internal table it_tab in my smartforms.

my it_tab have below data:

I want to populate/display this 6 lines of data into my smartform as below format:

May I know how to do that ?

Thank in advance.

Warm regards

Ice

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Dec 04, 2013 at 08:11 AM

    Hi,

    you have to declare a second internal table corresponding to the structure of your smartforms table

    regards

    Fred

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2013 at 08:24 AM

    Create a template with boxes , then create text element for each boxes, then drag and drop the fields for text elements according to the box of your choice..

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member White Ice

      Firstly create a structure of same type in Form Interface

      Right click on main window -> create -> Flow Logic -> Loop

      Then in data DATA tab give the internal table name and the work area name.

      Now right click on main window -> create -> template

      now design your template into rows and columns according to your need.

      Then wright click on Template -> Create -> text element

      double click on text element -> click on Output Option tab an give the value of line - column,

      continue to create text element for each box and assign line - column value.

      Now you can drag and drop your fields from work area to the text element.

  • Posted on Dec 04, 2013 at 09:13 AM

    Hi-

    Follow below steps:

    Simple logic is to define a new internal table with 3 columns and fill this table based on your it_tab entries.

    Use below sample code:

    TYPES: BEGIN OF t_itab,

    val1 TYPE i,

    END OF t_itab,

    BEGIN OF t_final,

    val1 TYPE i,

    val2 TYPE i,

    val3 TYPE i,

    END OF t_final.

    DATA: itab TYPE STANDARD TABLE OF t_itab,

    wa_itab TYPE t_itab,

    it_final TYPE STANDARD TABLE OF t_final,

    wa_final TYPE t_final.

    wa_itab-val1 = 1.

    APPEND wa_itab TO itab.

    wa_itab-val1 = 2.

    APPEND wa_itab TO itab.

    wa_itab-val1 = 3.

    APPEND wa_itab TO itab.

    wa_itab-val1 = 4.

    APPEND wa_itab TO itab.

    wa_itab-val1 = 5.

    APPEND wa_itab TO itab.

    wa_itab-val1 = 6.

    APPEND wa_itab TO itab.

    WRITE: 'Before Alignment'.

    LOOP AT itab INTO wa_itab.

    WRITE: / wa_itab-val1.

    ENDLOOP.

    ULINE.

    LOOP AT itab INTO wa_itab.

    CLEAR: WA_FINAL.

    READ TABLE ITAB INTO WA_ITAB INDEX 1.

    IF SY-SUBRC = 0.

    WA_FINAL-VAL1 = WA_ITAB-VAL1.

    DELETE ITAB INDEX 1.

    ENDIF.

    READ TABLE ITAB INTO WA_ITAB INDEX 1.

    IF SY-SUBRC = 0.

    WA_FINAL-VAL2 = WA_ITAB-VAL1.

    DELETE ITAB INDEX 1.

    ENDIF.

    READ TABLE ITAB INTO WA_ITAB INDEX 1.

    IF SY-SUBRC = 0.

    WA_FINAL-VAL3 = WA_ITAB-VAL1.

    DELETE ITAB INDEX 1.

    ENDIF.

    APPEND WA_FINAL TO IT_FINAL.

    ENDLOOP.

    LOOP AT IT_FINAL INTO WA_FINAL.

    WRITE: / WA_FINAL-VAL1, WA_FINAL-VAL2, WA_FINAL-VAL3.

    ENDLOOP.

    output for the same:

    Now once you have your final internal table you can create a table in Smart Form and loop over this table. This should work.

    -Venkat


    Capture.JPG (15.3 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2013 at 08:16 AM

    Is your number of columns are fixed? say in example 3.

    Regards,

    Venkat

    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.