cancel
Showing results for 
Search instead for 
Did you mean: 

Assignment Between Structure and Single Field - CL_ABAP_CONTAINER_UTILITIES

Former Member
0 Kudos

Hi, Need some help on this as I'm not familiar with Java programming.

Basically in ABAP, we can assign a structure (with complex data type) into a field (please refer to link below).

Now we need to do similar thing in PI, since PI only support Java then we need to perform similar logic as in CL_ABAP_CONTAINER_UTILITIES =>FILL_CONTAINER_C, but in Java. Understand that there's no concept of structure in Java, in this case PI will receive multiple fields (with different data type) and need to combine them into one field.

I tried few Java command/method but it doesnt give me the same result as in the ABAP class. Appreciate your help if you know anything about this or some sample program that i can test. thanks!

SAP Help Reference for ABAP

[ABAP - Assignment Between Structure and Single Field|http://help.sap.com/saphelp_nw04/helpdata/en/79/c554d3b3dc11d5993800508b6b8b11/frameset.htm]

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Rika,

In java we have collection framework instead...

As per your requirement I understood :

1. You will get a list of different type of objects as input.

2. You want to club it in one unit....right...

3. Once done.....I dont know what you will do with that.....I guess pass it somewhere.....

Now, You can use ArrayList in java to club all your objects in one unit....and send it to any function you want....

Arraylist list= new ArrayList();
    list.add(new MachineGun());
    list.add(new Gun());

But there be carefull when you extract data from List....as you need to type cast them accordingly....

Start trying it...and revert back if you face any problems.....

While extracting you will have to use something like :

if(list.get(0).getClass().getSimpleName().equals("MachineGun")){
   //here you can safely cast in the right class
       MachineGun mgun= (MachineGun )list.get(0);    
   }