Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Downloding problem

Hi,

While using GUI_DOWNLOAD and passing file type as binary and downloding as PDF file datatype conversion error is coming. I am attaching the Code with this please go through this & help me.

&----


*& Include YHRMS_RESUME_SMRTFORM_CALFORM *

&----


Perform SMART-FORM-INFO.

FORM SMART-FORM-INFO.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'YHRMS_RESUME_SMARTFORM'

IMPORTING

FM_NAME = FM_NAME.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DATA: LS_SETTING TYPE SSFCTRLOP,

LS_OUTOPT TYPE SSFCOMPOP,

JOB_OUTPUT_INFO TYPE SSFCRESCL,

JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,

GT_OTF TYPE STANDARD TABLE OF ITCOO.

.

*IF ucomm EQ 'PRINT'.

**ls_setting-no_open = 'X'.

**ls_setting-no_Close = 'X'.

*ls_setting-Device = 'ABCDEFGH'.

LS_SETTING-NO_DIALOG = 'X'. "no dialog box before printing

LS_SETTING-LANGU = 'E'.

LS_SETTING-GETOTF = 'X'.

LS_SETTING-NO_DIALOG = 'X'.

LS_OUTOPT-TDNOPREV = 'X'.

*ls_setting-Preview = 'X'.

*

*ls_outopt-xsfoutdev = 'CASN'. " ls_outopt2-tddest. "printer

  • ls_outopt-tdnewid = ls_outopt2-tdnewid. "for spool output

LS_OUTOPT-TDIMMED = 'X'. "print immediately

*ls_outopt-TDPAGESLCT = 1.

*ls_outopt-TDNOPREV = 'X'.

**ENDIF.

CALL FUNCTION FM_NAME

EXPORTING

CONTROL_PARAMETERS = LS_SETTING

OUTPUT_OPTIONS = LS_OUTOPT

USER_SETTINGS = 'X'

ANAM = ANAM

  • control_parameters = control_parameters

  • output_options = output_options

  • user_settings = space

  • banfn = banfn

IMPORTING

JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

IT_HDR = IT_HDR

*

  • HDRTAB = HDRTAB

  • DTLTAB = DTLTAB

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

GT_OTF[] = JOB_OUTPUT_INFO-OTFDATA[].

DATA: GT_TLINE TYPE STANDARD TABLE OF TLINE,

GV_LEN LIKE SOOD-OBJLEN.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

IMPORTING

BIN_FILESIZE = GV_LEN

TABLES

OTF = GT_OTF

LINES = GT_TLINE

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DATA : GV_FILENAME LIKE RLGRAP-FILENAME. " VALUE 'C:\swet.pdf'.

Data : GV_LEN1 TYPE I,

GV_FILENAME1 TYPE STRING,

GV_FILENAME2 Like RLGRAP-FILENAME.

Read Table It_hdr with key apid = S_Apid-low.

If sy-subrc = 0.

Concatenate '
Server\Eminent\Output\' It_hdr-anam '_' it_hdr-spey '+_' 'ABAP1.PDF'

into GV_FILENAME1.

Endif.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = GV_LEN

FILENAME = GV_FILENAME

FILETYPE = 'BIN'

IMPORTING

FILELENGTH = GV_LEN1

TABLES

DATA_TAB = GT_TLINE

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

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.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question