01-06-2008 6:10 PM
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
01-06-2008 6:18 PM
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.....
01-06-2008 7:45 PM
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
01-06-2008 7:53 PM
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.
01-06-2008 8:48 PM
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
01-06-2008 10:06 PM
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
01-06-2008 10:30 PM
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
01-08-2008 12:32 PM