on 02-12-2009 6:39 AM
Hi Experts,
I am new to SmartForms and not quite aware on how it works. I have one final internal table, where I have all the required data, some around 12 coulmns and 25 rows. I want this output to be displayed in a SmartForm and then in a PDF.
Can anyone of you guide me to achieve my goal.
Thanks,
Chandan
Follow the below link on how t create a Table in Smartform :
Link: [Create Table | http : //sa ptechnical.com/Tutorials/Smartforms/Table/Create.htm]
Using the below code u can convert u r smartform into PDF :
*&---------------------------------------------------------------------*
*& Form F_CONVERT_PDF
*&---------------------------------------------------------------------*
FORM F_CONVERT_PDF .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = W_FORM_NAME
IMPORTING
FM_NAME = W_FMODULE
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
W_CPARAM-NO_DIALOG = 'X'.
W_CPARAM-PREVIEW = SPACE.
W_CPARAM-GETOTF = 'X'.
CALL FUNCTION W_FMODULE
EXPORTING
CONTROL_PARAMETERS = W_CPARAM
OUTPUT_OPTIONS = W_OUTOPTIONS
W_NAMEV = KNVK-NAMEV
W_NAME1 = KNVK-NAME1
W_TELF1 = KNVK-TELF1
W_ABTNR = KNVK-ABTNR
W_AEDAT = EKKO-AEDAT
W_UNSEZ = EKKO-UNSEZ
W_WAERS = EKKO-WAERS
W_ZTERM = EKKO-ZTERM
W_TELF = EKKO-TELF1
W_BANFN = EKPO-BANFN
W_EBELN = EKPO-EBELN
WA_T001W = T001W
W_ADRNR = W_ADRNR
W_ADRNR1 = W_ADRNR1
W_PSPID = W_PSPID
SPELL = W_SPELL
W_NETWR = W_NETWR
W_CST = W_CST
W_VAT = W_VAT
W_SERT = W_SERT
W_ED_R = W_ED_R
W_ED_A = W_ED_A
W_ECESS_R = W_ECESS_R
W_ECESS_A = W_ECESS_A
W_HCESS_R = W_HCESS_R
W_HCESS_A = W_HCESS_A
W_VAT_R = W_VAT_R
W_VAT_A = W_VAT_A
W_CST_R = W_CST_R
W_CST_A = W_CST_A
W_FR_R = W_FR_R
W_FR_A = W_FR_A
W_OCT_R = W_OCT_R
W_OCT_A = W_OCT_A
W_PF_R = W_PF_R
W_PF_A = W_PF_A
W_ST_R = W_ST_R
W_ST_A = W_ST_A
W_GT_R = W_GT_R
W_GT_A = W_GT_A
WA_ADRC = ADRC
W_POST1 = W_POST1
W_BANFN1 = W_BANFN1
W_TEXT = W_TEXT
IMPORTING
JOB_OUTPUT_INFO = T_OTF_FROM_FM
TABLES
IT_FINAL = IT_FINAL
IT_F01 = IT_TEXT
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
T_OTF[] = T_OTF_FROM_FM-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
CHANGING
FILENAME = W_FILE_NAME
PATH = W_FILE_PATH
FULLPATH = W_FULL_PATH
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF W_FULL_PATH IS NOT INITIAL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
FILENAME = W_FULL_PATH
FILETYPE = 'BIN'
TABLES
DATA_TAB = T_PDF_TAB.
MESSAGE S000 WITH 'File Downloaded Successfully'.
ELSE.
MESSAGE S000 WITH 'Cancelled by user'.
ENDIF.
ENDFORM. " F_CONVERT_PDF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandan
i have written a WIKI on this with all examplels and screen shots.
It will be helpful for you.
[https://wiki.sdn.sap.com/wiki/display/ABAP/SMARTFORMguide]
You can also visit this link also to learn how to get th totals in the smartforms.
[https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALINSAP+SMARTFORMS]
Regards
Hareesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To get smartform output, try this as per your requirement,
Determine smartform function module.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname " Smartform name
IMPORTING
fm_name = lf_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.
wa_control-no_dialog = ''.
wa_control-preview = 'X'.
wa_control-no_open = 'X'.
wa_control-no_close = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = wa_control
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
error handling
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
CALLING THE SMARTFORM
CALL FUNCTION lf_fm_name
EXPORTING
control_parameters = wa_control
output_options = ls_composer_param
v_from_date = s_budat-low
v_to_date = s_budat-high
v_days = p_days
TABLES
t_final = it_pos " Output internal table
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.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
error handling
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
To convert smartform's output to OTF form go through the link given below :
Regards,
Joan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in smartforms you can create the table in main window split the cells how many you want and pass the internal table and using work area in TABLE--> DATA tab.
when you excute the print program through some tcode it will generate the spool number using the spool number convert the PDF file. for this use program RSTXPDFT4 with submit action by passing the spool number....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.