1 of 27

SAP S/4

ABAP Programming

for non-Technical Users

Process Character Strings

in a Program

2 of 27

  1. Copy Program ZABAP_007 to new Program ZABAP_008 (SE38).
  2. Activate ALL objects (SE38).
  3. Split a Parameter “String” field into 2 fields (SE38).
  4. Test run the results (SE38).

3 of 27

Copy Source Code

ZABAP_007 to

ZABAP_008

4 of 27

5 of 27

6 of 27

7 of 27

  • Copy Program ZABAP_007 to new Program ZABAP_008 (SE38).
  • Activate ALL objects (SE38).
  • Split a Parameter “String” field into 2 fields (SE38).
  • Test run the results (SE38).

8 of 27

Activate the new Program

9 of 27

REPS (Source Code)

REPT (Text Elements)

copied from the Source Program are to be activated for the NEW Target Program ZABAP_008

10 of 27

Source codes and Text Elements for the NEW Program are now Activated

11 of 27

  • Copy Program ZABAP_007 to new Program ZABAP_008 (SE38).
  • Activate ALL objects (SE38).
  • Split a Parameter “String” field into 2 fields (SE38).
  • Test run the results (SE38).

12 of 27

13 of 27

split z_name into

z_first_name & z_last_name

assuming user will always enter a first name then only the last name. (no validation in the program to check if last or first name)

14 of 27

split z_name into

z_first_name & z_last_name

assuming user will always enter a first name then only the last name. (no validation in the program to check if last or first name):

Step 1: create 2 variables to store the first and last name.

note the common and full stop

DATA: z_rldcy TYPE i,

z_tlany TYPE i,

z_first_name TYPE string,

z_last_name TYPE string.

15 of 27

split z_name into

z_first_name & z_last_name

assuming user will always enter a first name then only the last name. (no validation in the program to check if last or first name):

Step 1: create 2 variables to store the first and last name.

Step 2: use SPLIT syntax to split z_name into 2 variables z_first_name and z_last_name

AT ‘ ‘ syntax means

eg: if the name entered as

Jamie Lee Bourne

since there is space after Jamie,

Jamie = z_first name

Lee Bourne = last name

16 of 27

17 of 27

18 of 27

Before syntax and activation, let’s change the Program Title

19 of 27

Syntax check

20 of 27

Activate the Source Code

21 of 27

22 of 27

  • Copy Program ZABAP_007 to new Program ZABAP_008 (SE38).
  • Activate ALL objects (SE38).
  • Split a Parameter “String” field into 2 fields (SE38).
  • Test run the results (SE38).

23 of 27

Test RUN

24 of 27

25 of 27

26 of 27

27 of 27

Notice any characters after the “space” of the first word is considered split to z_last _name