Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

Re: convert bin to pdf and upload in application server

$
0
0

Hi ,

 

Thanks for the valuable inputs .

 

I dont have any file name. i have data in binary format and that data i  have to upload in Apllication server.

 

DATA : zbin type xstring.

 

DATA: file   TYPE string VALUE 'application_server_path',

      ZBIN1 TYPE STRING,

       result TYPE string.

 

TYPES : BEGIN OF ty_bin ,

     field TYPE x,

     END Of ty_bin.

 

DATA lt_bin TYPE STANDARD TABLE OF ty_bin,

       ls_bin TYPE ty_bin.

 

CALL FUNCTION 'SSFC_BASE64_DECODE'

   EXPORTING

     B64DATA                        = '12we'

*   B64LENG                        =

*   B_CHECK                        =

  IMPORTING

    BINDATA                        = zbin

* EXCEPTIONS

*   SSF_KRN_ERROR                  = 1

*   SSF_KRN_NOOP                   = 2

*   SSF_KRN_NOMEMORY               = 3

*   SSF_KRN_OPINV                  = 4

*   SSF_KRN_INPUT_DATA_ERROR       = 5

*   SSF_KRN_INVALID_PAR            = 6

*   SSF_KRN_INVALID_PARLEN         = 7

*   OTHERS                         = 8

           .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

 

 

 

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

   EXPORTING

     BUFFER                = zbin

*   APPEND_TO_TABLE       = ' '

* IMPORTING

*   OUTPUT_LENGTH         =

   TABLES

     BINARY_TAB            = lt_bin

           .

 

 

 

IF sy-subrc EQ 0.

DELETE DATASET FILE.

ENDIF.

 

* ZBIN1 = ZBIN.

OPEN DATASET file FOR OUTPUT IN BINARY   MODE

                               .

LOOP at lt_bin INTO ls_bin.

*                             WITH SMART LINEFEED.

TRANSFER ls_bin-field TO file.

CLEAR : ls_bin.

ENDLOOP.

CLOSE DATASET file.

 

Please have a look at the code and help.

 

Regards,

Akriti


Viewing all articles
Browse latest Browse all 3125

Trending Articles