Академический Документы
Профессиональный Документы
Культура Документы
02-Sep-09
Kaavian Systems
Manipulating Character
Data
String
manipulation
is
the
process
of
02-Sep-09
Concatenate
Split
Shift
Condense
Translate
Convert Text
Overlay
Replace
Search
Kaavian Systems
Concatenate
Combines two or more separate strings into one.
name(8)
VALUE MATERIAL,
ext(4)
file_name(50).
VALUE .txt,
sy-datum _
INTO file_name.
Kaavian Systems
Split
Split a character string into two or more smaller
strings.
Example
DATA: file_name(30) TYPE C VALUE
tmp/MATERIAL.txt,
directory(10)TYPE C,
name(12)
TYPE C,
separator(1)
VALUE /.
Shift
02-Sep-09
Shift
Example
DATA v_cost(10) TYPE c VALUE 345.98-.
SHIFT v_cost BY 1 PLACES RIGHT CIRCULAR.
Now v_cost = - 345.98
CONDENSE v_cost NO-GAPS.
Now v_cost = -345.98
SHIFT v_cost RIGHT TRAILING space.
Now v_cost has value
02-Sep-09
-345.98.
Kaavian Systems
Condense
Deletes redundant spaces from a string.
one
blank.
Result
is
left-justified
02-Sep-09
Kaavian Systems
Translate
02-Sep-09
Kaavian Systems
Translate
Example
DATA: letters(20) TYPE C VALUE
'abcabcabcXabc',
change(15)TYPE C VALUE 'aXbaYBabZacZB'.
02-Sep-09
Kaavian Systems
Convert Text
Converts strings into a format that can be sorted
alphabetically.
02-Sep-09
Kaavian Systems
10
Overlay
Overlays one string with another
02-Sep-09
Kaavian Systems
11
Overlay
Example
DATA : fname(50) VALUE
/tmp/mat&.txt.
REPLACE & WITH sy-datum INTO
fname.
02-Sep-09
Kaavian Systems
12
Replace
Replace a string in a field with a different string
02-Sep-09
Kaavian Systems
13
Search
Search a character field for a particular pattern.
string
02-Sep-09
Kaavian Systems
14
Offset
For
character-type
fields
and
fields
of
type
02-Sep-09
Kaavian Systems
15
Conditional Operators
CASE Statement
Syntax
02-Sep-09
CASE <f>.
WHEN <f11> [OR <f 12> OR ...].
<Statement block>
16
Conditional Operators
Syntax
02-Sep-09
IF <condition1>.
<statement block>
ELSEIF <condition2>
<statement block>.
ELSEIF <condition3>.
<statement block>
.....
ELSE.
<statement block>
ENDIF.
Kaavian Systems
17
Comparison Operators
IS INITIAL
IS BETWEEN
NOT
02-Sep-09
Kaavian Systems
18
Looping Commands
Unconditional Loops
Syntax
DO [<n> TIMES] [VARYING <f> FROM <f1>
NEXT <f 2>].
<Statement block>
ENDDO.
Conditional Loops
Syntax
WHILE <condition> [VARY <f> FROM <f1>
NEXT <f 2>].
02-Sep-09
Kaavian Systems
<statement block>
19
Scenario 1
Get two numbers from the user and COMPUTE
ADD
SUBTRACT
MULTIPLY
DIVIDE
02-Sep-09
Kaavian Systems
20
Scenario 2
Write
My first ABAP
program
program My first
ABAP
MY
02-Sep-09
PROGRAM
MY-FIRST-ABAP-
Kaavian Systems
21
Scenario 3
Scenario 4
02-Sep-09
Kaavian Systems
23
Reference
The learning material contained in this PowerPoint
Presentation is prepared with the help of http://help.sap.com/
and sap press book. All rights reserved by SAP AG.
Unless otherwise specifically stated, this learning material is
intended for the sole purpose of class room session, internal
use and for knowledge transfer to the Consultants.
However, for detailed information on this learning material,
http://help.sap.com / sap press book may be referred.
Kaavian is not liable for any legal liability or responsibility for
the accuracy, completeness or usefulness of any information
disclosed in these learning materials.
No portion of the learning materials
shall be modified,
reproduced or transmitted in any form by any means, whether
by electronic, photocopier or otherwise without the written
permission of Kaavian. In no event shall Kaavian be liable for
any damage whatsoever resulting in any action arising in
02-Sep-09
24
Kaavian Systems
connection with the use of learning
material.