07-05-2006 6:32 PM
hi guys,
I am very much new to SMART FORMS and i need to output text thro windows in smart forms and i did it using text editor but i did not see any output when i took the test print. Can you please tell me, do we need to write the logic in the text editor or some where else.
information regarding this is kindly appreciated.
thanks
pavan.
07-05-2006 6:34 PM
hi pavan,
u have to write a driver program which calls the smartform
check this sample code
tABLES: KNA1,KNB1.
DATA: BEGIN OF IT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
BUKRS LIKE KNB1-BUKRS,
NAME1 LIKE KNA1-NAME1,
REGIO LIKE KNA1-REGIO,
LAND1 LIKE KNA1-LAND1,
END OF IT_KNA1.
DATA: V_FNAME TYPE RS38L_FNAM.
selection-screen:begin of block blk1 with frame title text-001.
select-options:s_KUNNR for KNA1-KUNNR.
selection-screen:end of block blk1.
SELECT A~kunNR
B~BUKRS
A~NAME1
A~REGIO
A~LAND1
FROM KNA1 AS A
INNER JOIN KNB1 AS B ON AKUNNR = BKUNNR
INTO TABLE IT_KNA1
WHERE A~KUNNR IN S_KUNNR.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = <smartform name>
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = V_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 '/1BCDWB/SF00000778'( function module generated by the smartform)
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
T_KNA1 = IT_KNA1
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.
Message was edited by: Priya
07-05-2006 6:48 PM
Hi pavan,
When you create the form by SMARTFORMS, system will automatically create the function module for called by ABAP/4. You can get this function module by apply function module "SSF_FUNCTION_MODULE_NAME" and send the form name. This function will return the function name for call SMARTFORMS that you created.
Example
DATA: smf_name TYPE TDSFNAME VALUE ZSMARTFORM01, fn_name TYPE RS38L_FNAM.
CALL FUNCTION SSF_FUNCTION_MODULE_NAME
EXPORTING
FORMNAME = smf_name
IMPORTING
FM_NAME = fn_name.
CALL FUNCTION fn_name
EXPORTING WA = wa_doc.
hope this helps,
reward if helpful.
regards,
keerthi.