In the below lesson, you will be able to learn using tables in smartforms using tables element.
Go to T-code SMARTFORM, provide name ZSAPN_TABLE and click on create.
Click on global definitions, add a structure under types tab.
Click on global data and add parameters as below.
Go to initialization tab, add output parameter as IT_MARA and add below code get materials.
Expand page, right click on main window -> create -> table.
Whenever we create a table, header, main area, footer for the table will be created automatically.
Now we need to draw columns, we know smartforms is a GUI designer, we need to design table columns, to create table columns go to table tab, click on pencil icon and draw five vertical lines( no of lines = internal table fields).
Click on details to specify size of column.
Specify sizes as below.
Go main view, output options and specify width, height as below.
Right click on header -> create -> table line
Select line type from drop down.
Right click on each cell, create -> text to create column headers.
Go to general attributes tab and provide text as Material No.
Similarly create column header texts for all cells as below.
Base Unit of measure
Double click on main area, create -> table line.
Select a table line %LTYPE1 from drop down.
Click on insert icon, a popup will come and provide variable as &wa_mara-matnr&, enter.
Similarly create text for all cells and insert respective variables as below.
Double click on table, go to tab data and loop internal table as below.
Save, activate and execute (F8).