cancel
Showing results for 
Search instead for 
Did you mean: 

populating info object from another info Object

Former Member
0 Kudos

Hi Friends,

I have  added a new info Object in a DSO, I have to populate this newly added info object with an existing info object.

However, my issue is the existing info object is of length 45 and my new info object is of length is 26. Now my issue is I have to read bit of existing IO into the new one.

ex: existing info object contains the following

000000010000000000200011021511075816072414

my new IO should be populated with 4 values from 6th position and 2 values from position 19, 4 values from 23rd position.

My abap knowledge is very basic, can some one please suggest me how to achieve this in the end routine?.

Regards

Naveen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi PJ anf Francis,

Thanks a lot for your reply and help. I will try this and will let you know.

Regards

Naveen

Former Member
0 Kudos

Hi Francis/PJ,

I tried writing the code as mentioned by you. However, my source field does not exist in the source DSO but it is derived in the target DSO by field routine. In this scenario can you suggest me how to acheive this?.

Apologies for the inconvenience.

Regards

Naveen

former_member226999
Contributor
0 Kudos

You can use this code in the Endroutine

LOOP AT result_package ASSIGNING < result_fields >.

        CONCATENATE < result_fields >-char45+6(4)

                                    < result_fields >-char45+19(2)

                                    < result_fields >-char45+23(4)

                             into < result_fields >-CHAR26.

    ENDLOOP.

Former Member
0 Kudos

Hi Francis,

Thanks a lot for your help. The code is working as i wanted. Appreciate your help on this.

I am really sorry, I don't know how to assign points here.

Regards

Naveen

former_member226999
Contributor
0 Kudos

Hi Naveen,

Glad to see another issue solved. Don't worry about points they come automatically when you mark your question as answered or mark any reply as helpful answer.

Answers (2)

Answers (2)

former_member226999
Contributor
0 Kudos

Try this

say your long value is in <source_field>-char45 and your target is RESULT.

* assuming <source_field>-char45 has value '000000010000000000200011021511075816072414',

This is the code for the transformation field update rule

CONCATENATE <source_field>-char45 +6(4)

                            <source_field>-char45 +19(2)

                            <source_field>-char45 +23(4)

                     into RESULT.

former_member241605
Active Participant
0 Kudos

Hello Naveen,

You have to use Field Routine and in that you have to use the CP* ( Contains pattern) to achieve your requirement

you have to declare 3 local variables in the field routine which can store the values as per your requirement

IF SOURCE_FIELDS-(YOUR EXISTING FIELD NAME) CP '00000*'.

xxx = source_fields-Existing Field+6(4).

yyy = source fields-existing Field+19(2).

zzz = source fields-existing field+23(4).

then concatenate all 3 into another one then finally

former_member241605
Active Participant
0 Kudos

you have to concatenate all 3 into one local variable and then

RESULT =  LOCAL VARIABLE.

ELSE.

CLEAR LOCAL VARIABLE.

hope it may answer you.

Regards,

PJ