Skip to main content


 

Symptoms

 


SmartObject Returns blank record
 

 

Diagnoses

 


K2 Connect Service Object that contains a custom SAP BAPI method when the corresponding SmartObject is executed it returns a blank record in addition to the expected output.

I believe this is due to the Service Object containing properties (even though they have been changed to parameters for the Smart Object). How do I eliminate the blank record?
 

 

Resolution

I believe to get rid of the extra/blank record, we will need to:

1. Serialize all of the structures returned by you BAPI, this would include the "out_data" structure
http://help.k2.com/kb000712
2. Create method parameters for these serialized structures and for the createdate and createtime field
3. Create a custom smartobject and custom method that would do all of the serializations, execution of the BAPI, and deserializations of the structures
4. The method would probably call the service object methods in this order:

1) Serialize the doctypes item, store its return to the method parameter created
2) Serialize the deliveryblocks item, store its return to the method parameter created
3) Serialize the billingblocks item, store its return to the method parameter created
4) Serialize the orderreasons item, store its return to the method parameter created
5) Execute the BAPI method with the parameter inputs, and store the return data in the same parameter inputs
6) Deserialize the doctypes item/array, passing its the parameter values stored in step 5
7) Deserialize the deliveryblocks item/array, passing its the parameter values stored in step 5
😎 Deserialize the billingblocks item/array, passing its the parameter values stored in step 5
9) Deserialize the orderreasons item/array, passing its the parameter values stored in step 5

This should serialize all of the structure, execute the bapi with those structures, deserialize the results and return the results without the extra row.

If any of your input collection/structure can accept more than one row, then the single method that I had previously suggested will not apply to this use case.

One possible way to handle this use case, is to create another smartobject that contains the "Serialize Add Item To Array" method for the collection/structure that accept multiple rows. As this method will build and return an XML if empty or will update the XML input to contain the additional rows added. The multi-row XML will typically have the structure below and can usually be stored as a memo/text field:

<connect>
<ParentNode>
<ChildNode>data</ChildNode>
<ChildNode>data</ChildNode>
</ParentNode>
<ParentNode>
<ChildNode>data</ChildNode>
<ChildNode>data</ChildNode>
</ParentNode>
</connect>

You can call the "Serialize Add Item To Array" as many times as needed to build the multi-row/repeating node XML and then pass that into your BAPI method. The "Serialize Add Item To Array" return data can be stored in a process String datafield or possibly a process XML field that handles repeating nodes until the execution of you BAPI smartobject and method. As you BAPI is returning collections/structures with multiple rows (Serialized Typed Array) you will most likely need to call corresponding collection/structures's "Deserialize Typed Array" method if you wish to return the data to a flat table as properties.

 

 



 
Be the first to reply!

Reply