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

using FM SDOK_PHIO_LOAD_CONTENT

Former Member
0 Likes
3,162

Hi Everyone,

In CV01N, we have written a customise code, that is after creating a DIR and releasing the DIR, the file which is attached in the DIR will be sent to third party that is Enovia. The file is sent through SAP XI. In the piece of code we are using

FM SDOK_PHIO_LOAD_CONTENT , the output we are looping it and coverting it in byte mode. and then sending it to SAP XI and Enovia.

    CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
       EXPORTING: object_id           = w_phio
                  text_as_stream      = 'X'
       TABLES:    file_content_binary = t_bin_data
       EXCEPTIONS: not_existing        = 1
                   not_authorized      = 2
                   no_content          = 3
                   bad_storage_type    = 4
                   OTHERS              = 5.
 

  IF t_bin_data[] IS NOT INITIAL.
    LOOP AT t_bin_data INTO w_bin_data.
    
CLEAR lv_file_xstring1.

      lv_file_xstring1 = w_bin_data-line.
      CONCATENATE lv_file_xstring lv_file_xstring1 INTO lv_file_xstring IN BYTE MODE.
     ENDLOOP. "
  ENDIF.

The problem is there are some PDF files which are giving problems. when PDF files sent to Enovia, they are found corrupted. At Tcode SXMB_MONI also the file found corrupted.

Can't able to find why is some PDF this problem occurs? Please help....

Thanks and Regards

Lakshmikanth K

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,050

Any idea, any suggestion... Please help

3 REPLIES 3
Read only

Former Member
0 Likes
2,051

Any idea, any suggestion... Please help

Read only

0 Likes
2,050

I got the solution now it is working fine.

the code is

*---------------------------------------------------------------------
* Load content of PHIO into Binary Content internal table
*---------------------------------------------------------------------
  CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
       EXPORTING: object_id           = w_phio
*                  text_as_stream      = 'X'
       TABLES:    file_content_binary = t_bin_data
       EXCEPTIONS: not_existing        = 1
                   not_authorized      = 2
                   no_content          = 3
                   bad_storage_type    = 4
                   OTHERS              = 5.

   **Get the file PHIO properties
        CALL FUNCTION 'SDOK_PHIOS_FILE_PROPERTIES_GET'
             TABLES: components  = t_comp
                     bad_objects = t_bad_obj.
        READ TABLE t_comp INTO w_comp INDEX 1.
        file_size = w_comp-FILE_SIZE.

   CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
    EXPORTING
      input_length = file_size
      first_line   = 0
      last_line    = 0
    IMPORTING
      buffer       = data_string
    TABLES
      binary_tab   = t_bin_data
    EXCEPTIONS
      failed       = 1
      OTHERS       = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer                = data_string
*   APPEND_TO_TABLE       = ' '
* IMPORTING
*   OUTPUT_LENGTH         =
    TABLES
      binary_tab            = t_bin_data
            .

I think this code may help for those whoever is facing the similar problem

Thanks Guys

Lakshmikanth K

Read only

0 Likes
2,050

Hi,

How to you get the class and the obect id for a document if you only have the document no with you?

Many thanks in advance.

Regards,

Saikat