ABAP Smart form implementation from program

We can write one sample program for smart form that will show a simple text .

Please click  here  for creating smart form for simple text.

After creating the smart form follow the below steps for creating sample program for the smart form.

1. Go to SE38 and create the report.

2. Call the function module SSF_FUNCTION_MODULE_NAME and give the Smart form name

3. This function module will give the function module for the smart form.

4. Then call the function module again. Please refer the following program.

Here you may ask why I didnot call the smart form function module directly? The answer is smart form function module is system generated and will differs for while we transport to production. For more details refer here.

REPORT    ZSMART_FORM

data: fname type RS38L_FNAM.

CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’

EXPORTING

formname                 = ‘ZTEST_KM1′

*   VARIANT                  = ‘ ‘

*   DIRECT_CALL              = ‘ ‘

IMPORTING

FM_NAME                  = fname

* EXCEPTIONS

*   NO_FORM                  = 1

*   NO_FUNCTION_MODULE       = 2

*   OTHERS                   = 3

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION fname

* EXPORTING

*   ARCHIVE_INDEX              =

*   ARCHIVE_INDEX_TAB          =

*   ARCHIVE_PARAMETERS         =

*   CONTROL_PARAMETERS         =

*   MAIL_APPL_OBJ              =

*   MAIL_RECIPIENT             =

*   MAIL_SENDER                =

*   OUTPUT_OPTIONS             =

*   USER_SETTINGS              = ‘X’

* IMPORTING

*   DOCUMENT_OUTPUT_INFO       =

*   JOB_OUTPUT_INFO            =

*   JOB_OUTPUT_OPTIONS         =

* EXCEPTIONS

*   FORMATTING_ERROR           = 1

*   INTERNAL_ERROR             = 2

*   SEND_ERROR                 = 3

*   USER_CANCELED              = 4

*   OTHERS                     = 5

.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Comments

Leave A Reply