on 05-07-2008 7:53 PM
What are the steps to call and print the Smart Form from the Print program?
(The situation has been such that I have to fetch data and print the Smart Form from the same Print program).
Please guide me. It is very urgent.
Thanks in advance.
Hi
check this program
DATA : it_ekpo TYPE z50871_ekpo_t.
DATA : wa_ekko TYPE z50871_ekko_s,
wa_lfa1 TYPE z50871_lfa1_s.
*Variable Declarations
DATA : v_funcname TYPE rs38l_fnam, "Function Module Name
v_ebeln TYPE ebeln. "Purchase Document Number
----
SELECTION-SCREEN
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE tit1.
PARAMETERS : p_ebeln TYPE ekko-ebeln OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
----
INITIALIZATION
----
INITIALIZATION.
tit1 = text-001.
----
AT SELECTION-SCREEN
----
AT SELECTION-SCREEN ON p_ebeln.
PERFORM validate_ebeln.
----
START-OF-SELECTION
----
START-OF-SELECTION.
PERFORM get_headerdata.
PERFORM get_itemdata.
PERFORM get_vendordata.
PERFORM call_smartform.
&----
*& Form get_headerdata
&----
FORM get_headerdata.
SELECT SINGLE ebeln bstyp bsart aedat ernam
INTO wa_ekko
FROM ekko
WHERE ebeln = p_ebeln.
ENDFORM. "get_headerdata
&----
*& Form get_vendordata
&----
FORM get_vendordata.
SELECT SINGLE lflifnr lfname1 lfort01 lfland1 lf~adrnr
INTO wa_lfa1
FROM lfa1 AS lf INNER JOIN ekko AS ek
ON lflifnr = eklifnr
WHERE ek~ebeln = p_ebeln.
ENDFORM. "get_vendordata
&----
*& Form get_itemdata
&----
FORM get_itemdata.
SELECT ebelp ematn matkl netpr
INTO TABLE it_ekpo
FROM ekpo
WHERE ebeln = p_ebeln.
ENDFORM. "get_itemdata
&----
*& Form validate_ebeln
&----
FORM validate_ebeln.
SELECT SINGLE ebeln
FROM ekko
INTO v_ebeln
WHERE ebeln = p_ebeln.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH 'Purchase Document Number Is Invalid'(002).
EXIT.
ENDIF.
ENDFORM. "VALIDATE_EBELN
&----
*& Form CALL_SMARTFORM
&----
FORM call_smartform.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z50871MM_SMARTFORM'
IMPORTING
fm_name = v_funcname
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.
****/1BCDWB/SF00000721
CALL FUNCTION v_funcname
EXPORTING
wa_lfa1 = wa_lfa1
wa_ekko = wa_ekko
TABLES
it_ekpo = it_ekpo[]
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.
ENDFORM. "CALL_SMARTFORM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u very much for ur answer.
But I am facing a problem.
When I am calling the SF with the help of following code----
******************************************************************
START-OF-SELECTION.
Perform Final_data.
perform smart_form.
****************************************************************
Form smart_form.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCAPTIVE_IN_SMFORM'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
endif.
COMMIT WORK AND WAIT.
call function fm_name1
TABLES
item_final = item_final
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.
COMMIT WORK AND WAIT.
Endform.
****************************************************************
But after this code I am getting the Print Screen but when I am clicking 'Prient Preview', it is going to the debug mode, it is not showing the 'Smartform'.
I will be highly oblized if u guide. I need it urgently.
Thanks in advance.
Hi,
Please Check this link
Reward Points If Usefull
Regards
Fareedas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u very much for ur answer.
But I am facing a problem.
When I am calling the SF with the help of following code----
******************************************************************
START-OF-SELECTION.
Perform Final_data.
perform smart_form.
****************************************************************
Form smart_form.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCAPTIVE_IN_SMFORM'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
endif.
COMMIT WORK AND WAIT.
call function fm_name1
TABLES
item_final = item_final
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.
COMMIT WORK AND WAIT.
Endform.
****************************************************************
But after this code I am getting the Print Screen but when I am clicking 'Prient Preview', it is going to the debug mode, it is not showing the 'Smartform'.
I will be highly oblized if u guide. I need it urgently.
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
first, as in case of report, declare all internal tables n all in print program. fetch the data into them.
design a layout, as per your requirement i.e. smartform.
now in the smartform -> form interface -> define the variables, internal tables which u want to pass to this smartform from print program.
note: make sure that, the associated types should exist in dictionary. then only it accepts.
(hope u got my point, if not, i'll explain.
u want to pass itab from print program, then in form interface, u should declare it as itab type mara. here make sure that the associate type (mara) exist in dictionary. otherwise it wont accept.)
now, in print program, call the function module: SSF_FUNCTION_MODULE_NAME.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = <ur smartform name>
IMPORTING
FM_NAME = form
here the form is:
data: form type rs38l_fnam.
now the 'form' holds the function module generated for ur smartform. so u need to call that now.
CALL FUNCTION FORM
EXPORTING
SPECIFY ALL THE PARAMETERS WHICH U SPECIFIED IN FORM INTERFACE OF SMARTFORM AS EXPORT PARAMETERS, n pass the values for them.
this is the procedure to run a smartform using print program.
hope this is clear for u.
if u have any doubts, plz post them back.
refer the below link, it have small example about how to work with print program:
[http://saptechnical.com/Tutorials/Smartforms/SimpleDriverProgram/Demo.htm]
reward if helpful.
Edited by: Mytri on May 8, 2008 4:37 AM
Edited by: Mytri on May 8, 2008 4:40 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u very much for ur answer.
But I am facing a problem.
When I am calling the SF with the help of following code----
******************************************************************
START-OF-SELECTION.
Perform Final_data.
perform smart_form.
****************************************************************
Form smart_form.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCAPTIVE_IN_SMFORM'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
endif.
COMMIT WORK AND WAIT.
call function fm_name1
TABLES
item_final = item_final
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.
COMMIT WORK AND WAIT.
Endform.
****************************************************************
But after this code I am getting the Print Screen but when I am clicking 'Prient Preview', it is going to the debug mode, it is not showing the 'Smartform'.
I will be highly oblized if u guide. I need it urgently.
Thanks in advance.
Hello
write something like this...
DATA: fm_smartform TYPE rs38l_fnam,
fm_name TYPE rs38l_fnam.
CASE sel.
WHEN '1'.
fm_name = 'ZMM_**'.
WHEN '2'.
fm_name = 'ZMM_**22'.
ENDCASE.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = fm_name
IMPORTING
fm_name = fm_smartform.
CALL FUNCTION fm_smartform
TABLES
ti_contbys = ti_output
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.
Bye!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u very much for ur answer.
But I am facing a problem.
When I am calling the SF with the help of following code----
******************************************************************
START-OF-SELECTION.
Perform Final_data.
perform smart_form.
****************************************************************
Form smart_form.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCAPTIVE_IN_SMFORM'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = fm_name1
exceptions
no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
endif.
COMMIT WORK AND WAIT.
call function fm_name1
TABLES
item_final = item_final
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.
COMMIT WORK AND WAIT.
Endform.
****************************************************************
But after this code I am getting the Print Screen but when I am clicking 'Prient Preview', it is going to the debug mode, it is not showing the 'Smartform'.
I will be highly oblized if u guide. I need it urgently.
Thanks in advance.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.