0

I was trying to invoke BAPI_MATERIAL_DISPLAY functional module from SAP JCo, This is how I pass my input parameter.

function.getImportParameterList().setValue("MATERIAL", "10");

From my program output I got

The material 10 does not exist or is not activated.

If I execute BAPI_MATERIAL_DISPLAY using SAP logon, I am getting the entry. Using debugger I found that my input is going as 00000000000010. And so returning response.

I don't know how to handle this in a proper way in SAP JCo.

I had directly passed the value 00000000000010 from SAP JCo and this time I got an error,

com.sap.conn.jco.JCoException: (104) JCO_ERROR_SYSTEM_FAILURE: Screen output without connection to user.

Hope SAP is opening a popup. Let me know how to solve both the issues in SAP JCo.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

1 Answers1

0

Field Material has a conversion exit routine. See also its domain MATNR in the DDIC. These conversion exits are always called automatically by SE37 but not when the Remote Function Module is called directly - like here from outside from a a JCo program.

So if the BAPI expects to get certain parameters in their SAP internal representation format (I don't know if this is the case here), then you have to do this data transformation on your own beforehand, either by doing this purely within an own routine at Java side, or by calling the appropriate conversion routines at ABAP side via RFC.

For more details on this I recommend to study SAP note 206068.

Regarding your second question with the error message "Screen output without connection to user", I guess that this BAPI expects to have a connection to an SAP GUI for displaying the selected data. With a remote function call you don't have a SAP GUI connection by default, but you can attach a SAP GUI to your RFC connection with JCo, namely by specifying the additional logon parameter jco.client.use_sapgui=1. For this to work, an SAP GUI frontend (either for Windows or for Java) also needs to be installed on your host where JCo is running, of course.

Trixx
  • 1,796
  • 1
  • 15
  • 18
  • Thanks for the response. Regarding Screen output without connection to user issue, I tried jco.client.use_sapgui=1, and every time its opening a pop up and asking fo r a selection, I need not select a value every time, I need it to be selected be selecting a default value every time and should get response structure object which has all info in my java application. – Jagadheeswaran Mohan Oct 31 '18 at 09:13
  • I gave a technical answer to your 2 technical questions. I'm no expert regarding the functionality that this BAPI offers, what parameter it requires or if it is suitable for your needs at all. When looking at this BAPI_MATERIAL_DISPLAY it should be obvious that it doesn't have any business data related export parameters. Especially also because it is a member of a function group described as "Dialog APIs for Business Object Material". Maybe BAPI_MATERIAL_GET_DETAIL is what you are looking for. – Trixx Oct 31 '18 at 09:31
  • And by the way, I think that I have answered your meanwhile 3 different questions. So I would be glad, if you would also accept my answer and/or reward this with an upvote. Thanks. – Trixx Oct 31 '18 at 09:35
  • Yes BAPI_MATERIAL_DISPLAY is described as "Dialog APIs for Business Object Material". So BAPI_MATERIAL_GET_ALL is what I need. But still didn't resolved the type conversion for parameter, looking for a solution. And its said that BAPI_MATERIAL_GET_ALL will give all the details, regarding the material number, but i couldnt able to see some data, that i get from MM03, transaction, classical view, Any idea on that? – Jagadheeswaran Mohan Nov 01 '18 at 15:50
  • Use the SAP GUI transaction SE37 and execute BAPI_MATERIAL_GETALL locally in this system in order to see if it works. If it then returns a result, fill in the same import parameter values that you entered in SE37 into the appropriate JCo import parameters, e.g. only parameter MATERIAL and nothing else. And if for example "10" doesn't work, try with leading zeros "000000000000000010". – Trixx Nov 01 '18 at 23:04