Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem in smartform print preview

Former Member
0 Likes
3,241

Dear Abap ers,

      i want to print preview by default with out displaying any pop up page and also i choose a printer name by default.....

CODE:

REPORT  ZSMARTFORM_IMP1.

TABLES:vbak.

select-OPTIONS: s_vbeln for vbak-vbeln.



DATA: it_vbak TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
       it_vbap TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,

       it_vbak_temp TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
       it_vbap_temp TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,

       wa_vbak TYPE vbak,

FM_NAME  TYPE rs38l_fnam.

data: output_options type ssfcompop.

DATA: CONTROL TYPE SSFCTRLOP.



SELECT * from vbak into TABLE it_vbak WHERE VBELN  IN S_VBELN .

if sy-subrc EQ 0.

   select * from vbap INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak
   WHERE vbeln = it_vbak-vbeln.

endif.

output_options-tddest = 'LP01'.        (LP01 = PRINTER NAME)
output_options-tdNOPRINT  = 'X'.
CONTROL-DEVICE = 'PRINTER'.
CONTROL-NO_DIALOG = 'X'.
*** CONTROL-NO_OPEN = 'X'.
*** CONTROL-NO_CLOSE = 'X'.
CONTROL-PREVIEW = '  '.



CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     FORMNAME                 = 'ZSMARTFORM_IMP1'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
  IMPORTING
    FM_NAME                   = FM_NAME
* EXCEPTIONS
*   NO_FORM                  = 1
*   NO_FUNCTION_MODULE       = 2
*   OTHERS                   = 3
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


loop at it_vbak into wa_vbak.

   refresh:it_vbak_temp,
           it_vbap_temp.

   it_vbak_temp[] = it_vbak[].
   it_vbap_temp[] = it_vbap[].

   DELETE it_vbak_temp WHERE vbeln NE wa_vbak-vbeln.
   DELETE it_vbap_temp WHERE vbeln NE wa_vbak-vbeln.


   CALL FUNCTION FM_NAME
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
    CONTROL_PARAMETERS         = CONTROL
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
    OUTPUT_OPTIONS             = OUTPUT_OPTIONS
*   USER_SETTINGS              = ' '
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
     TABLES
       VBAK                       = it_vbak_temp[]
       VBAP                       = it_vbap_temp[]
* 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.
   ENDIF.

endlooP.

After execute this code a critical error message will display -
"Output device LOCL not defined".

i cant understand what is my problem..... please solve it and if any wrong in coding then please correct it.

Regards

Sabyasachi Karforma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,643

output_options-tddest = '$LOCL'.

output_options-tdNOPRINT  = 'X'.

CONTROL-NO_DIALOG = 'X'.

CONTROL-PREVIEW = '   '.

only this 4 are enough for my required output???

regards

Sabyasachi

Dear Abap ers,

      i want to print preview by default with out displaying any pop up page and also i choose a printer name by default.....

CODE:

REPORT  ZSMARTFORM_IMP1.

TABLES:vbak.

select-OPTIONS: s_vbeln for vbak-vbeln.



DATA: it_vbak TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
       it_vbap TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,

       it_vbak_temp TYPE STANDARD TABLE OF vbak INITIAL SIZE 0,
       it_vbap_temp TYPE STANDARD TABLE OF vbap INITIAL SIZE 0,

       wa_vbak TYPE vbak,

FM_NAME  TYPE rs38l_fnam.

data: output_options type ssfcompop.

DATA: CONTROL TYPE SSFCTRLOP.



SELECT * from vbak into TABLE it_vbak WHERE VBELN  IN S_VBELN .

if sy-subrc EQ 0.

   select * from vbap INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak
   WHERE vbeln = it_vbak-vbeln.

endif.

output_options-tddest = 'LP01'.        (LP01 = PRINTER NAME)
output_options-tdNOPRINT  = 'X'.
CONTROL-DEVICE = 'PRINTER'.
CONTROL-NO_DIALOG = 'X'.
*** CONTROL-NO_OPEN = 'X'.
*** CONTROL-NO_CLOSE = 'X'.
CONTROL-PREVIEW = '  '.



CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     FORMNAME                 = 'ZSMARTFORM_IMP1'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
  IMPORTING
    FM_NAME                   = FM_NAME
* EXCEPTIONS
*   NO_FORM                  = 1
*   NO_FUNCTION_MODULE       = 2
*   OTHERS                   = 3
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


loop at it_vbak into wa_vbak.

   refresh:it_vbak_temp,
           it_vbap_temp.

   it_vbak_temp[] = it_vbak[].
   it_vbap_temp[] = it_vbap[].

   DELETE it_vbak_temp WHERE vbeln NE wa_vbak-vbeln.
   DELETE it_vbap_temp WHERE vbeln NE wa_vbak-vbeln.


   CALL FUNCTION FM_NAME
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
    CONTROL_PARAMETERS         = CONTROL
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
    OUTPUT_OPTIONS             = OUTPUT_OPTIONS
*   USER_SETTINGS              = ' '
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
     TABLES
       VBAK                       = it_vbak_temp[]
       VBAP                       = it_vbap_temp[]
* 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.
   ENDIF.

endlooP.

After execute this code a critical error message will display -
"Output device LOCL not defined".

i cant understand what is my problem..... please solve it and if any wrong in coding then please correct it.

Regards

Sabyasachi Karforma

15 REPLIES 15
Read only

Former Member
0 Likes
2,643

HI,

change ur printer name from

output_options-tddest = 'LP01'.        (LP01 = PRINTER NAME)

to

output_options-tddest = 'LOCL'.    (LOCL = PRINTER NAME)

I think your poutput is configured with locl printer check in nace also.

Read only

0 Likes
2,643

HI Geeta according to you i change output_options-tddest = 'LOCL'. But same problem.

Error = "Output device LOCL not defined"  and it terminates the current transaction. please solve. output_options and control  parameters which is defined in my code is it right and enough to get my required output?

Read only

0 Likes
2,643

CONTROL-DEVICE = 'PRINTER'.

try with commenting this type.

and debug the fm_name.

Read only

0 Likes
2,643

output_options-tddest = 'LOCL'.

output_options-tdNOPRINT  = 'X'.

CONTROL-NO_DIALOG = 'X'.

CONTROL-PREVIEW = '   '.

only this 4 are enough for my required output???

regards

Sabyasachi

Read only

0 Likes
2,643

also try with removing comment. *   USER_SETTINGS              = ' ' to

   USER_SETTINGS              = ' '

in ur FM_NAME fm

Read only

0 Likes
2,643

HI GEETA,

    

output_options-tddest = 'LP01'.

output_options-tdNOPRINT  = 'X'.

CONTROL-NO_DIALOG = 'X'.

CONTROL-PREVIEW = '   '.


CALL FUNCTION FM_NAME
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
    CONTROL_PARAMETERS         = CONTROL
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
    OUTPUT_OPTIONS             = OUTPUT_OPTIONS
    USER_SETTINGS              = '   '
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
     TABLES
       VBAK                       = it_vbak_temp[]
       VBAP                       = it_vbap_temp[]
* 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.
   ENDIF.

NOW IS IT CORRECT TO AVOID POP UP PAGE AND CHOOSE A PRINTER NAME BY DEFAULT???

Read only

Former Member
0 Likes
2,644

output_options-tddest = '$LOCL'.

output_options-tdNOPRINT  = 'X'.

CONTROL-NO_DIALOG = 'X'.

CONTROL-PREVIEW = '   '.

only this 4 are enough for my required output???

regards

Sabyasachi

Read only

0 Likes
2,643

control-preview = 'X'."Preview the output of Smartform

control-no_dialog = 'X'."Don't show Dialog

output_options-tddest = 'LOCL'."Spool: Output device

output_options-tdnoprint = 'X'."No printing from print preview

i think this much is enough to solve your issue

Read only

0 Likes
2,643

one more .

why are your defining ur FM_NAME inside loop endloop. loop at it_vbak into wa_vbak.endloop.

get all data first and call FM_NAME.

also uncomments USER_SETTING = ''  fropm FM_NAME.

and try hope it wll work.

Read only

0 Likes
2,643

HI,

can you please try with this and let me know.

and also try with print_preview = 'X'

Read only

0 Likes
2,643
Read only

0 Likes
2,643

hi geeta,

    now this code does not produce any error but this code is not executed....

Read only

0 Likes
2,643

debug ur driver program and check if u r getting data in itab . and send me your updated code if you have no problem.

Read only

0 Likes
2,643

HI geeta,

    i send my code to your gmail. please chek it and also some questions regarding this, please answer it....

Read only

0 Likes
2,643

HI Sabyasachi,

I have not received your email in my gmail. Good that your issue get solved. you can  ask any question. I will try my best.

Regards,

Geeta