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

Former Member
0 Likes
1,216

hi abap ers,

      i want to print a smartform. first i want to preview without additional pop up then i want to print.

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'.

output_options-tdNOPRINT  = '   '.

CONTROL-DEVICE = 'PRINTER'.

CONTROL-NO_DIALOG = 'X'.


CONTROL-PREVIEW = 'X'.



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.

Regards

Sabyasachi Karforma

9 REPLIES 9
Read only

Former Member
0 Likes
1,191

Hi Abap ers please solve my problem and tell a right way how to print in this case.

Read only

Former Member
0 Likes
1,191

did you set OUTPUT_OPTIONS-TDIMMED = 'X'?

Read only

0 Likes
1,191

Hi Vipin ,

      

i only set

output_options-tddest = 'LP01'.

output_options-tdNOPRINT  = '   '.

CONTROL-DEVICE = 'PRINTER'.

CONTROL-NO_DIALOG = 'X'.


CONTROL-PREVIEW = 'X'.

5 parameters. when i execute my code print preview page will open. here, TEXT menu present in menu bar and in 'TEXT'   'PRINT'  option. when i click on print, a message with text 'spool request (number 15.902) created' is display. but when we go to tcode SP01 then it will not found.

Read only

0 Likes
1,191

hi Abap ers any solve or any answer?

Read only

0 Likes
1,191

HI your are still getting the problem ? it was solved last week rite?

Read only

0 Likes
1,191

HI geeta ,

  plz read my question . its not print preview, i want to direct print my smartform ri8 now.

Read only

0 Likes
1,191

Hi,

refer below link. hope this work for you.

http://www.sapfans.com/forums/viewtopic.php?f=13&t=508

Read only

Former Member
0 Likes
1,191

Hi ,

Try this.

data: output_options type ssfcompop.

DATA: CONTROL TYPE SSFCTRLOP.

  CONTROL-preview = 'X'."Preview the output of Smartform
CONTROL-no_dialog = 'X'."Don't show Dialog
output_options-tddest = 'LP01'.

CALL FUNCTION FM_NAME

  EXPORTING

    CONTROL_PARAMETERS         = CONTROL

    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

             .

This will give print preview without dialog box, and you can print directly from there.

Thanks,

Susmitha

Read only

Former Member
0 Likes
1,191

Sabyasachi,

Also make sure that

output_options-TDNEWID =  'X' .

output_options-TDDELETE =  '  ' .

Thanks,

Susmitha