cancel
Showing results for 
Search instead for 
Did you mean: 

Agentry - populating a nested collection property during a transmit

former_member231132
Participant
0 Kudos

During my transmit I have a call to an oData service that returns a set of readings that need to be collected on the mobile client. Each reading returned from the oData service contains a set of meta data that will be used by my app to determine how to collect the data for the reading (min/max values, validation rules, etc).  The meta data for each reading will be placed in a collection called "ReadingTemplatesCollection" and this collection will contain an object called "ReadingTemplate".   One of the fields in the meta data is a string that contains the values to display in a drop down list.  The field that contains the drop down choices is in format:  choice1;choice2;choice3.  I'm assuming that since I need to place choice1, choice2, and choice3 in a drop down I'll need to put them in a nested collection within ReadingTemplate.   My question is, within an action step of my transmit, how can I parse the list of choices and then place the choices in a collection within the ReadingTemplate object?

Thanks

Tim

Accepted Solutions (1)

Accepted Solutions (1)

former_member231132
Participant
0 Kudos

I was able to accomplish this by creating additional subaction steps in my transmit to loop over the meta data once for each choice in the list.  I found from the user that there will be at most two choices in the list, so I loop over the meta data two additional times and add the first choice in the first loop and the second choice in the second loop using an add transaction for each.

agentry_src
Active Contributor
0 Kudos

Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why   Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be. 

Do not use Assumed Answered as it confuses anyone looking for the specific answer.  If you dig into the Getting Started link (top right of each SCN page), you are only instructed to mark Helpful or Correct Answers to Discussion responses. 

Thanks, Mike (Moderator)

SAP Technology RIG

Answers (2)

Answers (2)

Marçal_Oliveras
Active Contributor
0 Kudos

Hi Tim,

You have to do the following:

Agentry:

  • Create a new Object ReadingTemplate with its properties
  • Add this new object as a collection property named ReadingTemplate to the MainObject
  • Create a new Step, for instance call it GetReadingTemplateSteplet.
    • In the connection properties, I'm a bit lost because I never used oData, but if it has to be called from Java as usual, just select the JavaConnection. Then in the java class enter the steplet class name you will use. For instance com.sap.yourappname.GetReadingTemplateSteplet
  • Create a new Fetch
    • In general settings link it to :>Main Object>"ReadingTemplate" property
    • Mark "Run this fetch during transmit?" flag
    • Add a server exchange step that calls the step created in the previous bullet.

Java?:

  • Now, assuming that for oData everything is implemented in the same way than with JCO calls, then you should do it the way SAP does in their standard products:
    • Create a steplet class that gets the user and instantiates/executed the relevant StepHandler
    • Create a Step Handler class, that executes the relevant class to call the oData service and adds the results to the collection.
    • Create the class to call the oData service.

This last Java part is a bit complicated to understand if you didn't do it before, the best is to check Java source of a SAP standard product if you have access.

mark_pe
Active Contributor
0 Kudos

Tim,

Hi. I may see if any other consultant in SAP has done this type of project.

In Theory:

Agentry:

MainObject

|__ReadingTemplate Collection

ReadingTemplate Object

FETCH

Transmit

|___FETCH - (Collection)

       |___JAVA (create objects + Stephandler)

                        |_______Odata

Regards,

SAP Mobile Support Team