Refresh : Gtd_out , Gtd_prps .
Gtd_prps = Gtd_list .
Loop At Gtd_listInto Gth_list Where Flag = 'X' .
Move-corresponding Gth_list To Gth_header .
Select Single Printdate Into Gth_header - PrintdateFrom Ztzrps002_n1
Where Rsnum = Gth_header - Rsnum And Aufnr = Gth_header - Aufnr And Vornr = Gth_header - Vornr And Pspid= Gth_header - Pspid And Posid = Gth_header - Posid .
"The User-Defined table ztzrps002_n1 reads the data after the printing is last stored.
IfSy-Subrc <>0.
Gth_header-Printdate=Sy-Datum. "Not printed, set to the current date
Endif.
data : v_output_info type ssfcrescl ,
v_output_options type ssfcompop ,
v_print_count ( 3 ) type C .
v_output_options - tdiexit = 'X' . "(this parameter must be passed so that the following outgoing parameter v_output_info-outputdone will not be assigned after clicking the back button on the smartform preview Interface)
CallFunction'Ssf _ function_module_name'
Exporting
Formname='Zpsf002 _ N1'
Importing
Fm_name=Gwk_fname.
Call Function Gwk_fname
Exporting
Output_options = V_output_options
Importing
Job_output_info = V_output_info
Exceptions
Formatting_error= 1
Internal_error = 2
Send_error = 3
User_canceled = 4
Others = 5 .
If Sy - Subrc = 0 . "After smartform is executed, execute hereCode
If V_output_info - Outputdone = 'X' "To determine whether the data is actually printed, store the data in the data table.
Loop At Gtd_header Into Gth_header .
Select Single Printdate Into Gth_header - Printdate From Ztzrps002_n1
Where Rsnum = Gth_header - Rsnum And Aufnr = Gth_header - Aufnr And Vornr = Gth_header - Vornr And Pspid = Gth_header - PspidAnd Posid = Gth_header - Posid .
If Sy - Subrc <> 0 .
Itab_wa - Rsnum = Gth_header - Rsnum .
Itab_wa - Aufnr = Gth_header - Aufnr .
Itab_wa - Vornr = Gth_header - Vornr .
Itab_wa - Pspid= Gth_header - Pspid .
Itab_wa - Posid = Gth_header - Posid .
Itab_wa - Printdate = Sy - Datum .
Modify Ztzrps002_n1 From Itab_wa .
Endif .
Endloop.