Skip to main content
  1. Documentation/

Coniunctiones in ABAP

··18 mins· loading · loading · · ·
SAP ERP Back-End
Adrien D'acunto
Author
Adrien D’acunto
Table of Contents

Conditions in ABAP
#

IF … ENDIF
#

Objectives
#

  • Understand how the IF statement works in ABAP
  • Know how to test one or more conditions with IF, ELSEIF and ELSE
  • Learn to combine conditions with AND and OR
  • Prevent errors and unexpected behaviors (e.g., division by zero)
  • Know how to properly organize conditions to respect AND / OR priority

Definition
#

The IF statement allows testing a condition on a variable and executing processing only if this condition is true. It can be completed with ELSEIF to test other conditions and ELSE to handle all remaining cases.

Like a pedestrian crossing: if the light is green, you cross; if the light is orange, you slow down; otherwise you wait.

IF is the simplest control structure to handle conditional logic in ABAP. Proper use of AND and OR allows efficiently combining multiple logical conditions.

Syntax
#

IF log_exp1.
  [statement_block1]
[ELSEIF log_exp2.
  [statement_block2]]
...
[ELSE.
  [statement_blockn]]
ENDIF.
  • log_exp: logical expression to test
  • ELSEIF: allows testing another condition if the first is false
  • ELSE: executes processing if all previous conditions are false

IF/ELSEIF/ELSE blocks must be properly indented for better code readability.

Examples
#

Simple Example
#

WRITE:/ '     - SIMPLE IF...'.

DATA: lv_a TYPE I,
      lv_b TYPE I,
      lv_c TYPE I.

lv_b = 3.
lv_c = 2.
lv_a = lv_b + lv_c.

IF lv_a = 5.
  WRITE:/ 'Condition confirmed, lv_a = 5'.
ENDIF.

Check if an object has the expected value before proceeding to the next action.

With ELSEIF and ELSE
#

WRITE:/ '     - IF ELSEIF...'.

DATA lv_month TYPE I.
lv_month = SY-DATUM+4(2).

IF lv_month = 1.
  WRITE:/'It''s January'.
ELSEIF lv_month = 2.
  WRITE:/'It''s February'.
ELSEIF lv_month = 3.
  WRITE:/'It''s March'.
ELSEIF lv_month = 4.
  WRITE:/'It''s April'.
ELSEIF lv_month = 5.
  WRITE:/'It''s May'.
ELSE.
  WRITE:/'Another month of the year'.
ENDIF.

ELSEIF avoids stacking multiple nested IFs and makes code more readable.

Using AND / OR
#

WRITE:/ '     - IF ELSEIF AND/OR...'.

DATA: lv_month TYPE i,
      lv_day   TYPE i.

lv_month = SY-DATUM+4(2).
lv_day   = SY-DATUM+6(2).

IF lv_month = 12 OR lv_month = 1 OR lv_month = 2.
  WRITE:/'It''s winter'.
ELSEIF lv_month = 3 OR lv_month = 4 OR lv_month = 5.
  WRITE:/'It''s spring'.
ELSEIF lv_month = 6 OR lv_month = 7 OR lv_month = 8.
  WRITE:/'It''s summer'.
ELSEIF lv_month = 9 OR lv_month = 10 OR lv_month = 11.
  WRITE:/'It''s autumn'.
ENDIF.

IF lv_month = 1 AND lv_day = 1.
  WRITE:/'Happy New Year'.
ELSEIF lv_month = 12 AND lv_day = 25.
  WRITE:/'Merry Christmas'.
ELSEIF lv_month = 5 AND lv_day = 1.
  WRITE:/'Happy Labor Day'.
ELSE.
  WRITE:/'Have a good day'.
ENDIF.

The AND operator checks that all conditions are true, while OR checks that at least one condition is true.

AND / OR Priority
#

The AND operator always has priority over OR. To avoid any ambiguity, use parentheses.

WRITE:/ '     - IF PRIORITY...'.

IF ( lv_month = 1 OR lv_month = 2 ) AND lv_day = 1.
  WRITE:/ 'New Year or other event in January/February'.
ENDIF.

Always clarify logic with parentheses to avoid unexpected results.

Avoiding a Dump
#

WRITE:/ '     - PREVENTIVE ANTI-DUMP IF...'.

DATA: lv_a      TYPE I,
      lv_b      TYPE I,
      lv_result TYPE I.

lv_a = 5.
lv_b = 0.

IF lv_b > 0.
  lv_result = lv_a / lv_b.
  WRITE lv_result.
ELSE.
  WRITE 'The value of lv_b is equal to 0, operation impossible'.
ENDIF.

Check conditions to avoid runtime errors, like division by zero.

Summary
#

  • IF tests a condition and executes the block if it’s true.
  • ELSEIF allows testing alternative conditions.
  • ELSE captures all other uncovered cases.
  • AND / OR allow combining multiple conditions.
  • Always use control to avoid errors like division by zero.

[!TIP] Like traffic lights and signs: depending on the situation, the action changes.


Comparison Operators
#

Objectives
#

  • Understand the role of comparison operators in ABAP
  • Know how to apply operators to test equality, difference and order relations
  • Know how to use keywords (EQ, GT, LE, etc.) in ABAP statements

Definition
#

Comparison operators allow testing conditions between two values. They can be used for all data types: numeric, alphanumeric or text.

These operators are mainly used in IF, WHILE statements or any logical condition. They return true or false based on the comparison result.

Operator Table
#

Operation Sign Keyword Meaning
Equal = EQ EQual
Strictly greater than > GT Greater Than
Greater than or equal to >= GE Greater or Equal
Strictly less than < LT Lower Than
Less than or equal to <= LE Lower or Equal
Different <> NE Not Equal
  • = or EQ checks strict equality
  • > or GT and < or LT compare numeric or alphabetic values
  • >= or GE and <= or LE include equality in comparison
  • <> or NE checks that two values are different

Like measuring and comparing two objects to know which is larger, smaller, identical or different.

Prefer keywords (EQ, NE, GT, etc.) in ABAP statements for better readability and code clarity, especially when read by other developers.


CASE … ENDCASE
#

Objectives
#

  • Understand how the CASE statement works in ABAP
  • Know how to test a variable and execute processing based on its value
  • Learn to use WHEN, OR and WHEN OTHERS to handle all possible cases
  • Avoid unexpected behaviors by providing default processing

Definition
#

The CASE statement allows checking the value of a (single) variable and executing different processing based on this value.

Like a traffic light: depending on the color (value), you perform a different action (stop, go, slow down).

CASE is often more readable than a series of IF ... ELSEIF ... ELSE when you have multiple values to test for the same variable.

Syntax
#

CASE operand.
  [WHEN operand1 [OR operand2 [OR operand3 [...]]].
    [statement_block1]]
  ...
  [WHEN OTHERS.
    [statement_blockn]]
ENDCASE.
  • operand: variable to test
  • WHEN: defines one or more values and associated processing
  • OR: allows associating multiple values for the same processing
  • WHEN OTHERS: optional, captures all unforeseen cases

Always provide a WHEN OTHERS to avoid unexpected behaviors if the variable value is not in the defined cases.

Prefer CASE when multiple values of the same variable must trigger distinct processing, for better code readability and maintenance.

Example
#

WRITE:/ '     - CASE ENDCASE...'.

DATA: lv_month TYPE i.

lv_month = SY-DATUM+4(2).

CASE lv_month.
  WHEN 12 OR 1 OR 2.
    WRITE:/'It''s winter'.
  WHEN 3 OR 4 OR 5.
    WRITE:/'It''s spring'.
  WHEN 6 OR 7 OR 8.
    WRITE:/'It''s summer'.
  WHEN 9 OR 10 OR 11.
    WRITE:/'It''s autumn'.
  WHEN OTHERS.
    WRITE:/'No more seasons!'.
ENDCASE.

The program reads the lv_month variable as if reading a menu choice: depending on the value, a specific action is performed.

Summary
#

  • CASE tests a variable to execute different processing based on its value.
  • WHEN defines possible values and associated processing.
  • OR allows grouping multiple values under the same processing.
  • WHEN OTHERS captures all unforeseen values to avoid errors.

[!TIP] Like a menu with multiple options: depending on the user’s choice, a different action will be executed.


IS INITIAL
#

Objectives
#

  • Understand using IS INITIAL to test if a variable is empty or contains its default value
  • Know how to use IS NOT INITIAL to check that a variable contains a value
  • Apply IS INITIAL with IF for simple conditions
  • Apply IS INITIAL with CASE to handle multiple cases
  • Simplify tests for uninitialized or empty variables

Definition
#

The IS INITIAL statement allows testing whether a variable is initialized or not.

  • IS INITIAL returns true if the variable is empty or contains the default value for its type.
  • IS NOT INITIAL returns true if the variable contains a value.

Like checking if a box is empty or contains something

Very practical to avoid errors when working on variables that may not yet be filled

Syntax
#

With IF
#

IF operand IS [NOT] INITIAL.
  [statement_block]
ENDIF.

With CASE
#

CASE operand.
  [WHEN IS [NOT] INITIAL].
    [statement_block1]
  ...
  [WHEN OTHERS].
    [statement_blockn]
ENDCASE.

IS INITIAL works for all variable types: strings, numbers, dates, times, internal tables.

IF IS INITIAL
#

WRITE:/ '     - IS INITIAL + IF...'.

DATA: lv_text TYPE string,
      lv_num  TYPE i.

lv_text = ''.
lv_num  = 0.

IF lv_text IS INITIAL.
  WRITE:/ 'The lv_text variable is empty'.
ENDIF.

IF lv_num IS NOT INITIAL.
  WRITE:/ 'The lv_num variable contains a value'.
ENDIF.

Check a box before using it: if it’s empty, you can fill it, otherwise you read its content

Summary
#

  • IS INITIAL tests if a variable is empty or contains its default value.
  • IS NOT INITIAL tests if the variable contains a value.
  • Works for all variable types: strings, numbers, dates, internal tables.

[!TIP] Like checking if a box is empty or filled before acting on its content


BETWEEN
#

Objectives
#

  • Understand using BETWEEN to test if a variable is in a range
  • Know how to apply BETWEEN low AND high with IF
  • Know how to apply BETWEEN low AND high with CASE
  • Simplify numeric comparisons using BETWEEN
  • Combine BETWEEN with other tests like IS INITIAL for robust conditions

Definition
#

The BETWEEN statement allows testing if a variable is within a value range.

  • BETWEEN low AND high returns true if the variable is between low and high inclusively.
  • Can be used with IF or CASE.

Like checking if a value is between two boundaries on a graduated ruler

Ideal for testing score intervals, ages, or any numeric variable that must respect a specific range

Syntax
#

With IF
#

WRITE:/ '     - BETWEEN + IF...'.

DATA: lv_variable TYPE i.

IF lv_variable BETWEEN 1 AND 100.
  WRITE: 'The lv_variable is between 1 and 100.'.
ELSE.
  WRITE: 'The lv_variable is not between 1 and 100.'.
ENDIF.

Rather than writing IF lv_variable >= 1 AND lv_variable <= 100, BETWEEN simplifies reading and reduces error risk.

With CASE
#

WRITE:/ '     - BETWEEN + CASE...'.

DATA: lv_variable TYPE i.

CASE lv_variable.
  WHEN BETWEEN 1 AND 100.
    WRITE: 'The lv_variable is between 1 and 100.'.
  WHEN OTHERS.
    WRITE: 'The lv_variable is not between 1 and 100.'.
ENDCASE.

BETWEEN is compatible with WHEN in a CASE, which makes blocks more readable for numeric ranges.

Summary
#

  • BETWEEN low AND high tests if a variable is between two inclusive values.
  • Works with IF and CASE.
  • Simplifies comparative conditions on numeric ranges.

[!TIP] Like checking if a value is between two boundaries on a graduated ruler, more readable and less error-prone than multiple separate comparisons


CONTAINS ONLY (CO)
#

Objectives
#

  • Understand the CO (Contains Only) operator and its utility
  • Check that a string contains only authorized characters
  • Know how to use IF ... CO ... ENDIF for simple controls
  • Know the case sensitivity of CO
  • Use SY-FDPOS to know the position of the last checked character
  • Apply CO to validate or filter user inputs

Definition
#

The CO (Contains Only) operator allows checking that a character string contains only certain characters defined in another string.

It’s like checking that the letters of a word all belong to a given alphabet.

“HELLO” contains only letters from A to Z → true. “HELLO1” contains a digit → false.

Ideal for controlling user inputs or validating that codes contain only authorized characters

Syntax
#

IF oper1 CO oper2.
  [statement_block]
ENDIF.
  • oper1 → the string to analyze.
  • oper2 → authorized characters in oper1.
  • If oper1 contains only characters present in oper2, the condition is true.

The CO operator checks each character of oper1 and returns TRUE only if all are present in oper2. The position of the last checked character is stored in SY-FDPOS.

Basic Example
#

WRITE:/ '     - IF CONTAINS ONLY...'.

CONSTANTS: lc_oper1 TYPE CHAR5 VALUE 'Hello',
           lc_oper2 TYPE CHAR5 VALUE 'Hello'.

IF lc_oper1 CO lc_oper2.
  WRITE:/ 'lc_oper1 contains only characters from ', lc_oper2,
          ' at position ', SY-FDPOS.
ELSE.
  WRITE:/ 'lc_oper1 does not contain only characters from ', lc_oper2.
ENDIF.

Explanation
#

  • lc_oper1 and lc_oper2 contain 'Hello'.
  • IF lc_oper1 CO lc_oper2. checks that all characters of lc_oper1 are in lc_oper2.
  • Here the condition is true, and SY-FDPOS = 5 indicates the last character position.
  • If lc_oper2 was 'Hell', the condition would be false.
  • CO is case-sensitive: 'HELLO''Hello'.
  • Very useful for validating that entered codes or strings respect an alphabet or a set of authorized characters.

Summary
#

  • CO = Contains Only → tests if all characters of a string belong to an authorized set.
  • Returns TRUE if the string respects the set, FALSE otherwise.
  • The position of the last checked character is available in SY-FDPOS.
  • Ideal for validating or filtering user inputs.

[!TIP] Check that all ingredients of a dish come from a single authorized list, without intruders.

CONTAINS ANY (CA)
#

Objectives
#

  • Understand the CA (Contains Any) operator and its functioning
  • Check if a string contains at least one character from another string
  • Know how to use IF ... CA ... ENDIF for simple controls
  • Use SY-FDPOS to get the position of the first character found
  • Apply CA to detect the presence of specific characters in user input

Definition
#

The CA (Contains Any) operator allows checking if a character string (oper1) contains at least one character present in another string (oper2). The condition is true as soon as a single character from oper2 is found in oper1.

Imagine oper2 as a “box of letters to search for”. If you open oper1 and find at least one of these letters, the CA condition is validated.

  • “HELLO” CA “XYZ” → false (no common letters)
  • “HELLO” CA “AEIOU” → true (there’s “E” and “O”)
  • “HELLO” CA “LLO” → true (the “L” appears very quickly)

Practical for detecting the presence of specific characters in user inputs (letters, digits, symbols)

Syntax
#

IF oper1 CA oper2.
  [statement_block]
ENDIF.
  • oper1 → the tested string
  • oper2 → the string containing searched characters
  • Condition true if at least one character from oper2 is present in oper1

The CA operator traverses oper1 and returns TRUE as soon as it finds a character present in oper2. The system variable SY-FDPOS indicates the position of the first character found.

Example
#

WRITE:/ '     - IF CONTAINS ANY...'.

CONSTANTS: lc_oper1 TYPE CHAR5 VALUE 'Hello',
           lc_oper2 TYPE CHAR3 VALUE 'llo'.

IF lc_oper1 CA lc_oper2.
  WRITE:/ 'lc_oper1 contains at least one character from ', lc_oper2,
          ' at position ', SY-FDPOS.
ELSE.
  WRITE:/ 'lc_oper1 contains no character from ', lc_oper2.
ENDIF.
  • lc_oper1 = 'Hello', lc_oper2 = 'llo'
  • The condition is true because l and o are present in lc_oper1
  • SY-FDPOS = 2 → position of first character found
  • CA is case-sensitive: 'HELLO''Hello'
  • Very useful for checking the presence of digits, letters or symbols in a text field

Summary
#

  • CA = Contains Any → checks if oper1 contains at least one character from oper2.
  • Condition TRUE as soon as a single character matches
  • SY-FDPOS returns the position of the first character found
  • Ideal for checking the presence of specific characters in a string

[!TIP] It’s like searching for a specific letter in a box to know if it’s there


CONTAINS STRING (CS)
#

Objectives
#

  • Understand the CS (Contains String) operator and its functioning
  • Check if a string contains a complete substring
  • Differentiate CS (substring) from CA (individual character)
  • Learn to use IF ... CS ... ENDIF for simple controls
  • Identify when to use FIND to get the exact position or make advanced searches

Definition
#

The CS (Contains String) operator allows checking if a character string (oper1) contains a complete substring (oper2). Unlike CA (Contains Any), which only searches for one character, CS searches for an entire sequence of characters in another string.

Imagine oper1 as a book and oper2 as a specific sentence you want to find. If the exact sentence is present, the CS condition is true.

  • “HELLO WORLD” CS “WORLD” → true
  • “HELLO WORLD” CS “WOR” → true
  • “HELLO WORLD” CS “WORD” → false (letters out of sequence)
  • “HELLO WORLD” CS “hello” → false (case-sensitive)

CS is useful for checking if a text contains a specific sequence without traversing each character individually.

Syntax
#

IF oper1 CS oper2.
  [statement_block]
ENDIF.
  • oper1 → main string
  • oper2 → searched substring
  • Condition true if oper2 is present in oper1

Example
#

WRITE:/ '     - IF CONTAINS STRING...'.

CONSTANTS: lc_oper1 TYPE CHAR11 VALUE 'Hello World',
           lc_oper2 TYPE CHAR5  VALUE 'World'.

IF lc_oper1 CS lc_oper2.
  WRITE:/ 'lc_oper1 contains the character string ', lc_oper2.
ELSE.
  WRITE:/ 'lc_oper1 does not contain the character string ', lc_oper2.
ENDIF.
  • lc_oper1 = “Hello World”
  • lc_oper2 = “World”
  • Condition true because “World” is a substring of “Hello World”
  • Displayed result: lc_oper1 contains the character string World

To get the exact position of the substring or perform more complex searches (case-insensitive, complete word…), use FIND instead.

Summary
#

  • CS = Contains String → checks if oper1 contains the exact substring oper2.
  • Case-sensitive.
  • Condition true if the complete sequence is present.
  • For more detailed searches, use FIND.

[!TIP] It’s like searching for an exact phrase in a book rather than checking letter by letter


NO STRING (NS)
#

Objectives
#

  • Understand the NS (No String) operator and its functioning
  • Check if a string does not contain a specific substring
  • Differentiate NS (absence of substring) from CS (presence of substring)
  • Learn to use IF ... NS ... ENDIF to control absence of a sequence
  • Identify practical cases where checking absence is necessary

Definition
#

The NS (No String) operator is the inverse of CS (Contains String). It allows checking that a character string (oper1) does not contain another substring (oper2).

Imagine oper1 as a book and oper2 as a specific sentence you’re looking for. If this sentence doesn’t exist in the text, the NS condition is true.

  • “HELLO WORLD” NS “WORLD” → false
  • “HELLO WORLD” NS “SAP” → true
  • “HELLO WORLD” NS “hello” → true (case-sensitive)

Syntax
#

IF oper1 NS oper2.
  [statement_block]
ENDIF.
  • oper1 → main string
  • oper2 → searched substring
  • Condition true if oper2 is not present in oper1

Example
#

WRITE:/ '     - IF NO STRING...'.

CONSTANTS: lc_oper1 TYPE CHAR11 VALUE 'Hello World',
           lc_oper2 TYPE CHAR3  VALUE 'SAP'.

IF lc_oper1 NS lc_oper2.
  WRITE:/ 'lc_oper1 does not contain the character string ', lc_oper2.
ELSE.
  WRITE:/ 'lc_oper1 contains the character string ', lc_oper2.
ENDIF.
  • lc_oper1 = “Hello World”
  • lc_oper2 = “SAP”
  • Condition true because “SAP” doesn’t exist in “Hello World”
  • Displayed result: lc_oper1 does not contain the character string SAP

Difference with CS
#

  • CS (Contains String) → true if substring is found
  • NS (No String) → true if substring is not found

Summary
#

  • NS = No String → checks that oper1 does not contain oper2
  • Case-sensitive
  • Logical inverse of CS
  • Very useful for detecting the absence of a word or specific sequence in a string

[!TIP] It’s like checking that a specific phrase doesn’t appear in a book


COVERS PATTERN (CP)
#

Objectives
#

  • Understand the CP (Covers Pattern) operator and its usage
  • Check if a string matches a PATTERN with wildcards (* and +)
  • Use IFCPENDIF for flexible comparisons
  • Identify practical situations: filenames, extensions, text formats
  • Recognize case sensitivity and compatible VARIABLE types (C or STRING)

Definition
#

The CP (Covers Pattern) operator allows testing if a string (oper1) matches a PATTERN (oper2) that can contain wildcards (* and +).

Like a search filter in a file explorer: “*.png” returns all files ending with “.png”.

CP is case-sensitive. “Hello” doesn’t match “*hello”.

Syntax
#

IF oper1 CP oper2.
  [statement_block]
ENDIF.
  • oper1 → STRING to test
  • oper2 → PATTERN possibly containing:
      • → replaces any sequence of characters (even empty)
      • → replaces exactly one character

Use CP to validate file formats, product codes or specific text patterns.

Examples
#

WRITE:/ '     - IF COVERS PATTERN...'.

CONSTANTS: lc_oper1 TYPE CHAR9 VALUE 'image.png',
           lc_oper2 TYPE CHAR5 VALUE '*.png'.

IF lc_oper1 CP lc_oper2.
  WRITE:/ 'The file read is in PNG format'.
ELSE.
  WRITE:/ 'The file read is not in PNG format'.
ENDIF.

Explanation:

  • lc_oper1 = “image.png”
  • lc_oper2 = “*.png”
  • The “*” means “doesn’t matter what’s before .png”.
  • Result: “The file read is in PNG format”

Other Examples
#

  • ‘abc123’ CP ‘abc*’ → TRUE (starts with “abc”)
  • ‘abc123’ CP ‘*123’ → TRUE (ends with “123”)
  • ‘abc123’ CP ‘a+*’ → TRUE (first character “a”, followed by at least one other)
  • ‘hello’ CP ‘*o’ → TRUE (ends with “o”)
  • ‘hello’ CP ‘*x’ → FALSE (doesn’t end with “x”)

CP only works with VARIABLE types C or STRING.

Summary
#

  • CP = COVERS PATTERN → tests matching of a STRING with a PATTERN.
  • Wildcards * → multiple characters, + → one character
  • Case-sensitive
  • Very useful for filtering files, extensions or text formats

[!TIP] Like an advanced search filter: you can say “show me all files starting with ‘abc’ and ending with ‘.txt’”.


NO PATTERN (NP)
#

Objectives
#

  • Understand the NP (No Pattern) operator and its role
  • Check if a STRING doesn’t match a PATTERN with wildcards (* and +)
  • Use IFNPENDIF for inverse comparisons
  • Identify practical applications: exclude files, formats or text patterns
  • Recognize case sensitivity and compatible VARIABLE types (C or STRING)

Definition
#

The NP (No Pattern) operator is the inverse of CP (Covers Pattern). It allows checking if a STRING (oper1) doesn’t match the PATTERN (oper2) containing wildcards (* and +).

If CP is like a filter that selects matching files (e.g., “*.png” to keep only images), then NP is its opposite — it excludes everything that matches this model. It’s like saying: “I want everything except .png files”.

NP is case-sensitive. “Hello” and “hello” will be considered different.

Syntax
#

IF oper1 NP oper2.
  [statement_block]
ENDIF.
  • oper1 → STRING to test
  • oper2 → PATTERN to NOT respect (with * and + as wildcards)

Exclude certain unwanted files or formats, validate that entries don’t match a forbidden pattern.

Examples
#

WRITE:/ '     - IF NO PATTERN...'.

CONSTANTS: lc_oper1 TYPE CHAR9 VALUE 'texte.txt',
           lc_oper2 TYPE CHAR5 VALUE '*.png'.

IF lc_oper1 NP lc_oper2.
  WRITE:/ 'The file read is not in PNG format'.
ELSE.
  WRITE:/ 'The file read is in PNG format'.
ENDIF.

Explanation:

  • lc_oper1 = “texte.txt”
  • lc_oper2 = “*.png”
  • The program tests if “texte.txt” does NOT match the pattern “*.png”.
  • Result: “The file read is not in PNG format”

Other Examples
#

  • ‘photo.jpg’ NP ‘*.png’ → TRUE (doesn’t match pattern)
  • ‘photo.png’ NP ‘*.png’ → FALSE (matches pattern)
  • ‘hello’ NP ‘h+*’ → FALSE (does start with “h”)
  • ‘data123’ NP ‘abc’ → TRUE (doesn’t contain “abc”)

The pattern (oper2) must be a string of type C or STRING.

Summary
#

  • NP = NO PATTERN → tests that a string doesn’t match a given PATTERN.
  • Opposite of CP (Covers Pattern).
  • Wildcards: * for multiple characters, + for one.
  • Case-sensitive.
  • Very useful for excluding unwanted files, formats or text patterns.

[!TIP] Like saying “I want everything except this file type or this specific pattern”.

Related

Instructions in ABAP
··20 mins· loading · loading
SAP ERP Back-End
Introduction to ABAP
·14 mins· loading · loading
SAP ERP Back-End
ABAP Program Structure
··12 mins· loading · loading
SAP ERP Back-End
Loops in ABAP
··11 mins· loading · loading
SAP ERP Back-End
ABAP Variables & Declarations in ABAP
··11 mins· loading · loading
SAP ERP Back-End
Dracula Theme
·1 min· loading · loading
SAP ERP