Un Usuario hizo la siguiente pregunta
qué es una declaración de condensador y su función.
4 respuestas
Ex miembro
Hola vijay
La declaración CONDENSE elimina los espacios redundantes de un cable:
CONDENSAR
[NO-GAPS]. Esta declaración elimina cualquier brecha inicial en el campo.
y un blanco se reemplaza por otra secuencia de blancos. El resultado es una secuencia de palabras justificadas a la izquierda, cada una separada por un espacio en blanco. Si se especifica el suplemento NO-GAPS, se eliminan todos los huecos. DATA: STRING(25) VALUE ' one two three four', LEN TYPE I. LEN = STRLEN( STRING ). WRITE: STRING, '!'. WRITE: / 'Length: ', LEN. CONDENSE STRING. LEN = STRLEN( STRING ). WRITE: STRING, '!'. WRITE: / 'Length: ', LEN. CONDENSE STRING NO-GAPS. LEN = STRLEN( STRING ). WRITE: STRING, '!'. WRITE: / 'Length: ', LEN.
Producción:
uno tres tres!
Moda: 25
uno tres tres!
Moda: 18
¡uno dos tres CUATRO!
Moda: 15
Tenga en cuenta que no hay ningún cambio en la longitud total del tono STRING, pero los espacios eliminados aparecen nuevamente a la derecha.
Sobre Rk
Ex miembro
Hola
Quite los espacios del alambre.
Proporción
CONDENSAR
[NO-GAPS]. Se eliminan todos los espacios iniciales y se coloca un espacio en el campo de caracteres
reemplace otras filas de huecos. Si usa el complemento NO-GAPS, se eliminan todos los espacios. REVISAR SI ES ÚTIL …
Ex miembro
Hola,
Syntaxdiagramm CONDENSE Basic form CONDENSE c. Addition: ... NO-GAPS Note Like all string processsing statements, you can only use character-type operands here. If the type of an operand is not STRING, the operand is treated like a type C field, regardless of its actual type, even though no actual conversion takes place. In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Only character fields allowed in string processing. Effect Shifts the contents of c to the left, so that sequences of blanks are reduced to exactly one blank. Leading spaces (and, for type C fields, trailing spaces as well), are removed completely. Example DATA NAME (30). NAME(10) = ' Dr.', NAME+10(10) = 'Michael', NAME+20(10) = 'Hofmann'. CONDENSE NAME. WRITE NAME. produces the output: Dr. Michael Hofmann Addition ... NO-GAPS Effect Suppresses all blanks from the field c Example DATA: BEGIN OF NAME, TITLE(8) VALUE ' Dr.', FIRST_NAME(10) VALUE 'Michael', SURNAME(10) VALUE 'Hofmann', END OF NAME. CONDENSE NAME NO-GAPS. The contents of NAME is now "Dr.MichaelHofmann". Since the field string NAME is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any sub-fields. The contents of the sub-field would therefore now be as follows: NAME-TITLE = 'Dr.Micha' NAME-FIRST_NAME = 'elHofmann ' NAME-SURNAME = ' ' Note Do not use CONDENSE to manipulate structures that include fields not of type C. This could result in the subfields containing characters of a different (i.e. incorrect) type. You cannot use the statement with structures containing components of type STRING. Note Performance: The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn. Related SHIFT, CONCATENATE, REPLACE, SPLIT Additional help Compressing Field Contents
Una vez resuelto su problema, recompense los puntos y cierre el hilo.
Vasanth
Hola,
suprime todos los huecos del campo de tipo CHAR,
puntos de recompensa y cierre el hilo.
Salud,
Harish
El mensaje fue editado por:
Harish AGINATI