cancel
Showing results for 
Search instead for 
Did you mean: 

doubt in smartform

Former Member
0 Kudos

Hi All ,

I have created Smartform for Invoice printing in which invoice no is input field ( Parameter field ) and i pass one internal table to smartform function module corresponds to that invoice no .

Now requirement is to change invoice no from parameter field to select-option ( for range ) so that multple invoice can be printed Simultaneously .

How , it can be done and how data will be passed for select-options .

on change of Invoice No page has to be changed ?

Regards

Mohit Bansal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

here i m giving program to you.

in Smartforms you are goin to use 'SSF_FUNCTION_MODULE_NAME' to call the functionmodule generated.

check the sample code

DATA: ls_print_data_to_read TYPE lbbil_print_data_to_read.

DATA: ls_bil_invoice TYPE lbbil_invoice.

DATA: lf_fm_name TYPE rs38l_fnam.

DATA: ls_control_param TYPE ssfctrlop.

DATA: ls_composer_param TYPE ssfcompop.

DATA: ls_recipient TYPE swotobjid.

DATA: ls_sender TYPE swotobjid.

DATA: lf_formname TYPE tdsfname.

DATA: ls_addr_key LIKE addr_key.

DATA: ls_dlv-land LIKE vbrk-land1.

DATA: ls_job_info TYPE ssfcrescl.

  • SmartForm from customizing table TNAPR

lf_formname = tnapr-sform.

  • determine print data

PERFORM set_print_data_to_read USING lf_formname

CHANGING ls_print_data_to_read

cf_retcode.

IF cf_retcode = 0.

  • select print data

PERFORM get_data USING ls_print_data_to_read

CHANGING ls_addr_key

ls_dlv-land

ls_bil_invoice

cf_retcode.

ENDIF.

IF cf_retcode = 0.

PERFORM set_print_param USING ls_addr_key

ls_dlv-land

CHANGING ls_control_param

ls_composer_param

ls_recipient

ls_sender

cf_retcode.

ENDIF.

IF cf_retcode = 0.

  • determine smartform function module for invoice

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING formname = lf_formname

  • variant = ' '

  • direct_call = ' '

IMPORTING fm_name = lf_fm_name

EXCEPTIONS no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc 0.

  • error handling

cf_retcode = sy-subrc.

PERFORM protocol_update.

ENDIF.

ENDIF.

IF cf_retcode = 0.

PERFORM check_repeat.

IF ls_composer_param-tdcopies EQ 0.

nast_anzal = 1.

ELSE.

nast_anzal = ls_composer_param-tdcopies.

ENDIF.

ls_composer_param-tdcopies = 1.

DO nast_anzal TIMES.

  • In case of repetition only one time archiving

IF sy-index > 1 AND nast-tdarmod = 3.

nast_tdarmod = nast-tdarmod.

nast-tdarmod = 1.

ls_composer_param-tdarmod = 1.

ENDIF.

IF sy-index NE 1 AND repeat IS INITIAL.

repeat = 'X'.

ENDIF.

  • call smartform invoice

CALL FUNCTION lf_fm_name

EXPORTING

archive_index = toa_dara

archive_parameters = arc_params

control_parameters = ls_control_param

  • mail_appl_obj =

mail_recipient = ls_recipient

mail_sender = ls_sender

output_options = ls_composer_param

user_settings = space

is_bil_invoice = ls_bil_invoice

is_nast = nast

is_repeat = repeat

importing job_output_info = ls_job_info

  • document_output_info =

  • job_output_options =

EXCEPTIONS formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc 0.

  • error handling

cf_retcode = sy-subrc.

PERFORM protocol_update.

  • get SmartForm protocoll and store it in the NAST protocoll

PERFORM add_smfrm_prot.

ENDIF.

ENDDO.

  • get SmartForm spoolid and store it in the NAST protocoll

DATA ls_spoolid LIKE LINE OF ls_job_info-spoolids.

LOOP AT ls_job_info-spoolids INTO ls_spoolid.

IF ls_spoolid NE space.

PERFORM protocol_update_spool USING '342' ls_spoolid

space space space.

ENDIF.

ENDLOOP.

ls_composer_param-tdcopies = nast_anzal.

IF NOT nast_tdarmod IS INITIAL.

nast-tdarmod = nast_tdarmod.

CLEAR nast_tdarmod.

ENDIF.

regards,

Vipul

Former Member
0 Kudos

Hi Mohit,

There are various ways of doing the thing.

One way is to select the Invoice numbers in the driver program and pass it to the function module one by one.

Like:

You are looping on a table which contains the Invoice Numbers:-

Call the function module of the smartform and pass the invoice no to the function module. (It will process the smartform with that invoice number)

Endloop. (So that for the new loop the new invoice number will be passed to the smartform and the processing will be with the new onvoice number).

Second way is to pass the whole invoice numbers to the Smartform as the parameter in which you are passing the invoice number is a table. So just append the invoice numbers and pass as a whole to the smartform and in the smartform set a table to do the looping and in that set the sort ascending by invoice number and choose the at new properties of the table and set a process control to trigger a new Page. This will trigger each and every invoice from a fresh page.

Try this, Hope that will work.

Check out and revert back.

Warm Regards.

Abhijit