sap programming syntax for keyword search

sap programming is done with a language called ABAP and it has some important keywords and search is one among them.Its usage is given as shown below.

SEARCH f FOR g.

Additions

1. ... ABBREVIATED
2. ... STARTING AT n1
3. ... ENDING AT n2
4. ... AND MARK

Effect

Searches the field f for the string in the field g . This string can have any of the following formats:

'str' a character string (trailing blanks are ignored) '.str.' any character string between the periods '*str' a word ending with "str", including the word "str" 'str*' a word beginning with "str", including the word "str"

You can use the following characters as delimiters:

' ', ',', ';', ':', '.', '!', '?', '(', ')', '+', '/' and '='.

The return code value is set as follows:

SY-SUBRC = 0 The search string g was found in the field f .
SY-FDPOS contains the offset of the found string or the found word within the field.
SY_SUBRC = 4 The search string g was not found in the field f .

Addition 1

... ABBREVIATED

Effect

Searches the field f for a word containing the character string specified in the field. Here, the characters specified in g may be separated by other characters in a word. If the string g occurs in a word, the return code in system field SY-SUBRC is set to 0. The first letter of the search string g and the word must match.

Example

DATA F(50).
MOVE 'Alaska Texas California' TO F.
SEARCH F FOR 'Clfrn' ABBREVIATED.

Here, SY-SUBRC is set to 0, since not only does the string 'Clfrn' occur (separated by other characters) in 'California' , but 'Clfrn' and 'California' begin with the same letter.

Addition 2

... STARTING AT n1

Effect

Searches the field f starting from the position n1 . Here, a field can be anything containing the corresponding value. The first character in the field f is in position 1.

When you use the addition STARTING AT , the position specified for the found pattern in SY-FDPOS does not refer to the start of the field, but to the position n1 .

Addition 3

... ENDING AT n2

Effect

Searches the field f up to the position n2 .

Addition 4

... AND MARK

Effect

If the search string g is found, all the characters of the search string and all the characters occurring in between (in the case of SEARCH ABBREVIATED ) are converted to upper case in the field f .

Example

DATA F(20) VALUE 'Peter Paul Mary'.
SEARCH F FOR '*UL' AND MARK.

SY-SUBRC is now set to 0, since the search string was found in 'Paul' . SY-FDPOS has the value 6, since the character string found starts at the offset 6. Also, the search string is marked, so that the new contents of f are as follows:

'Peter PAUL Mary'

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report
SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report
My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.com
SAP FICO cross company code reconciliation report
sap sales and distribution back orders report in abap

No comments:

Post a Comment