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 field vbak-netwr

joerg_arndt
Participant
0 Kudos

Hi Friends,

I have a small problem.

in the code below I got a short dump, says.

During concatenate the Operand <FS> is of Format "P" and it is not allowed, only strings.

do.

assign component sy-index of structure I_VBAK to <fs>.

if sy-subrc <> 0.

exit.

endif.

if sy-index = 1.

xout = <fs>.

else.

-> concatenate xout <fs> into xout separated by ','.

endif.

enddo.

How can I check and change the Data type of <fs> in this moment.

I have tried a cast like "field-symbols: <fs> type c" but I get only strange characters for this field vbak-netwr.

Can anyone help me?

Thank's Jimbob

7 REPLIES 7

Former Member
0 Kudos

what type of value u r getting into <fs>?

if it is a decimal value in decimal addition is mandatory.... like.....

Data: amount type P decimals 2.

Try to check with this.....

joerg_arndt
Participant
0 Kudos

Hi Naveen,

it is of type 'P' .

The problem is "concatenate" can not proceed data of type 'P'.

So I have to change the type at runtime before concatenate the field. But how can I check the field type and change it to a string?

Rg.Jimbob

0 Kudos

xout_final type string.

do.

assign component sy-index of structure I_VBAK to <fs>.

if sy-subrc 0.

exit.

endif.

if sy-index = 1.

xout = <fs>.

xout_1 = <fs>.

else.

-> concatenate xout xout_1 into xout_final separated by ','.

xout = xout_final.

clear xout_final.

endif.

enddo.

joerg_arndt
Participant
0 Kudos

Thanks Jay,

but it does not work.

At last I did in this way.

But now I have all the empty 'N' fields filled with zeros.

data: xout_1 type string

clear xout.

do.

assign component sy-index of structure I_VBAK to <fs>.

if sy-subrc <> 0.

exit.

endif.

if sy-index = 1.

xout = <fs>.

else.

-> xout_1 = <fs>.

concatenate xout xout_1 into xout separated by ','.

endif.

enddo.

I'm looking for a way to check the format of <fs> at runtime and when it is 'p' I change it to 'c' or move the value to a string field.

Thank you anyway.

Rg. Jimbob

0 Kudos

I doubt if you can check the format of field symbol, but I cam sure you can do it for variables

by describe field F1 type w_type.

if F1 is a type p then w_type will hold 'P'

F1 is a type n then w_type will hold 'N'.

award points if helpful

mnicolai_77
Active Participant
0 Kudos

hi,

try this way,

>data: filed_type(1),

> xout1(30).

>do.

>assign component sy-index of structure I_VBAK to <fs>.

>if sy-subrc 0.

>exit.

>endif.

>if sy-index = 1.

>xout = <fs>.

>else.

>describe field <fs> type filed_type.

>if field_type = 'P'.

>write <fs> to xout1.

>concatenate xout xout1 into xout separated by ','.

>else.

>concatenate xout <fs> into xout separated by ','.

>endif.

>endif.

>enddo.

bye

Marco

joerg_arndt
Participant
0 Kudos

Thanks to all.