06-28-2006 3:36 PM
Hi All,
I have one issue in SAP SCript.
I have create a Z-TCode with first selection screen & if i execute from there i will get Output Data.
With <b>Sales Order Number & Diffrent Item No</b>
And in the same output i have placed 3 Push Buttons at the Application Tool Bar.
<b>1. Print
2. Print Preview</b>
Now if i select one Record and hit on <b>Print Preview</b> it will Call My <b>SAP Script OUt Put for View</b>. This is done and working correctly.
In The similar way if i select a record in output and hit on <b>Print button</b> i should be able to print SAP Script out put directly from Report Output.
Can anybody tell me how can i print the output directly.
Can anybody give the solution.
Thanks in advance.
Thanks & Regards,
Prasad.
06-28-2006 3:40 PM
Sure when doing the OPEN_FORM. Make it so that there is no-dialog, and that it knows the printer.
data: itcpo like itcpo.
clear itcpo.
itcpo-tddest = printer.
itcpo-tdimmed = 'X'.
itcpo-tddelete = 'X'.
itcpo-tdprogram = '<report_name>'.
call function 'OPEN_FORM'
exporting
form = '<form_name>
language = sy-langu
options = itcpo
dialog = ' '
exceptions
others = 1.
Regards,
Rich Heilman
06-28-2006 3:40 PM
Sure when doing the OPEN_FORM. Make it so that there is no-dialog, and that it knows the printer.
data: itcpo like itcpo.
clear itcpo.
itcpo-tddest = printer.
itcpo-tdimmed = 'X'.
itcpo-tddelete = 'X'.
itcpo-tdprogram = '<report_name>'.
call function 'OPEN_FORM'
exporting
form = '<form_name>
language = sy-langu
options = itcpo
dialog = ' '
exceptions
others = 1.
Regards,
Rich Heilman
06-29-2006 9:42 AM
Hi,
Thanks for your reply.
The reply you have given is correct and it will work.
But for me it is working in <b>Debug</b> Mode - That too in in <b>USER_COMMAND</b> Form.
When i remove Break Point from <b>USER_COMMAND</b> form it neither giving print preview nor print!
Can anybody tell me the reason for the same!
When i put Break-point in <b>USER_COMMAND</b> Form Both Direct Print & Print Preview are working.
I am ready give more information if required!
Can anybody solve this issue!
Thanks in advance.
Thanks & Regards,
Prasad.
06-29-2006 9:46 AM
Hi Prasad,
For Print,
g_control-no_dialog = 'X'.
g_output-tdimmed = 'X'.
For print preview.
g_control-no_dialog = 'X'.
06-29-2006 10:50 AM
Hi,
I am providing some of my code for more reference.
The code you have written is already in place.
<b>FORM f_build_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = i_events.
READ TABLE i_events WITH KEY name = c_user_command
INTO wa_events.
IF sy-subrc = 0.
MOVE c_command TO wa_events-form.
MODIFY i_events FROM wa_events INDEX sy-tabix.
ENDIF.
ENDFORM. " f_build_events
FORM f_build_layout .
i_gd_layout-no_input = space.
i_gd_layout-colwidth_optimize = c_x.
i_gd_layout-totals_text = 'Totals'(201). "#EC *
i_gd_layout-box_fieldname = 'SELECTED'.
i_gd_layout-box_tabname = 'I_DISPLAY_DATA'.
i_gd_layout-edit = c_x.
ENDFORM. " f_build_layout
FORM f_display_alv_report .
SET PF-STATUS c_alv.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = c_command
i_callback_pf_status_set = c_alv
is_layout = i_gd_layout
it_fieldcat = i_fieldcatalog[]
it_events = i_events
i_save = c_x
TABLES
t_outtab = i_display_data
EXCEPTIONS
program_error = 1
OTHERS = 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.
ENDFORM. " f_display_alv_report
FORM f_user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
CLEAR: v_field, v_index, v_line, v_value.
Get cursor field, value and Line
GET CURSOR FIELD v_field
VALUE v_value
LINE v_line.
v_line = v_line - 3.
READ TABLE i_display_data INDEX v_line.
IF sy-subrc EQ 0.
v_mem_kschl = p_kschl.
v_mem_vbeln = i_display_data-vbeln.
v_mem_posnr = i_display_data-posnr.
v_mem_printer = p_print.
EXPORT v_mem_kschl TO MEMORY ID 'KSCHL'.
EXPORT v_mem_vbeln TO MEMORY ID 'VBELN'.
EXPORT v_mem_posnr TO MEMORY ID 'POSNR'.
EXPORT v_mem_printer TO MEMORY ID 'PRINTER'.
ENDIF.
CASE p_ucomm.
To Print SAP Script Output
WHEN c_print.
v_mem_print = c_x.
EXPORT v_mem_print TO MEMORY ID 'PRINT'.
v_return_code = c_999.
v_screen = c_x.
IF ( v_field EQ c_mark OR
v_field EQ c_selected OR
v_field EQ c_vbeln OR
v_field EQ c_posnr OR
v_field EQ c_kschl ) AND
NOT v_value IS INITIAL.
PERFORM f_entry IN PROGRAM zasdf0012_sales_order
USING v_return_code v_screen.
ENDIF.
Display SAP Script Output
WHEN c_pripreview.
v_return_code = c_999.
v_screen = c_x.
IF ( v_field EQ c_mark OR
v_field EQ c_selected OR
v_field EQ c_vbeln OR
v_field EQ c_posnr OR
v_field EQ c_kschl ) AND
NOT v_value IS INITIAL.
PERFORM f_entry IN PROGRAM zasdf0012_sales_order
USING v_return_code v_screen.
ENDIF.
WHEN c_back.
BACK.
WHEN c_exit.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN 0.
WHEN c_cancel.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN 0.
WHEN c_others.
ENDCASE.
ENDFORM. " F_USER_COMMAND</b>
<b>In the above code c_command is F_USER_COMMAND and
c_user_command is USER_COMMAND.</b>
And in program the <b>OPEN_FORM</b> call is as below:
<b>FORM f_form_open.
Include for Opening the form for the corresponding Output Type
CLEAR itcpo.
IF sy-ucomm EQ c_prin.
itcpo-tddest = v_mem_printer.
itcpo-tdimmed = c_x.
itcpo-tddelete = c_x.
itcpo-tdprogram = c_program.
itcpo-tdpreview = space.
itcpo-tdnoprev = c_x.
v_x = space.
ELSEIF sy-ucomm EQ c_pripreview.
itcpo-tddest = v_mem_printer.
itcpo-tdimmed = c_x.
itcpo-tddelete = space.
itcpo-tdprogram = c_program.
itcpo-tdnoprev = space.
itcpo-tdpreview = c_x.
v_x = c_x.
ENDIF.
Open Form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = c_printer
language = sy-langu
options = itcpo
form = v_formname
dialog = v_x
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " F_FORM_OPEN</b>
So from the above code if i put Break-point in FORM <b>F_USER_COMMAND</b> only i am able to <b>Print</b> & view the <b>print Preview</b>.
If i remove the break-point both the operations are not working.
Can anybody give the solution for this issue.
Thanks in advance.
Thanks & Regards,
Prasad.
06-29-2006 10:56 AM
Hai Prasad
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING MODE = 'BATCH'
REPORT = 'MYREPORT'
IMPORTING OUT_PARAMETERS = PARAMS
VALID = VALID.
look into this link
http://help.sap.com/saphelp_nw04/helpdata/en/d5/6243ea8a4111d4b605006094192fe3/content.htm
Regards
Sreeni
06-29-2006 11:09 AM
Hi,
I had put above F.M Call before REUSE_ALV_LIST_DISPLAY call.
But still it is not working.
It is working if i put break-point some where in F_USER_COMMAND Form.
Can anybody have the solution!
Thanks,
Prasad.
06-29-2006 1:04 PM
Hi,
Can anybody give the solution for the above issue!
Thanks,
Prasad.
06-29-2006 4:13 PM
Hi All,
Thank you very much for all those replies.
The issue has been resolved.
Thanks & Regards,
Prasad.