‎2011 Jul 27 3:46 PM
Hi to all,
I would like to use transaction VF31 to reprint invoices in a program. I would like to loop at my internal table and calling VF31 for every record and for two different Output types. I would like to use command CALL TRANSACTION and avoid using a recording from SHDB to populate the different screen fields. I am struggling in populating the parameters.
I have read a bunch of old threads referring to VF31 but I cannot find one with some coding examples. Can anyone send me some coding blocks or refer me to any old threads?
Thank you very much.
BR,
Sylvain
‎2011 Jul 27 4:51 PM
Hi Sylvain,
Have you tried to run this report (SD70AV3A) in background mode? I've tried it and it prints all the selected invoices, and there's no list to be shown and there's also no need to click the checkboxes for the invoices you'd like to print.
So some coding could be:
DATA: name LIKE tbtcjob-jobname.
DATA: number LIKE tbtcjob-jobcount.
DATA: print_parameters TYPE pri_params.
name = 'INVOICE_PRINTING'.
RANGES: range FOR nase-kschl.
CLEAR: range.
REFRESH: range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'first_output_type'.
CLEAR: range-high.
APPEND range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'second_output_type'.
CLEAR: range-high.
APPEND range.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT sd70av3a WITH rg_kschl IN range
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
...
ENDIF.
ENDIF.
ENDIF.
I hope this helps. Kind regards,
Alvaro
‎2011 Jul 27 4:51 PM
Hi Sylvain,
Have you tried to run this report (SD70AV3A) in background mode? I've tried it and it prints all the selected invoices, and there's no list to be shown and there's also no need to click the checkboxes for the invoices you'd like to print.
So some coding could be:
DATA: name LIKE tbtcjob-jobname.
DATA: number LIKE tbtcjob-jobcount.
DATA: print_parameters TYPE pri_params.
name = 'INVOICE_PRINTING'.
RANGES: range FOR nase-kschl.
CLEAR: range.
REFRESH: range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'first_output_type'.
CLEAR: range-high.
APPEND range.
range-sign = 'I'.
range-option = 'EQ'.
range-low = 'second_output_type'.
CLEAR: range-high.
APPEND range.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT sd70av3a WITH rg_kschl IN range
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
...
ENDIF.
ENDIF.
ENDIF.
I hope this helps. Kind regards,
Alvaro
‎2011 Sep 08 9:38 AM
Hi Alvaro,
Thank you for your answer. It was really helpful.
Sylvain