12-04-2013 8:09 AM
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
12-04-2013 8:11 AM
Hi,
you have to declare a second internal table corresponding to the structure of your smartforms table
regards
Fred
12-04-2013 8:11 AM
Hi,
you have to declare a second internal table corresponding to the structure of your smartforms table
regards
Fred
12-04-2013 8:24 AM
12-04-2013 8:16 AM
Is your number of columns are fixed? say in example 3.
Regards,
Venkat
12-04-2013 8:24 AM
12-04-2013 8: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..
12-04-2013 8:37 AM
Hi Farid,
Is it create template like below ?
Anyway, how to drag and drop ?
12-04-2013 8:40 AM
you will have to make a loop on your table, and in the logic of your screen you must loop 3 times to put the value of one line.
It's not possible, forget to break your brain. Create an internal table with 3 columns, make a simple conversion.
Fred
12-04-2013 8:48 AM
Hi Fred,
May I ask how to convert the internal table from 1 column into 3 columns ?
12-04-2013 8:54 AM
Create an internal table in smartform with three columns. lets say GT_ITAB has COL1/COL2/COL3 under global types.
then initialization
LOOP AT GT_TAB1_COL.
fill the data as per your need into GT_ITAB
ENDLOOP
12-04-2013 9:17 AM
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.
12-04-2013 9: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