on 02-16-2006 9:42 PM
Dear community. I just have an problem. Today I wanted to program an function for the users of my program which should give them the opportunity to use a print preview before they use the program. I use the print function with smartforms and I already filled the following fields of the Parameter tables with values:
*the printdialog does not appaer
CONTROL_PARAMETERS-NO_DIALOG = 'x'.
*should enable the print preview
CONTROL_PARAMETERS-PREVIEW = 'x'.
*Sets the printer
OUTPUT_OPTIONS-TDDEST = DRUCKER.
*prints immidiatly
OUTPUT_OPTIONS-TDIMMED = ' '.
*creates an new spool jab
OUTPUT_OPTIONS-TDNEWID = ' '.
*no print out of the print preview
OUTPUT_OPTIONS-TDNOPRINT = 'x'.
But the combination of the above parameters wouldn't work.
When CONTROL_PARAMETERS-NO_DIALOG and CONTROL_PARAMETERS-PREVIEW have the value 'x' there comes the following message "Handle for open spool request is invalid". This messages has following ID for which I searches in the SapNet. But I don't understand the given message 'The above error message is issued during the output of interactive forms when you have selected "Archive only" as archiving mode (instead of "Print and archive" or "Print only").'
Only when I leave the parameter CONTROL_PARAMETERS-NO_DIALOG empty the error messages didn' appear. But then the printer dialog comes up.
Who knows what I've got to do, when I want to have directly the printer preview and no printer dialog.
Please help me.
Kind reagrds
Michael
Hi,
Here is the sample code which I got from SDN.Try it out and kindly reward points,if it helps.
data: control TYPE ssfctrlop,
control_parameters TYPE ssfctrlop.
control-preview = ' '.
control-no_open = 'X'.
control-no_close = 'X'.
control-no_dialog = 'X'.
control-device = p_pid.
control_parameters-no_dialog = 'X'.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
output_options-tddest = p_pid.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
output_options = output_options
control_parameters = control_parameters
control = control
user_settings = ' '
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.
EXIT.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Jayanthi Jayaraman. Thank you for your quick answer.
I understood your posting so, that I had to integrate the sample code into my program. So i did it.
Now my source looks like that:
REPORT ZTEST_001.
TYPE-POOLS: ABAP.
TABLES: MARA.
* interne Tabellen für die Übergabe der Druckparameter an das Smartform
DATA: CONTROL_PARAMETERS TYPE SSFCTRLOP, "Enhält Parameter zum Steuern der Ausgabekontrolle. Bsp.: Typ Ausgabegerät, Sichtbarkeit Druckfenster (NO_DIALOG = 1)
control TYPE ssfctrlop,
OUTPUT_OPTIONS TYPE SSFCOMPOP, "Enthält Parameter zum Steuern der Ausgabe. Bsp.: Ausgabegerät, Keine Druckansicht zulassen, sofort ausgeben, löschen nach Ausgabe
USER_SETTINGS TYPE TDBOOL, "Boolsche Variable, die aussagt, ob Benutzerwerte oder die programmseitigen Druckeinstellungen
"gezogen werden sollen.
FUNC_PARAM_TAB TYPE abap_func_parmbind_tab, "Parametertabelle für das dynamische aufrufen von FuBas
FUNC_PARAM_WA TYPE abap_func_parmbind, "Arbeitsbereich für die Parametertabelle
MATERNR LIKE MARA-MATNR.
MATERNR = '000000000000000202'.
*******************************
control-preview = 'X'.
control-no_open = 'X'.
control-no_close = 'X'.
control-no_dialog = 'X'.
control-device = 'PRINTER'.
control_parameters-no_dialog = 'X'.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
output_options-tddest = 'M666'.
***************************
OUTPUT_OPTIONS-TDDEST = 'M666'. "Legt den Drucker fest.
OUTPUT_OPTIONS-TDNOPRINT = 'x'. "Keine Druckausgabe aus Druckansicht
OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.
FUNC_PARAM_WA-NAME = 'OUTPUT_OPTIONS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF OUTPUT_OPTIONS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
* CONTROL_PARAMETERS-DEVICE = 'PRINTER'.
* CONTROL_PARAMETERS-NO_DIALOG = 'x'. "Das Druckfenster wird nicht angezeigt.
* CONTROL_PARAMETERS-PREVIEW = 'x'. "Druckvorschau
FUNC_PARAM_WA-NAME = 'CONTROL_PARAMETERS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF CONTROL_PARAMETERS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
* Die folgende boolsche Variable 'USER_SETTINGS' wird auf leer (also FALSE) gesetzt.
* Dadurch wird erreicht, dass die Druckvorgaben aus der Parametertabelle 'OUTPUT_OPTIONS'
* gezogen werden und nicht aus dem Benutzerstammsatz.
USER_SETTINGS = ' '.
FUNC_PARAM_WA-NAME = 'USER_SETTINGS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF USER_SETTINGS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
FUNC_PARAM_WA-NAME = 'MATERNR'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF MATERNR INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
output_options = output_options
control_parameters = control
user_settings = ' '
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.
EXIT.
ENDIF.
* Funktionsaufruf des Smartforms
CALL FUNCTION '/1BCDWB/SF00000045'
PARAMETER-TABLE FUNC_PARAM_TAB.
Now the print starts automatically and I don't get any printer dialog. But I don't get any print preview, too.
Sorry, but I'm a little bit confused. So I please you to make me understand your posting.
Many thanks in advance.
Michael
Hi Michael,
You can't avoid Pop-up screen for Print/Print Preview as program is looking for "Xscreen".
I have a solution for you -
this will remove the Print button from the pop-up and this will not allow the users from printing.
Please do the following at <u>control parameters</u> :
As you mentioned correctly :
CONTROL_PARAMETERS-NO_DIALOG = 'x'.
*should enable the print preview
CONTROL_PARAMETERS-PREVIEW = 'x'.
Sets the printer
<b>OUTPUT_OPTIONS-TDDEST = 'PRINTER'</b>.
Sets the printer
OUTPUT_OPTIONS-LANGU = SY-LANGU
do the following at <u>composer parameters</u> :
DATA: ls_composer_param TYPE ssfcompop.
call function FM_NAME
EXPORTING
CONTROL_PARAMETERS = ls_control_param
output_options = ls_composer_param
<b>ls_composer_param-TDNOPRINT = 'X'.</b>
This will remove print button from pop-up.
Hope this will help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for your answers. But I'm al ittle bit confused. A colleague of mine uses a function like that what I want in SAP form). He uses the parametertable ITCPO in the function which he uses to open the form from his programm. The ITCPO has nearly the same structure kike the tables which I use in Smartforms. When he sets the Parameter NO_DIALOG on the value 'x' it works. He only gets the direct print preview without any printer dialog.
Why does it work in SAP Forms and not in the better and newer Smartforms.
And why should't be there an option to use only the print preview? It's an very nice function.
Hope someone as an answers to make me understand.
ITCPO structure is used in SAP Script Forms.
SSFCOMPOP and SSFCTRLOP is used for passing data in SmartForms.
I tried the code.. It worked for me.
DATA i_print TYPE SSFCOMPOP.
DATA i_ctrl TYPE SSFCTRLOP.
i_print-tddest = 'LP01'. "Device
i_ctrl-preview = 'X'. "Print preview
i_ctrl-no_dialog = SPACE. "No dialog
Ps: Reward points if helpful.
Dear Wenceslaus G. Thank you for your quick answer. Today I'm in the comany again and I tied it with your rules. But it won't work. Have you entered any other parameters?
I've got to avoid the printer menu. The users need this functionality as soon as possible and make me nervous.
Below you can find the code of my test programm. Perhaps someone can find an mistake, or can give me an tip to avoid the printer menu and to show only print preview.
REPORT ZTEST.
TYPE-POOLS: ABAP.
TABLES: MARA.
* interne Tabellen für die Übergabe der Druckparameter an das Smartform
DATA: CONTROL_PARAMETERS TYPE SSFCTRLOP, "Enhält Parameter zum Steuern der Ausgabekontrolle. Bsp.: Typ Ausgabegerät, Sichtbarkeit Druckfenster (NO_DIALOG = 1)
OUTPUT_OPTIONS TYPE SSFCOMPOP, "Enthält Parameter zum Steuern der Ausgabe. Bsp.: Ausgabegerät, Keine Druckansicht zulassen, sofort ausgeben, löschen nach Ausgabe
USER_SETTINGS TYPE TDBOOL, "Boolsche Variable, die aussagt, ob Benutzerwerte oder die programmseitigen Druckeinstellungen
"gezogen werden sollen.
FUNC_PARAM_TAB TYPE abap_func_parmbind_tab, "Parametertabelle für das dynamische aufrufen von FuBas
FUNC_PARAM_WA TYPE abap_func_parmbind, "Arbeitsbereich für die Parametertabelle
MATERNR LIKE MARA-MATNR.
MATERNR = '000000000000000202'.
OUTPUT_OPTIONS-TDDEST = 'M666'. "Legt den Drucker fest.
OUTPUT_OPTIONS-TDNOPRINT = 'x'. "Keine Druckausgabe aus Druckansicht
OUTPUT_OPTIONS-BCS_LANGU = SY-LANGU.
FUNC_PARAM_WA-NAME = 'OUTPUT_OPTIONS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF OUTPUT_OPTIONS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
CONTROL_PARAMETERS-DEVICE = 'PRINTER'.
CONTROL_PARAMETERS-NO_DIALOG = SPACE. "Das Druckfenster wird nicht angezeigt.
CONTROL_PARAMETERS-PREVIEW = 'x'. "Druckvorschau
FUNC_PARAM_WA-NAME = 'CONTROL_PARAMETERS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF CONTROL_PARAMETERS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
* Die folgende boolsche Variable 'USER_SETTINGS' wird auf leer (also FALSE) gesetzt.
* Dadurch wird erreicht, dass die Druckvorgaben aus der Parametertabelle 'OUTPUT_OPTIONS'
* gezogen werden und nicht aus dem Benutzerstammsatz.
USER_SETTINGS = ' '.
FUNC_PARAM_WA-NAME = 'USER_SETTINGS'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF USER_SETTINGS INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
FUNC_PARAM_WA-NAME = 'MATERNR'.
FUNC_PARAM_WA-KIND = ABAP_FUNC_EXPORTING.
GET REFERENCE OF MATERNR INTO FUNC_PARAM_WA-VALUE.
INSERT FUNC_PARAM_WA INTO TABLE FUNC_PARAM_TAB.
* Funktionsaufruf des Smartforms
CALL FUNCTION '/1BCDWB/SF00000045'
PARAMETER-TABLE FUNC_PARAM_TAB.
Kind regards and many thanks to this community for the help
Hi Michael,
Change like below & check..
<b>CONTROL_PARAMETERS-NO_DIALOG = ' '.</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Hi Michael,
> Change like below & check..
>
> <b>CONTROL_PARAMETERS-NO_DIALOG = ' '.</b>
Dear Phani Kiran Nudurupati. Thank you for your quick answer. But as I wrote in my question I already tried this option:
Only when I leave the parameter CONTROL_PARAMETERS-NO_DIALOG empty the error messages didn' appear. But then the printer dialog comes up.
When I leave this Parameter empty, the dialog screen appears. Just how it shouldn't do.
Have someone another idea?
Michael
User | Count |
---|---|
102 | |
13 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.