cancel
Showing results for 
Search instead for 
Did you mean: 

Attaching 3 smartforms to a Print Program

Former Member
0 Kudos

Hi Friends,

We have one print program & have one smart forms.I want to attach another 3 forms to this print program.As in selection screen according to personnel no it will fetch different forms and print.

Pls help me out with sample program.

Thanks & Regards,

Singha

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Generate the function module for Each form.

For Eg:Form---Form1,

form-----form2,

Form----Form3.

If personnel no = 'x'.

Call Function'Form1'.

Elseif personnel no = 'y'.

Call Function'Form2'.

else.

Call Function'Form3'.

Endif.

Thanks and Regards,

Shiva.

Former Member
0 Kudos

Hi,

To do this query declare a variable v_form to hold the form name.

create three forms FORM1, FORM2, FORM3according to the requirement.

create a print program, in that fetch all the data for the three forms.

create three radiobuttons rad1, rad2 rad3 of same group on the selection screen.

if rad1 = 'X'.

v_form = 'FORM1'.

elseif rad2 = 'X'.

v_form = 'FORM2'.

elseif rad3 = 'X'.

v_form = 'FORM3'.

endif.

call function open_group.

pass the parameter v_form.

if rad1 = 'X'.

loop at itab1.

call function write_form.

endloop.

elseif rad2 = 'X'.

loop at itab2.

call function write_form.

endloop.

elseif rad3 = 'X'.

loop at itab3.

call function write_form.

endloop.

endif.

call function close_form.

Reward.

former_member609120
Contributor
0 Kudos

Based on input from selection screen, pass the necessary smartform name to the function module.

Selection screen you can have 3 radio buttons.

AT SELECTION-SCREEN.

if RB = '1'.

formname = 'ABC'.

elseif RB = '2'.

formname = 'PQR'.

elseif RB = '3'.

formname = 'XYZ'.

endif.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'formname'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = GV_FMNAME

  • 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.

Data: GV_FMNAME TYPE RS38L_FNAM.

CALL FUNCTION GV_FMNAME

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

IM_NAME1 = WA_ADDR-NAME1

IM_MATNR = WA_HEADER-MATNR

IM_MAKTX = WA_HEADER-MAKTX

IM_CHARG = WA_HEADER-CHARG

IM_GAMNG = WA_HEADER-GAMNG

IM_SBMNG = WA_HEADER-SBMNG

IM_AUFNR = P_AUFNR

IM_BUDAT = WA_HEADER-BUDAT

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

IM_RESB = IT_RESB2

  • 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.