‎2007 Aug 17 4:36 PM
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.
‎2007 Aug 18 5:39 AM
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
‎2007 Aug 17 4:41 PM
‎2007 Aug 17 4:43 PM
‎2007 Aug 17 4:51 PM
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
‎2007 Aug 18 5:39 AM
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