cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent JCo of sending empty fields?

Former Member
0 Kudos

Hi everyone,

I am currently writing an interface for creating customer and material master data inside sap.

For this purpose I use Java and JCo3.

My interfaces are working properly, but one thing is missing.

For creating customers I have written a wrapper class in abap for the function module SD_CUSTOMER_MAINTAIN_ALL.

I already can create customers and as well can send updates, but for updates I got an issue.

I have to push all fields to SAP even if they haven't changed.

For example:

name: Test

Street: DemoStreet

City: DemoCity

If I want to update only the City, I have to send all three values. If I don't do this, the Name and Street will be deleted in SAP.

If I take a look at the xml structure (JCoFunction function.toXML()) I can see, that every field I do not fill with an value is send as an empty field. In case of that, every empty field will be deleted in SAP.

Is there a way to prevent JCo to send empty fields? (In other words: If I don't fill a field, I want JCo not to send it)

Best Markus

Accepted Solutions (0)

Answers (1)

Answers (1)

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can prevent JCo from sending empty parameters, but structures are always sent as a whole.

The RFC protocol does not allow to exclude single fields of a structure from being sent.

Some function modules offer additional parameters for indicating which values of a structure should be used in this call. But I don't know if there is such an offering in your case.

Otherwise I recommend that you read the needed structure first, then copy it to your empty maintenance JCoFunction object and overwrite only the values which you would like to change.

Best regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

thanks for your reply

You can prevent JCo from sending empty parameters, but structures are always sent as a whole.

The RFC protocol does not allow to exclude single fields of a structure from being sent.

--> How can I do that. The most interesting part would be to avoid whole structures and tables.

Best

Markus

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Markus,

please see the JCo API JavaDoc at method

com.sap.conn.jco.JCoParameterList.setActive([name|index], boolean)

For example, if you are not interested in the results of a table, you may specify 'false' for setting it inactive, thus saving the bandwidth for an unneeded data transfer. Especially if this table usually is a large one this is speeding up performance remarkably.

Best regards,

Stefan