12 Replies Latest reply: Mar 1, 2006 4:35 PM by Marilyn Pratt RSS

Read SAP tables

Guy Vleugels
Currently Being Moderated

Hi all,

 

I have a question...

 

I would like to get the data of a structure table (table not in our Oracle database) from SAP in a way so the data will be available in PHP. I was thinking about getting the data in an array, or something like that...

 

I've tried the RFC_READ_TABLE function, but it is not recommended by SAP. It also has the problem that it causes the DATA_BUFFER_EXCEEDED exception quiet easily.

 

Anyone has some ideas or tips on how I could do this.

 

BTW, In first place I would like to get the data from the BSEG table in PHP.

 

I'm using the saprfc 1.4.1 module and PHP 5.1.2 on an Apache2 Linux server.

 

 

Many thanks in advance.

  • Re: Read SAP tables
    Craig Cmehil
    Currently Being Moderated

    There are one or two ways of doing this.

     

    1. Search if a ABAP FM or BAPI already exisits (probably not)

     

    2. If you have the ability to create an ABAP function, create a simple ABAP function (set as remote enabled or as a web service) that will gather the data for you

     

    Another option is executing ABAP dynamically, which can be tricky. What table is BSEG? I've not heard of that, is it part of a module?

  • Re: Read SAP tables
    Guy Vleugels
    Currently Being Moderated

    Thanks for all the awnswers, guys...

     

    I like the idea of Craig to put a "simple select" in a function (maybe with some "TABLE" for options).

    If I do it like that, what is the best way to export it to an array in PHP?

    Is it the best way to do it like they do it in RFC_READ_TABLE?

     

     

    Thanks.

    • Re: Read SAP tables
      Craig Cmehil
      Currently Being Moderated

      That way or if you are familiar with web services you could call it as a web service in PHP (less coding).

    • Re: Read SAP tables
      Marilyn Pratt
      Currently Being Moderated

      A few words of caution.

      The famous BSEG table is a cluster table.

      It is as was correctly stated part of the Accounting Document Segment.  It is part of the Pool cluster RFBLG and lives in the package: FBAS (Financial accounting 'Basis').

       

      You can't read a cluster table exactly the way you read a database (old speak, transparent table).

       

      You can use a program to read called RFPPWF05

      Note 435694: Display BSEG item by calling FB09D (modified FB09)

      Other possiblity:  Other possibility: CALL DIALOG 'RF_ZEILEN_ANZEIGE', but since this is a dialog I don't think this would work.

      In any event go to FBAS Package (development class) to see your business objects, class library and functions.

      Marilyn

      • Re: Read SAP tables
        Craig Cmehil
        Currently Being Moderated

        That of course makes it harder.

         

        However with the nice info there from Marilyn you should be able to look into the DIALOG and see how it is being called there, or as Marilyn suggests (better way) go to the package and see what FM's or BAPI's are avaialble.

        • Re: Read SAP tables
          Marilyn Pratt
          Currently Being Moderated

          I would also take a quick look at the feature (Blag's) on the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/developerareas/abap">ABAP page</a>

           

          It links to a blog by <a href="/people/sap.user72/blog/2004/06/19/how-i-started-with-sap-web-development with a comment by Thomas Jung that clearly says:

          You might want to mention OSS note 382318 where SAP tells customers not use use function module RFC_READ_TABLE. The following is from that OSS note:

          The scope of function module RFC_READ_TABLE is very restricted. E.g.,

          due to the fixed maximum row size only smaller tables can be accessed.

          There are several data types that cannot be handled, and also there are

          doubts regarding the Unicode compatibility of the function module.

          However, all this is quite immaterial, because the function is not meant

          to be publicly used anyway. It was only created to be used as a sample

          in various training courses, and is clearly flagged as "not released for

          customer".

          Solution

          Do not use function module RFC_READ_TABLE in the first place!

           

          I think we understand that the new way to go is through Web Services.  There is a web service repository which has links to various RFCs designed for business purposes.

           

          I would investigate that avenue thouroghly.

Actions