cancel
Showing results for 
Search instead for 
Did you mean: 

PDF not printed in SAP on Linux

former_member226520
Participant
0 Kudos

Dear Freinds,

Please help me , <removed by moderator>, My Pdf is not printed in sap on linux operating system

I am puting here some coding also .

CALL FUNCTION 'GUI_DOWNLOAD'

  EXPORTING

    BIN_FILESIZE                    = numbytes

     FILENAME                        = 'tmp/CHEQUE.pdf'

    FILETYPE                        = 'BIN'

TABLES

    DATA_TAB                        =  pdf

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

application            = 'acroread.exe'

parameter              = file

minimized              = 'X'

synchronous            = ' '

operation              = 'PRINT'

when I am giving print then error occurs that pdf is not opened , I am opening pdf in background and print automatically

I tried to slove the error but then I am not getting print exactly , That is printing some garbage value.

some one suggest me to use open data set method , Please you can provide me the coding that how can I solve this issue

there is no issue to generate the pdf , Pdf is generating but I am not getting print in background .

Pls help me friends,

Rihan

SAP-abaper

Message was edited by: Thomas Zloch

Accepted Solutions (0)

Answers (2)

Answers (2)

Private_Member_49934
Contributor
0 Kudos

'acroread.exe'

My Dear linux doesn't has .exe files( unless and and untill wine  or other windows immulators are installed). Check if acrobot reader is intalled in the frontend and get the commnad which is used to launch it( Normally in /usr/bin but may vary with different destros ) . call that command in the method

Try this in your program

cl_gui_frontend_services=>execute accordingly.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

application            = 'acroread'

parameter              = file

minimized              = 'X'

synchronous            = ' '

operation              = 'PRINT'

This is man page for acroread

Note : Arey u sure you want your code dependent on frontends OS?

IF not the use the method GET_PLATFORM of the same class do determine which platform the user is running.

former_member585060
Active Contributor
0 Kudos

Hi,

    Try giving only usr/bin/acroread tmp/CHEQUE.pdf for execution.

DATA : v_string TYPE string.

v_string = 'usr/bin/acroread tmp/CHEQUE.pdf'.

    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
      document               = v_string
*     APPLICATION            =
*     PARAMETER              =
*     DEFAULT_DIRECTORY      =
*     MAXIMIZED              =
*     MINIMIZED              =
*     SYNCHRONOUS            =
       operation              = 'PRINT'
    EXCEPTIONS
      cntl_error             = 1
      error_no_gui           = 2
      bad_parameter          = 3
      file_not_found         = 4
      path_not_found         = 5
      file_extension_unknown = 6
      error_execute_failed   = 7
      synchronous_failed     = 8
      not_supported_by_gui   = 9
      OTHERS                 = 10.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Thanks & Regards

Bala Krishna

former_member226520
Participant
0 Kudos

hi bala ji and Gaurav ji

I have applied your code , error is not coming but

printer is printing some garbage value like %%page: 1 pritmode simples[/deviceRGB]

and bala bala...

pls tell me tha anoter ways pls.

I have applied another code like.

DATA: file   TYPE string .

*

*file = 'tmp/CHEQUE.pdf'.

*

*OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

*IF sy-subrc <> 0.

*  WRITE:  'Error opening :', file.

*  ENDIF.

*TRANSFER `1234567890` TO file.

*

.

*

*DATA: file   TYPE string .

*

*file = 'usr/bin/acroread tmp/CHEQUE.pdf'.

*

*OPEN DATASET file FOR OUTPUT IN  BINARY MODE.

*IF sy-subrc <> 0.

*  WRITE:  'Error opening :', file.

*  ENDIF.

*TRANSFER `1234567890` TO file.

*CLOSE DATASET file.

*

*

*CALL METHOD cl_gui_frontend_services=>execute

*  EXPORTING

*    DOCUMENT              = file

*    application            = 'acroread'

*    parameter              = file

*    minimized              = 'X'

*    synchronous            = ' '

*    operation              = 'PRINT'

*  EXCEPTIONS

*    cntl_error             = 1

*    error_no_gui           = 2

*    bad_parameter          = 3

*    file_not_found         = 4

*    path_not_found         = 5

*    file_extension_unknown = 6

*    error_execute_failed   = 7

*    synchronous_failed     = 8

*    not_supported_by_gui   = 9l

*    OTHERS                 = 10.

then it is showing file is not opened , According to me the Linux is not opening

the pdf file in background ,

Please suggest that is a very urgent issue

Thank

Rihan

SAP-abaper

former_member585060
Active Contributor
0 Kudos

Hi,

    The file will be case sensitive, instead of Print option first try to open the file from SAP.

Try this code

DATA : v_document  TYPE string,

            v_application TYPE string.

v_document = '/tmp/CHEQUE.pdf'.  " give the file name correctly.

v_application = '/usr/bin/acroread'.   " just check in Linux where the acroread application is installed

    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
      document               = v_document

     application              = v_application
*     PARAMETER              =
*     DEFAULT_DIRECTORY      =
*     MAXIMIZED              =
*     MINIMIZED              =
*     SYNCHRONOUS            =
      operation              = 'OPEN'
    EXCEPTIONS
      cntl_error             = 1
      error_no_gui           = 2
      bad_parameter          = 3
      file_not_found         = 4
      path_not_found         = 5
      file_extension_unknown = 6
      error_execute_failed   = 7
      synchronous_failed     = 8
      not_supported_by_gui   = 9
      OTHERS                 = 10.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Thanks & Regards

Bala Krishna

former_member226520
Participant
0 Kudos

Dear Bala ji,

I have applied your coding and the pdf file is opened perfectly if I am testing for another

file it's also opening , Bur when I gave 'PRINT' opeartion in place of 'OPEN' the

printing is not done of any file ,And the printer is intalled perfectly,what to do now

please suggest , Is there something missing in Linus O.S because earilear in windows

there was primo pdf, so is there anything missing in Linux O.S, Please suggest

Thanks a lot for your co-operation

Regards

Rihan

sap-abaper

former_member585060
Active Contributor
0 Kudos

Hi,

    Try giving 'PRINTF' instead of 'PRINT' in operation.

Thanks & Regards

Bala Krishna

Private_Member_49934
Contributor
0 Kudos

Googling I found this . If it works, then below should work too. Please check.

l_v_command = '-toPostScript'

concatinate L_v_command v_file into L_v_command separated by space.

cl_gui_frontend_services=>execute accordingly.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

application            = 'acroread'

parameter              = l_v_command

minimized              = 'X'

synchronous            = ' '

operation              = 'OPEN'

former_member226520
Participant
0 Kudos

Dear Balaji,

I have given PRINTF in place of PRINT in caps and small letters also but nothing happend.

now what to do .pls help

Regards

Rihan

SAP-abaper

former_member585060
Active Contributor
0 Kudos

Try giving 'lpr'.

former_member226520
Participant
0 Kudos

Dear Balaji,

'lpr' is also not working.

regards

rihan

former_member585060
Active Contributor
0 Kudos

Hmnn, then you need to check with anyone who uses linux, about the command to print in linux. search in linux forum or Adobe forum for linux forums. Search with 'Command line Printing of PDF in linux'.

Thanks & Regards

Bala Krishna