Application Development and Automation 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: 
Read only

Variable value gets truncated

Former Member
0 Likes
1,906

Hi

I have a work area which i have declared like a table.

One filed in the work area is of type CHAR and length 12.

I am adding a value to this workarea of type CHAR.

But the length is more than 12. So the variable name gets truncated.

Can someone please help me.

data: wa_prof type profile.

wa_prof- profilename = 'ABAPDEVELOPER'

But when i execute only the first twelve letters get displayed.

what can be done ?

thanks in advance.

10 REPLIES 10
Read only

Former Member
0 Likes
1,328

Hi,

Declare that workarea field type string,so that you can store up to 255 char and that value will not be truncated.

Reward if useful.

Read only

0 Likes
1,328

How do i declare workarea to be string?

I want it to have structure as in the table.

Read only

0 Likes
1,328

When i declare the work area field name aas string.,

It says " fieldname already declared"

Read only

0 Likes
1,328

Declare that particular filed as type string.

or decalre types with req fields and declaring that particular field as string or increase the length. then declare the work area refering to that types.

types:begin of ty_mara,

matnr type matnr,

normt type string,

matkl type matkl,

end of ty_mara.

data:wa_mara type ty_mara.

Read only

0 Likes
1,328

this is my code.

data : l_wa_prof like bapiprof, -->declaring the workarea

l_t_prof like bapiprof occurs 0 with header line, --->declaring internal table

l_wa_prof-bapiprof = 'SAP_BI-WHM_RFC'. --->Adding value to workarea

l_t_prof = l_wa_prof.

append l_t_prof. -


>appending it to internal table

clear l_t_prof.

How to change in this ?

Read only

Former Member
0 Likes
1,328

Increase the length of your variable

Read only

0 Likes
1,328

Increasing lenght of variable . how ?

I tried declaring as wa_prof-profile name type char(20)

it doesnt work

Read only

Former Member
0 Likes
1,328

Hi,

It is obvious that if the value which you are passing is more than 12 then it will get truncated. You need to change the length of your workarea in that case.

But if the value is with leading space then you can do one thing is use CONDENSE statement before passing the value to the workarea.

Regards

Sourabh

Read only

0 Likes
1,328

How do i change the length of the workarea.

It is declared as a standard table type.

Read only

Former Member
0 Likes
1,328

Its ok u can do 1 thng

Declare a wa type any or string

move your workarea into the new workarea

i think this should work

Regards