0

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

Gana
  • 494
  • 3
  • 10
  • 28

2 Answers2

1

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.

vwegert
  • 18,093
  • 3
  • 33
  • 54
  • Yes, thanks for that. What do you think are the alternative solutions to handle this effectively? – Gana Dec 13 '13 at 08:02
  • Find out whether that is the overhead that is causing you problems at all. Most of the time this is not the point where you lose time. – vwegert Dec 13 '13 at 09:04
0

this is not exact answer for your question.i hope it will help.I think we have no option to select certain number of column from a function module tables.but we can access particular row from that table like passing mandatory values from java side .....like this sample code here i did for function module(not table table).

JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME);

  JCoFunction jf=destination.getRepository().getFunction("ZUSER_DET");

jf.getImportParameterList().setValue("FIRST_NAME","username");

 jf.execute(destination);

String jfex=jf.getExportParameterList().getString("some column name from return table");

System.out.println(jfex);

it will return a row of table value.you can manipulate whatever you want

  • Hi Ganesh, I was referring to the number of columns of the row. As explained in the question, the issue is with the columns that i am not interested. While using getTable.("PO_ITEMS").getValue("COLUMN_NAME"), we dont realize this. But If you look at jcoFunction.getTableParameterList().getTable("PO_ITEMS").toXML(), it will print all the fields and values that are part of this PO_ITEMS table. Good luck to you for exploring more. – Gana Jan 08 '14 at 16:48