Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

concatenate logic not working

Former Member
0 Kudos

l_test3 type string.

wa_final-durat = wa_/sapapo/trm-durat.

in my wa_final-durat we got value 10203456

we need output l_text3 = 102:03.

i wrote below logic but it not working.

CONCATENATE   wa_final-durat+0(3) ':'  wa_final-durat+3(2) INTO l_text3.

could any one help me for alternative solution.

7 REPLIES 7

Former Member
0 Kudos

This logic should work for you. I don't know if you miss typed the variables name, but you have l_test3 type string but is using l_text3 in the concatenate statement.

Can you paste your full code?

arindam_m
Active Contributor
0 Kudos

Hi,

Try doing should work

CONCATENATE wa_final-durat(3) ':'  wa_final-durat+3(2) INTO l_text3.

Cheers,

Arindam

former_member209120
Active Contributor
0 Kudos

Hi Siba Nayak,

You are maintaining l_test3 and l_text3 S instead of X

Maintain wa_final-durat as string

l_test3 type string.

CONCATENATE   wa_final-durat+0(3) ':'  wa_final-durat+3(2) INTO l_text3.

try like this

data : l_text3 type string,
        wa_final_durat type string.

wa_final_durat = '10203456'.

CONCATENATE   wa_final_durat+0(3) ':'  wa_final_durat+3(2) INTO l_text3.

write : / l_text3.

or

data : l_text3 type string,
        wa_final_durat type string.

wa_final_durat = '10203456'.

CONCATENATE   wa_final_durat(3) ':'  wa_final_durat+3(2) INTO l_text3.

write : / l_text3.


Former Member
0 Kudos

Hi siba nayak,

     You should be getting short dump due to this code as domain 'DURAT' length is 4 and you cannot do the concatenation through above code. Firstly, check the length of the domain and then find whether this value '10203456' is populated in wa_final-durat.

     If you are wa_/sapapo/trm-durat contains '10203456' then try passing to a temporary string variable and then concatenate it.

cheers,


Dineshwar

Former Member
0 Kudos

Hi Siba,

The output you are getting has a conversion routine and not the exact value.

It is the time duration I suppose and will be having a time stamp value

Use the FM CONVERSION_EXIT_TSTRN_OUTPUT it will help.

The value you get from this FM manipulate that value with offset to get the desired value

Regards

former_member289261
Active Contributor
0 Kudos

Hi,

Field type I cannot be used in concatenate statement. So first convert it to char type ( C, N, String, Etc).

declare two variables - DATA     :     LV_TEMP TYPE N LENGTH 10,

                                                     LV_TEXT3 TYPE STRING.

Now,

use the following statement to convert I type to N type,

                                 WRITE WA_FINAL-DURAT     TO     LV_TEMP.

Now perform concatenate on LV_TEMP.

CONCATENATE LV_TEMP(3)     ':'     LV_TEMP+4(3)     INTO     LV_TEXT3.

I have used LV_TEMP+4 for the value after ':' because SAP system places a separator according to your number format which is 123,456 for my system.

So to read the required digits I have to bypass ',' symbol so +4 instead of +3.

Now, for example if your durat field has value 12345678, LV_TEXT3 will have value '123:456'

Regards,

Ashish Rawat



ronaldo_aparecido
Contributor
0 Kudos

Your logic its correctly you can send print of  debug screen with result error?

Thanks.