Smart forms is very similar to SAP scripts . This is also a tool which is extensively used to creat layouts and then a separate print program is created. This print program is used to create the output internal table which ibn turn is thrown to the smart form where the field values are displayed . In the print program mentioned below ...an output internal table is created by populating certain fields from database tables into it . Once the output internal table is ready , then the function module SSF_FUNCTION_MODULE_NAME is called . Here , in the import parameters , the name of the smartform is given . The output of this function module is the name of another function module . This function module is again called , in this examplpe , the name of the function module is "/1BCDWB/SF00000007" . The output of this function module is the output internal table that we have created earlier in the program i.e.. I_YCUSTOMER . So , in case of smart forms , we use 2 function modules for the processing of the smartform. Once this internal table is thrown from the smart form , then in the layout , the required fields can be displayed . This is how a smartform works.
REPORT YSMARTLOK .
TABLES: YCUSTOMER.
DATA : FM_NAME TYPE RS38L_FNAM.
TYPES : BEGIN OF T_YCUSTOMER, YKUNNR LIKE YCUSTOMER-YKUNNR, YLAND1 LIKE YCUSTOMER-YLAND1, YNAME1 LIKE YCUSTOMER-YNAME1, YNAME2 LIKE YCUSTOMER-YNAME2, YORT01 LIKE YCUSTOMER-YORT01, END OF T_YCUSTOMER.
DATA : I_YCUSTOMER TYPE STANDARD TABLE OF T_YCUSTOMER WITH HEADER LINE .
DATA : WA_YCUSTOMER TYPE T_YCUSTOMER.
SELECT * FROM YCUSTOMER INTO TABLE I_YCUSTOMER.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = 'YSMARTLOK' * VARIANT = ' ' * DIRECT_CALL = ' ' * IMPORTING FM_NAME = FM_NAME * 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 '/1BCDWB/SF00000007' * 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 = TABLES I_YCUSTOMER = I_YCUSTOMER * 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. |