Skip to Content
avatar image
Former Member

CLASS Method returning a Table to a BSP

OK, guys here's one for you. Just trying something new, and using the <i>CL_BSP_M_ITMVC2_FLIGHTS</i>, <i>INIT</i> method as an example.

<u><b>TABLE TYPE Definition: ZPATCHTAB Line Type PAT03</b></u>

<u><b>CLASS Attribute: PATCHLIST Type ZPATCHTAB</b></u>

<u><b>CLASS Method: (GET_SYSTEM_PATCHES, Parameter: rfcdest)</b></u>

method GET_SYSTEM_PATCHES .
  select * INTO TABLE PATCHLIST FROM pat03.
endmethod.

<u><b>BSP Page: Layout</b></u>

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="Start Page " >
    <htmlb:form method="GET" >

<%
    DATA: itab TYPE ZPATCHTAB.

    DATA: obj TYPE REF TO ZSC_GENERAL_METHODS.
    CREATE OBJECT obj.
    obj->GET_SYSTEM_PATCHES( rfcdest = 'MANUAL_H32' ).
    itab = obj->PATCHLIST.
%>

    <htmlb:tableView id="mytest" table="<%= itab %>" />

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

This works all nice and pretty like. However <b>AS A TEST ONLY</b> before creating the remote FM to do the table call for me.

I wanted to try this.

<u><b>CLASS Method: (GET_SYSTEM_PATCHES, Parameter: rfcdest)</b></u>

method GET_SYSTEM_PATCHES .

* Data defintions.
  DATA: my_options TYPE TABLE OF rfc_db_opt,
        my_fields TYPE TABLE OF rfc_db_fld,
        my_data TYPE TABLE OF ZPATCHTAB,
        wmy_data TYPE ZPATCHTAB.

* Access remote Data
  CALL FUNCTION 'RFC_READ_TABLE' DESTINATION RFCDEST
    EXPORTING
      query_table          = 'pat03'
      delimiter            = ':'
      no_data              = ' '
      rowskips             = 0
      rowcount             = 0
    TABLES
      options              = my_options
      fields               = my_fields
      data                 = my_data
    EXCEPTIONS
      table_not_available  = 1
      table_without_data   = 2
      option_not_valid     = 3
      field_not_valid      = 4
      not_authorized       = 5
      data_buffer_exceeded = 6
      others               = 7.

  loop at my_data into wmy_data.
    MOVE wmy_data TO PATCHLIST.
  endloop.

*  select * INTO TABLE PATCHLIST FROM pat03.
endmethod.

And I know that RFC_READ_TABLE is <i><b>not released for customer use</b></i>. But I wanted to test it before I go through the trouble of written the remote FM.

So here onto my question.

Is doing it in the CLASS better/worse than doing it directly on BSP, in a FM the BSP uses or in a BSP extension? Using Brian's <a href="/people/brian.mckellar/blog/2004/06/16/bsp-performance-measuring-roundtrip-latency">performance</a> testing methods I didn't see too much of a difference??

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 12, 2004 at 11:58 AM

    > Is doing it in the CLASS better/worse than doing it

    > directly on BSP, in a FM the BSP uses or in a BSP

    > extension? Using Brian's

    > <a href="/people/brian.mckellar/blog/2004/06/16/bsp-performance-measuring-roundtrip-latency">performan

    > ce</a> testing methods I didn't see too much of a

    > difference??

    Any thoughts on this or for somthing as simple as reading a table not such a big difference in performance?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Brian McKellar

      Hi Brian,

      Thanks for the input. Oh the code does work!! I ended up assigning the internal table the type "PATCHLIST" which is my class atrribute. works beautifully!

      I've seen done quite a bit of playing around with the code in the BSP itself, in a BSP extension, as the Method and as a FM.

      I noticed a slight difference but it wasn't one that would make me alter my code drastically in other programs to take advantage of it.

      I'm sure you guys have done some sort of case studies on the performance of the different issues, it'd be interesting read them if they are available.

  • avatar image
    Former Member
    Aug 11, 2004 at 11:39 AM

    I just tried that code with an actual remote system and it tells me the table 'pat03' is not available however when I run it with 'PAT03' I get the error

    Fehlermeldung: Interner Fehler: Unerwarteter Zustand in der ABAP-Laufzeitumgebung. ( Abbruchsart: RABAX_STATE )
    

    Which means that it had an unhandled exception in the ABAP runtime environment.

    Question: side topic of course, is there something about this table 'pat03' that keeps it from being called remotely?

    I modified the code from the first for a different table (custoemr table) and it worked

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 11, 2004 at 08:03 PM

    Very subtle problem 😊

      CALL FUNCTION 'RFC_READ_TABLE' DESTINATION RFCDEST
        EXPORTING
          query_table          = <b>'PAT03'</b>
          delimiter            = ':'
    

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      OK Now I am really confused! Oh gee I hope no one minds me using the forum today as a sounding board?

      method GET_SYSTEM_PATCHES .
      
        DATA: my_options TYPE TABLE OF rfc_db_opt,
              my_fields TYPE TABLE OF rfc_db_fld,
              my_data TYPE TABLE OF <i><u><b>PATCHLIST</b></u></i>.
      
      * Access remote Data
        CALL FUNCTION 'RFC_READ_TABLE' DESTINATION RFCDEST
          EXPORTING
            query_table           = 'PAT03'
            delimiter             = ':'
            rowskips              = 0
            rowcount              = 0
          TABLES
            options               = my_options
            fields                = my_fields
            data                  = my_data
          EXCEPTIONS
            communication_failure = 1
            system_failure        = 2
            table_not_available   = 3
            table_without_data    = 4
            option_not_valid      = 5
            field_not_valid       = 6
            not_authorized        = 7
            data_buffer_exceeded  = 8
            others                = 9.
      
      * data to PATCHLIST which is Table Type ZPATCHTAB (line type pat03).
        IF SY-SUBRC EQ 0.
      
          MOVE my_data TO PATCHLIST.
      
        ENDIF.
      
      endmethod.
      

      Message was edited by: Craig Cmehil