STRING OPERATIONS🔎
SAP

STRING OPERATIONS🔎

STRING OPERATIONS- CONDENSE

In SAP ABAP, the CONDENSE statement is used for string operations to remove leading and trailing spaces from a string. Here’s how it works:

Article content
CONDENSE
Article content
OUTPUT.

  • CONDENSE removes all leading and trailing spaces from the string and compresses multiple consecutive spaces within the string to a single space. It does not affect spaces between words or characters within the string.
  • CONDENSE is particularly useful when dealing with user input or data extracted from databases, where spaces can inadvertently affect comparisons or display.
  • It simplifies string handling by ensuring consistent formatting without unnecessary spaces.


STRING OPERATIONS- FIND

The FIND statement is used for string operations to locate the position of a substring within a string. Here’s how it works:

Article content
FIND
Article content
OUTPUT


  • FIND is case-sensitive in its search.
  • To perform a case-insensitive search, you can convert both lv_string and lv_substring to uppercase or lowercase using TRANSLATE lv_string TO UPPER CASE or TRANSLATE lv_substring TO UPPER CASE before performing the FIND operation.
  • If you need to find subsequent occurrences of lv_substring, you can use FIND NEXT instead of FIND.

STRING OPERATIONS- TRANSLATE.

The purpose of translation is to convert the string to upper case or lower case.

Article content
TRANSLATE
Article content
RESULT

STRING OPERATIONS- TRANSLATE using pattern

In SAP ABAP, the TRANSLATE ... USING statement allows you to perform character translations based on a pattern. This is particularly useful when you want to replace or delete characters based on a set of rules defined by the pattern. Here’s how you can use TRANSLATE with a pattern:

Article content
TRANSLATE USING PATTERN
Article content
OUTPUT

STRING OPERATIONS- SHIFT

In SAP ABAP, the SHIFT the statement is used for string operations to move characters within a string to the left, right, and circular. It is particularly useful for manipulating strings by shifting character positions based on specified offsets. Here’s how it works:

Article content
SHIFT
Article content
OUTPUT

SHIFT RIGHT/LEFT DELETING TRAILING '0'.

In SAP ABAP, when you want to shift a string to the left or right while deleting trailing zeros, you can achieve this using the SHIFT statement in combination with other string operations. Here’s how you can accomplish this:

Article content
SHIFT RIGHT/LEFT DELETING TRAILING '0'.
Article content
OUTPUT.

  • SHIFT <string> RIGHT/LEFT DELETING TRAILING '0': This syntax tells SAP ABAP to shift the characters in <string> either to the right or left, while simultaneously removing any trailing zeros ('0').
  • The DELETING TRAILING '0' addition ensures that after the shift operation, any zeros at the end of the string are removed.

STRING OPERATIONS- SUBSTRING PROCESSING.

In SAP ABAP, substring processing involves extracting portions of a string based on specified starting positions and lengths. This is useful for manipulating and working with parts of a larger string within your ABAP programs. Here’s how you can perform substring operations:

The basic syntax for substring processing in SAP ABAP typically involves using the SUBSTRING statement or the SUBSTRING function module:

Article content
SUBSTRING PROCESSING
Article content
OUTPUT.


THANK YOU FOR READING🤞











To view or add a comment, sign in

More articles by Pallavi Kumari

  • 🧠 What is SET HANDLER?

    is used in ABAP Objects to register an event handler method to respond to an event raised by another object. Think of…

  • REGEX

    🔍 What is Regex? Regex stands for Regular Expression. A pattern helps you search for specific text inside a string.

  • 🚀 "Understanding SAP System Aliases & RFC: The Invisible Link Powering OData Services"

    Have you ever tried to activate an OData service and wondered why it asks for a System Alias? Or why an RFC Destination…

  • REMOTE FUNCTION CALL(RFC)

    WHAT IS RFC ?🤔 RFC is a communication mechanism in SAP that allows one system to call a function module located in…

  • Module Pool Vs ALV (ABAP List Viewer)🤯

    what is a module pool, what is the purpose of a module pool, and how it is different from alv? In SAP, Module Pool and…

  • CLASSICAL REPORT EVENT📑

    WHAT IS A CLASSICAL REPORT EVENT🫡 classical reports are basic reports that generate lists of data. They use a…

  • JOIN

    WHAT IS JOIN 🤯 In SAP ABAP, a "join" refers to the process of combining records from two or more database tables based…

  • SAP ABAP CONCEPTS🤯

    SAP ABAP internal table with header line or without header line. In SAP ABAP, internal tables can be defined with or…

  • TYPES OF INTERNAL TABLES 💊

    In SAP ABAP, internal tables are a fundamental data structure used to store and manipulate data within programs. There…

  • INTERNAL TABLE OPERATIONS🫡

    INTERNAL TABLE: Internal table operations typically refer to actions performed on tables that are managed within the…

Insights from the community

Others also viewed

Explore topics