Using Global Variables and initialization in Smartforms

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.

Using global definitions in smartforms

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.

Using global definitions in smartforms

Go to global data tab, create a variable of type ty_mara.

Using global definitions in smartforms

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

Using global definitions in smartforms

Expand page, double click on main window, right click on main window -> create -> text.

Using global definitions in smartforms

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.

Using global definitions in smartforms

In the same way add other fields also.

Using global definitions in smartforms

Save, activate and execute(F8).

You will go to a function module.

Just execute.

Execute again.

Provide output device as LP01.

Using global definitions in smartforms

Smartform is displayed.

Using global definitions in smartforms

Learner Questions


No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 41 People out of 43 think this lesson helpful


    Lesson Navigation

    ←Previous Chapter
    Next Chapter →