La comparación de variables constantes y literales es:
Forms | ||
v1 = v2 | EQ | v1 equals v2 |
v1 <> v2 | NE, >< | v1 does not equal v2 |
v1 > v2 | GT | v1 is greater than v2 |
v1 < v2 | LT | v1 is less than v2 |
v1 >= v2 | GE, => | v1 is greater than or equal to v2 |
v1 <= v2 | LE, =< | v1 is less than or equal to v2 |
v1 between v2 and v3 | v1 lies between v2 and v3 (inclusive) | |
not v1 between v2 and v3 | v1 lies outside of the range v2 to v3 (inclusive) |
Durante las comparaciones entre variables, puede haber conversiones.
Para eso se usa el ANALISIS DE PROGRAMA.
Numbers one to nine digits long | |
Numbers 10 or more digits long | |
All others |
Conversiones de variables en la comparación.
- If one field is type f, the other is converted to type f.
- If one field is type p, the other is converted to type p.
- If one field is type i, the other is converted to type i.
- If one field is type d, the other is converted to type d. Types c and n, however, are not converted. They are compared directly.
- If one field is type t, the other is converted to type t. Types c and n, however, are not converted. They are compared directly.
- If one field is type n, both are converted to type p (at this point, the other field can only be type c or x).
- At this point, one field will be type c and the other will be type x. x is converted to type c.
Conversions follow the same rules as those performed by the move statement. Type conversions are fully detailed in the ABAP/4 keyword documentation under the heading "Relational Operators for All Data Types."
COMPARACIÓN DE STRINGS DE CARACTERES
Sensitive? | Blanks Ignored? | |||
v1 CO v2 | Contains Only | v1 is composed solely of characters in v2 | ||
v1 CN v2 | not v1 CO v2 | v1 contains characters that are not in v2 | ||
v1 CA v2 | Contains Any | v1 contains at least one character in v2 | ||
v1 NA v2 | not v1 CA v2 | v1 does not contain any character in v2 | ||
v1 CS v2 | Contains String | v1 contains the character string v2 | ||
v1 NS v2 | not v1 CS v2 | v1 does not contain the character string v2 | ||
v1 CP v2 | Contains Pattern | v1 contains the pattern in v2 | ||
v1 NP v2 | not v1 CP v2 | v1 does not contain the pattern in v2 |
These operators can be used in any comparison expression. The CS, NS, CP, and NP operators ignore trailing blanks and are not case sensitive.
Esto es válido para variables, literales y strings.
Contains Pattern: Se pueden usar las siguientes pattern:
Match any sequence of characters. | |
Match any single character. | |
Interpret the next character literally. |
sy-fdpos. Es una variable del sistema que se puede usar para comparaciones.
Sentencia Case.
La sintaxis de la sentencia case es la siguiente:
case v1.
when v2 [ or vn ... ].
---
when v3 [ or vn ... ].
---
[ when others.
--- ]
endcase.
xxxxx
2 comentarios:
Thanks so much for the resource. am a fresher in sap and this was very helpful SAP ABAP Online Training
nice post thanks for sharing from Swathi
Publicar un comentario