Using global definitions, structures and initialization in smartforms
+ -
In the below example we will learn.
- Using global decelerations in smartforms.
- Using user defined structures.
- Using initialization of data.
Go to T-code, SMARTFORMS, provide name as ZSAPN_GLOBAL_INIT and click create.
Double click on global definitions, go to types tab and add below code.
types: BEGIN OF ty_mara,
matnr type mara-matnr,
mbrsh type mara-mbrsh,
mtart type mara-mtart,
matkl type mara-matkl,
meins type mara-meins,
END OF ty_mara.
matnr type mara-matnr,
mbrsh type mara-mbrsh,
mtart type mara-mtart,
matkl type mara-matkl,
meins type mara-meins,
END OF ty_mara.
Go to global data tab, create a variable of type ty_mara.
Go to initialization tab, add output parameter as wa_mara, add below code to get material details.
select SINGLE * FROM mara
into CORRESPONDING FIELDS OF wa_mara
WHERE matnr = '000002-000'.
**Material no must be in MARA
into CORRESPONDING FIELDS OF wa_mara
WHERE matnr = '000002-000'.
**Material no must be in MARA
Expand page, double click on main window, right click on main window -> create -> text.
Go to general attributes tab.
Add a label, click on insert field, a popup will come provide variable name by adding '&' at beginning and ending.
In the same way add other fields also.
Save, activate and execute(F8).
You will go to a function module.
Just execute.
Execute again.
Provide output device as LP01.
Smartform is displayed.
No comments:
Post a Comment