Search code examples
c#structurebapisap-dotnet-connector

Setting value of BAPI structure?


it's my first time using a BAPI and API to get data from an ABAP system, my problem is that I don't know how to send a specific entry (ORDER_OBJECTS) see below : these are my BAPI entries : enter image description here

and this is the ORDER_OBJECTS :

enter image description here

for now I can send the NUMBER entry, but I don't know how to send an "X" to the column 'O' (OPERATIONS) in ORDER_OBJECTS.

this is my code :

I keep getting the message :

Element ORDER_OBJECTS[OPERATIONS] unknown

please can anyone help me solve this

thanks

enter image description here


Solution

  • On a IRfcFunction object, SetValue can only handle scalar/elementary parameters like NUMBER.

    The parameter ORDER_OBJECTS is structured, so you should first query the IRfcStructure object from the IRfcFunction object, then apply SetValue on that IRfcStructure object :

    IRfcStructure struct = readData.GetStructure("ORDER_OBJECTS");
    struct.SetValue("OPERATIONS", "X");