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.
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?
Thanks for the suggestions Craig...
I havn't found a FM for my problem. (except for RFC_READ_TABLE, which I and SAP don't really like).
I also thought about writing my own function for this, but I was just curious if there maybe allready is an easy way to read data from sap tables with saprfc.
BSEG is a structure table in SAP with description "Accounting Document Segments".
It has something to do with the processing of documents in the Accounting modules. I don't really know the details.
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?
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.
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
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.
One more thing thrusting us happily into the "future" rather than the archeology of the past, heavens BSEG read, would be to look at the ESA Preview. You can see that there are enterprise services for doing exactly what it is you would like to do.
Home > Accounting Document Processing > General Ledger Processing Enterprise Service > GLAccount Current Balance Query Response .<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/esapreviewsystem">see ESA Preview System</a>