Search code examples
responsesap-erpsaprfcbapijco

how to restrict the number of table columns in bapi output


While querying BAPI, we are generally interested in only few columns of a table.

For example PO_ITEMS table (under BAPI_PO_GETITEMS) has 58 columns. While querying, I am interested in only 10 of those columns. But the BAPI response contains all the columns, which is a overhead.

In SQL world, we can always select which columns we want to retrieve. The query response contains only those columns, not all the columns.

I remember I have read somewhere that we can disable unwanted columns coming in response. But when I need it now, I am not able to find information about it.

Can anybody share a code snippet to achieve this? Or specific online resource/pointers would help?

Thanks


Solution

  • Depending on which technology you use to call the BAPI, you can sometimes restrict which parameters are transferred. For example, if you use the SAP Java Connector (JCo 3), you can use the method setActive of a parameter to restrict whether the parameter is transferred. However:

    • As far as I know, you can only enable or disable entire TABLES parameters or other parameters. You can't enable or disable individual columns.
    • As far as I know, the BAPI itself does not know about this setting - and even if it would know, few implementations would care.

    Sometimes there are additional parameters that allow you selectively enable or disable fields, but that is part of the actual BAPI implementation and not some omnipresent basic technology.