cancel
Showing results for 
Search instead for 
Did you mean: 

Form printing

Former Member
0 Kudos

Hi,

How can we generate a smartform from a report? Give example?

Rgds,

khadeer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

It is by using SSF_FUNCTIONMODULE_NAME function module.

It captures the FM released by smart form.

In the below coadind menction ur smart form name.

if any parameters to be passed to smartform from report then usse 2nd FM i.e lf_name which is of type rs38l_fnam.

in the below example i am passing a value of p_ebeln to gv_ebeln . gv_ebeln is declared in smartform -> form interface->import parameters

Coding

report zmm_1060_purchase_order.

data: lf_name type rs38l_fnam.

parameters: p_ebeln type ebeln .

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'SMART FORM NAME'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

fm_name = lf_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.

else.

  • Execute the Smartform name

call function lf_name

exporting

gv_ebeln = p_ebeln

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.

endif.

Regards,

vijetha.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

here is sample code to execute the Smartform from ABAP program

REPORT ZSALES_PRINT NO STANDARD PAGE HEADING.

DATA FLAG(1).

DATA: FORM_NAME(30) VALUE 'ZSALES_PRINT'.

DATA: FM_NAME TYPE RS38L_FNAM.

PARAMETERS: VBELN LIKE VBAK-VBELN OBLIGATORY,

KUNNR LIKE VBAK-KUNNR OBLIGATORY.

DATA: BEGIN OF ZITAB OCCURS 0.

INCLUDE STRUCTURE VBAP.

DATA: END OF ZITAB.

DATA ZITAB1 LIKE ZITAB OCCURS 0 WITH HEADER LINE.

DATA: SVBELN TYPE DDSHRETVAL.

TABLES: VBAK, VBAP.

START-OF-SELECTION.

SELECT SINGLE * FROM VBAK WHERE VBELN = VBELN

AND KUNNR = KUNNR.

SELECT * FROM VBAP INTO CORRESPONDING FIELDS OF TABLE ZITAB

WHERE VBELN = VBAK-VBELN .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = FORM_NAME

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

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 FM_NAME

EXPORTING

VBELN = VBELN

KUNNR = KUNNR

FLAG = FLAG

TABLES

ZITAB = ZITAB

ZITAB1 = ZITAB1.

Regards,

Jagadeesh.

former_member181995
Active Contributor
0 Kudos

Khadeer,

check below thread:

Former Member
0 Kudos
  • Variables declarations

v_form_name type rs38l_fnam,

v_len_in like sood-objlen,

v_len_out like sood-objlen,

v_len_outn type i,

v_lines_txt type i,

v_lines_bin type i.

data : t_bsid type standard table of zfr_efl_evcda_letter with header line.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZFR_EFL_SCHEM_COMPLN_LETTER' Smartform name

importing

fm_name = v_form_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.

w_ctrlop-getotf = 'X'.

w_ctrlop-no_dialog = 'X'.

w_compop-tdnoprev = 'X'.

pass the value into the smartform like this

call function v_form_name

exporting

control_parameters = w_ctrlop

output_options = w_compop

user_settings = 'X'

importing

job_output_info = w_return

tables

t_zfr_efl_evcda = t_bsid[]

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.

Regards

Anbu

Former Member
0 Kudos

Hi khadeer,

First create the smartform as per your requirment

and activate the smartform,function module is generated

automatically.

Check the function module that is generated when the Smart Form is activated by clicking on Environment à Function Module Name.

Then in your report program using pattern

call the function module which had been generated

by the smartform.

http://www.sap-img.com/smartforms/smartform-tutorial.htm

Regards,

Sravanthi