Skip to Content

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

Er_data is not showing all the records

Hi all,

Here is my odata code. i'm trying to fetch all attachement details im getting all the details in er_data but in http response it is not showing all records

method fileuploadset_get_entityset.

   data:

     ls_stream            type zcl_zhelp_desk_mpc=>ts_fileupload,

     lt_stream            type zcl_zhelp_desk_mpc=>tt_fileupload ,

     ls_orderadm_h        type crmd_orderadm_h,

     lt_orderadm_h        type table of crmd_orderadm_h,

     ls_business_object   type sibflporb,

     lt_phioloios         type skwf_lpios,

     ls_phioloios         like line of lt_phioloios,

     lt_ios_prop_result   type crm_kw_propst,

     ls_loio              type  skwf_io,

     ls_phio              type  skwf_io,

     lt_bin_content       type sdokcntbins,

     lt_file_access_info  type sdokfilacis,

     ls_file_access_info  like line of lt_file_access_info,

     lv_data_xstr         type xstring,

     lv_input_length      type i,

     lv_first_line        type i,

     lv_last_line         type  i,

     ls_key_tab           type     /iwbep/s_mgw_name_value_pair,

     lv_file              type string,

     lv_filter            type string.

   lv_filter = iv_filter_string.

   replace all occurrences of 'Id eq ' in lv_filter with ''.

   replace all occurrences of '(' in lv_filter with ''.

   replace all occurrences of ')' in lv_filter with ''.

   replace all occurrences of '''' in lv_filter with space.

   condense lv_filter no-gaps.

   select  * from crmd_orderadm_h into table lt_orderadm_h

     where object_id = lv_filter.

   if sy-subrc eq 0.

     loop at lt_orderadm_h into ls_orderadm_h.

* Get the attachment documents info

       ls_business_object-instid = ls_orderadm_h-guid.

       ls_business_object-typeid = ls_orderadm_h-object_type.

       ls_business_object-catid = 'BO'.

       call method cl_crm_documents=>get_info

         exporting

           business_object       = ls_business_object

         importing

           phioloios             = lt_phioloios

           ios_properties_result = lt_ios_prop_result.

* Read the file data

       if sy-subrc <> 0.

         call function 'ZXXCREATE_LOG'

           exporting

             im_msg_type  = 'E'    " Message type

             im_msg       = 'Unable get the information for business object in get_stream'   " Error message

             im_msg_no    = '3'   " Message number

             im_extnumber = ls_orderadm_h-guid.

         raise exception type /iwbep/cx_mgw_busi_exception

           exporting

             textid            = /iwbep/cx_mgw_busi_exception=>resource_not_found

             message_unlimited = 'Attachment not found'.

       endif.

       loop at lt_phioloios into ls_phioloios.

         ls_loio-objtype = ls_phioloios-objtypelo.

         ls_loio-class = ls_phioloios-classlo.

         ls_loio-objid = ls_phioloios-objidlo.

         ls_phio-objtype = ls_phioloios-objtypeph.

         ls_phio-class = ls_phioloios-classph.

         ls_phio-objid = ls_phioloios-objidph.

* Read file data into a binary table

         call method cl_crm_documents=>get_with_table

           exporting

             loio                = ls_loio

             phio                = ls_phio

           importing

             file_access_info    = lt_file_access_info

             file_content_binary = lt_bin_content.

         if lt_file_access_info is initial.

           call function 'ZXXCREATE_LOG'

             exporting

               im_msg_type  = 'E'    " Message type

               im_msg       = 'Lt_file_access_info is initial in get stream method'   " Error message

               im_msg_no    = '4'   " Message number

               im_extnumber = ls_orderadm_h-guid.

           raise exception type /iwbep/cx_mgw_busi_exception

             exporting

               textid            = /iwbep/cx_mgw_busi_exception=>resource_not_found

               message_unlimited = 'Attachement does not exist'.

         endif.

         read table lt_file_access_info into ls_file_access_info index 1.

         if sy-subrc eq 0.

           lv_input_length = ls_file_access_info-file_size.

           lv_first_line = ls_file_access_info-first_line.

           lv_last_line = ls_file_access_info-last_line.

           call function 'SCMS_BINARY_TO_XSTRING'

             exporting

               input_length = lv_input_length

               first_line   = lv_first_line

               last_line    = lv_last_line

             importing

               buffer       = lv_data_xstr

             tables

               binary_tab   = lt_bin_content

             exceptions

               failed       = 1

               others       = 2.

           if sy-subrc <> 0.

             call function 'ZXXCREATE_LOG'

               exporting

                 im_msg_type  = 'E'    " Message type

                 im_msg       = 'Converting failed in function SCMS_BINARY_TO_XSTRING in get stream method'   " Error message

                 im_msg_no    = '5'   " Message number

                 im_extnumber = ls_orderadm_h-guid.

             raise exception type /iwbep/cx_mgw_busi_exception

               exporting

                 textid            = /iwbep/cx_mgw_busi_exception=>business_error

                 message_unlimited = 'Attachement does not exist'.

           endif.

           ls_stream-filename  = ls_file_access_info-file_name.

              ls_stream-id = ls_orderadm_h-object_id.

           ls_stream-mimetype = ls_file_access_info-mimetype.

           ls_stream-content    = lv_data_xstr.

           insert ls_stream into table lt_stream.

           if sy-subrc eq 0.

             clear: ls_stream,

                    lt_ios_prop_result,lv_data_xstr,

                   lt_bin_content[].

           endif.

thanks

         endif.

       endloop.

     endloop.

   endif.

   et_entityset = lt_stream.

endmethod.                    "FILEUPLOADSET_GET_ENTITYSET

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