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

assignment

Former Member
0 Likes
444

hi,

Is it possible to assign a structure of partly character type of length 39 to a single field of type character and length 75.If so help me its urgent.Thanks in advance and points will be rewarded.

Regards,

Padma.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
424

You just need to move the structure fields into the char75 field individually.

char75+0(10) = structure-field1. "If type c

write structure-field2 to char75+10(16). "for numeric types

or use temporary intermediate fields that you condense to remove spaces if needed.

write structure-field3 to l_temp1.

CONDENSE l_temp1 NO-GAPS.

char75+26(5) = l_temp1.

Andrew

4 REPLIES 4
Read only

Pawan_Kesari
Active Contributor
0 Likes
424

if your system is unicode then i doubt..

Read only

0 Likes
424

hi,

yes am system is unicode.

Read only

0 Likes
424

I think its not possible then...

below is extract from sap help

<b>Conversion between structures and single fields</b>

The following rules apply for converting a structure into a single field and vice versa:

If a structure is purely character type, it is treated like a C field during conversion

If the single field is of type C, but only part of the structure is character type, conversion is only possible if the

structure begins with a character type group and if this group is at least as long as the single field. Conversion now

takes place between the first character type group of the structure and the single field. If the structure is the

target field, the character type sections of the remainder are filled with blanks, and all other components are

filled with the type-adequate initial value

Conversion is not permitted if the structure is not purely character type and if the single field is not character

type.

As with the assignment between structures, filling non-character type components with the initial value is

incompatible. In addition, an incompatible semantic change results if the target is a single field of type N and

parts of the structure content were previously relevant to conversion that do not originate from the first character

type component.

The conversion cannot be performed if the structure is not purely character-type and the single field is not of type

C

Read only

Former Member
0 Likes
425

You just need to move the structure fields into the char75 field individually.

char75+0(10) = structure-field1. "If type c

write structure-field2 to char75+10(16). "for numeric types

or use temporary intermediate fields that you condense to remove spaces if needed.

write structure-field3 to l_temp1.

CONDENSE l_temp1 NO-GAPS.

char75+26(5) = l_temp1.

Andrew