Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8545

Re: open dataset in binary mode-data missing in pdf file

$
0
0

Hi,

 

Try this code: note the use of bin_file parameter.

 

*&---------------------------------------------------------------------*
*& Report  Y_R_EITAN_TEST_30_07
REPORT  y_r_eitan_test_30_07 .
TYPE-POOLS: abap .
SELECTION-SCREEN BEGIN OF BLOCK block06 WITH FRAME .
PARAMETERS: p_tdname TYPE thead-tdname OBLIGATORY DEFAULT 'S_DEMO_1'  .
SELECTION-SCREEN SKIP .
PARAMETERS: p_file_i TYPE pathextern OBLIGATORY  .
SELECTION-SCREEN END OF BLOCK block06 .
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
START-OF-SELECTION .  PERFORM at_start_of_selection .
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM at_start_of_selection .  DATA: st_thead TYPE thead .  DATA: it_lines TYPE tline_tab .  st_thead-tdobject = 'TEXT' .  st_thead-tdname   = p_tdname .  st_thead-tdid     = 'ST' .  st_thead-tdspras  = 'E'  .  CALL FUNCTION 'READ_TEXT'    EXPORTING      id                      = st_thead-tdid      language                = st_thead-tdspras      name                    = st_thead-tdname      object                  = st_thead-tdobject    IMPORTING      header                  = st_thead    TABLES      lines                   = it_lines    EXCEPTIONS      id                      = 1      language                = 2      name                    = 3      not_found               = 4      object                  = 5      reference_check         = 6      wrong_access_to_archive = 7      OTHERS                  = 8.  IF sy-subrc NE 0 .    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .  ENDIF.  DATA: it_otfdata TYPE otf_t_itcoo .  DATA: st_options TYPE itcpo.  st_options-tdgetotf = abap_true .  CALL FUNCTION 'PRINT_TEXT'    EXPORTING      dialog                   = abap_false      header                   = st_thead      OPTIONS                  = st_options    TABLES      lines                    = it_lines      otfdata                  = it_otfdata    EXCEPTIONS      canceled                 = 1      device                   = 2      form                     = 3      OPTIONS                  = 4      unclosed                 = 5      unknown                  = 6      format                   = 7      textformat               = 8      communication            = 9      bad_pageformat_for_print = 10      OTHERS                   = 11.  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: it_otfdata_m TYPE otf_t_itcoo .  APPEND LINES OF it_otfdata TO it_otfdata_m .  DATA: bin_file TYPE xstring .  CALL FUNCTION 'CONVERT_OTF'    EXPORTING      format                = 'PDF'    IMPORTING      bin_file              = bin_file    TABLES      otf                   = it_otfdata_m      lines                 = it_lines    EXCEPTIONS      err_max_linewidth     = 1      err_format            = 2      err_conv_not_possible = 3      err_bad_otf           = 4      OTHERS                = 5.  DATA: mess TYPE string .  OPEN DATASET p_file_i FOR OUTPUT IN BINARY MODE MESSAGE mess .  TRANSFER bin_file TO p_file_i NO END OF LINE .  CLOSE DATASET p_file_i .
ENDFORM.                    "at_start_of_selection
*----------------------------------------------------------------------*

Viewing all articles
Browse latest Browse all 8545

Trending Articles