Processing Character Fields Flashcards

1
Q

What types of text in ABAP development objects may need to be translated for different end users?

A

Texts in ABAP development objects that may need to be translated for different end users include:

  1. Labels and headers from annotations in data definitions and metadata extensions.
  2. Labels from data elements.
  3. Messages from message classes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you determine the original language of a development object in ABAP Development Tools?

A

you can find the original language of a development object on the Properties Tab below the editor view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Are language-dependent texts in the ABAP source code translatable?

A

No, literals in the ABAP source code are not translatable by default. The content of literals remains the same, regardless of the logon language of the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are text symbols and how are they stored?

A

Text symbols, also known as text elements, are stored in the text pool of global ABAP classes.
Each text symbol is identified by a unique three-character ID, which can consist of digits, letters, or a combination of both.
Text symbols are not case-sensitive and are stored in upper case in the text pool editor.

!!!
Do not confuse text IDs with message IDs. For messages in message classes only digits are allowed.
!!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you access text symbols in ABAP?

A

There are two ways to access text symbols in ABAP:

Standalone: Using the text- syntax followed by the text ID.

Attached to a text literal: Placing the text ID inside a pair of brackets immediately after a text literal. If the text symbol exists in the loaded text pool, its content is used; otherwise, the literal is used as a fallback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the significance of the maximum length defined for text symbols?

A

The maximum length of a text symbol defines a hard limit for the translator. It should be significantly higher than the actual length to avoid the need for cryptic abbreviations in translated text elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are description functions?

A

These functions analyze the content of character-like input values and return a numeric value, typically of type integer. For example, the numofchar() function counts the number of characters in the input, ignoring trailing blanks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are processing functions?

A

These functions use the content of a character-like input value to derive a character-like result, usually of type string. For example, the replace() function scans the input value for a given substring and replaces it with another given substring if found.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are predicate functions?

A

These functions analyze the content of a character-like input value and return a truth value. Predicate functions do not return a specific value because ABAP does not have a boolean type. They are used like logical expressions, such as in IF structures or WHERE-clauses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the name of the main input parameter for built-in string functions when the input consists of several parameters?

A

In that case, the name of the main input parameter is always val.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the most important parameters used in built-in string functions?

A

VAL: Used to pass the text string to be processed.

SUB: Used to pass a character string to be searched for or inserted.

CASE: Determines whether searches and comparisons are case-sensitive.

OCC: Specifies the occurrence of a match in searches.

OFF: Specifies the offset for processing a substring.

LEN: Specifies the length of the substring to be processed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Give an example for Description Functions

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the differences between the length functions NUMOFCHAR() and STRLEN()?

A

While both NUMOFCHAR() and STRLEN() return the length of a string, STRLEN() includes trailing blanks in the result for strings with one or more blanks at the end, whereas NUMOFCHAR() ignores them. However, for arguments with fixed length, such as those of type C or N, both functions ignore trailing blanks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe the two groups of search functions for strings.

A

COUNT() and COUNT_…(): These functions return the total number of occurrences of a search argument.

FIND() and FIND_…(): These functions return the position (offset) of one particular occurrence of a search argument.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Give an example for Processing Functions

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Give an example for Predicate Functions

A
17
Q

Explain the purpose of the predicate function CONTAINS().

A

CONTAINS() evaluates to true if a specified substring appears at least once in the input string. In other words, if CONTAINS() returns true, the function FIND() will return a result larger than 0, indicating the position of the substring.

18
Q

What is the relationship between the predicate functions CONTAINS_ANY_OF() and CONTAINS_ANY_NOT_OF(), and their corresponding description functions FIND_ANY_OF() and FIND_ANY_NOT_OF()?

A

The predicate functions CONTAINS_ANY_OF() and CONTAINS_ANY_NOT_OF() evaluate the input string based on a list of characters, determining if any character from the list is present or absent in the string. The corresponding description functions FIND_ANY_OF() and FIND_ANY_NOT_OF() return the position of the first occurrence of any character from the list or the first character not present in the list, respectively.

19
Q

What is the purpose of the predicate function MATCHES()?

A

The predicate function MATCHES() is used to compare the entire input string to a regular expression pattern. It evaluates to true if the input string matches the specified regular expression pattern.

20
Q

What is a regular expression, and why is it used?

A

A regular expression (Regex) is a pattern of literal and special characters that describes a set of character strings. Regular expressions are commonly used in text searches, search-and-replace operations, or to validate the content of character-like fields. They offer more powerful search capabilities compared to simple character string searches because they can represent a larger set of character strings concurrently.

21
Q

What is the purpose of using square brackets ([ ]) in regular expressions?

A

Square brackets are used to specify a set of characters that are allowed at a specific position in the regular expression pattern. For example, [BS] specifies a character set that includes either the letter B or the letter S.

22
Q

How can you exclude certain characters from a character set in a regular expression?

A

To exclude certain characters from a character set in a regular expression, you can use the caret (^) sign immediately after the opening bracket. For example, [^LX] excludes the characters L and X but allows all other characters.

23
Q

What is the purpose of quantifiers in regular expressions?

A

Quantifiers, denoted by curly brackets ({ }), specify how often the element on their left should be repeated. They provide flexibility in defining the repetition of characters or groups of characters in a regular expression pattern. For example, {3} specifies exactly three repetitions, {1,2} specifies one or two repetitions, and {1,} specifies at least one repetition.

24
Q

How is the union operator (|) used in regular expressions?

A

The union operator (|) combines two patterns and combines the result set of the two patterns. It is used to provide multiple alternatives for a specific part of a regular expression pattern. For example, (AB|S) allows either the literal AB or the single letter S in the specified position.

25
Q

What is the purpose of the parameter pcre in built-in string functions?

A

The pcre parameter, short for Perl Compatible Regular Expression, is used in many built-in string functions as an alternative to the sub parameter. When supplied, pcre interprets the input as a regular expression pattern and searches for substrings that match this pattern. It allows for more complex and flexible search patterns compared to simple substring searches.

26
Q

Can you provide examples of built-in string functions that use the pcre parameter?

A

Functions like FIND(), COUNT(), CONTAINS(), REPLACE(), SUBSTRING_FROM(), and SUBSTRING_AFTER() utilize the pcre parameter for regular expression-based searches or operations. These functions allow for powerful text processing capabilities by enabling the use of regular expressions.

27
Q

What is the difference between the MATCHES() and MATCH() functions?

A

The MATCHES() function is a predicate function that returns true if the complete character string matches the specified regular expression pattern.

On the other hand, the MATCH() function is similar to the FIND() function but operates with regular expressions. It searches for substrings within a character string that match the regular expression pattern and returns the found substring instead of the offset.

28
Q

When a function has both sub and pcre parameters, can you use both of them simultaneously?

A

No, when a function has both sub and pcre parameters, you can only supply one of them. You have to choose between specifying a literal substring or a regular expression pattern for the search operation.

29
Q

What built-in functions with PCRE exist?

A

FIND( )
COUNT( )
CONTAINS( )
REPLACE( )
SUBSTRING_*( )
MATCHES( )
MATCH( )

30
Q

Give an example for a Regex

A
31
Q

Which of the following method calls in a RAP validation create messages which are translatable?

A
DATA(msg) = me->new_message_with_text( severity = ms-error text = |Airport does not exist| ).

B
DATA(msg) = me->new_message_with_text( severity = ms-error text = ‘Airport does not exist ‘ ).

C
DATA(msg) = me->new_message_with_text( severity = ms-error text = |{ ‘Airport does not exist’(ane) } | ).

D
DATA(msg) = me->new_message_with_text( severity = ms-error text = ‘Airport does not exist’(ane) ).

A

C
DATA(msg) = me->new_message_with_text( severity = ms-error text = |{ ‘Airport does not exist’(ane) } | ).

D
DATA(msg) = me->new_message_with_text( severity = ms-error text = ‘Airport does not exist’(ane) ).

That is correct. Only those method calls that reference a text symbol by using (ane) after the text literal create a translatable message.

32
Q

Which of the following are subject to translation in ABAP?

A
The value of a text literal in the source code of an ABAP class

B
The value of a text symbol in an ABAP class

C
The short text of a message text in a message class

D
The value of annotation @enduserText.Label in a data definition

A

B
The value of a text symbol in an ABAP class

C
The short text of a message text in a message class

D
The value of annotation @enduserText.Label in a data definition

Correct. Text-like annotations, messages, and text symbols are subject to translation. But literals in the ABAP source code are not.

33
Q

True or False? ABAP only supports Perl Compatible Regular Expression (PCRE).

A

False.

ABAP also supports other standards and syntax flavors, but PCRE should be your first choice.

34
Q

An ABAP built-in function xyz( ) is called in the following way: IF xyz( …. ) . … ENDIF. What does this tell you about the nature of the function?

A
xyz( ) is a processing function.

B
xyz( ) is a description function.

C
xyz( ) is a predicate function.

A

C
xyz( ) is a predicate function.

That is correct. Only predicate functions can be used like logical expressions.

35
Q

There is a simple translation tool that is integrated into ADT.

A

False.

ABAP translation is always done outside of ADT. There is no translation tool integrated into ADT.

36
Q
A