Sie sind auf Seite 1von 6

SE38 ABAP Editor

type of program
Executable program can execute independently
to declare variable we will use DATA keyword
eg:
Data: l_string Type string.
l_srtring= 'my first pgm'.
Write:/l_string.

Concatenate
sy-datum = will show current server timings
yyyymmdd
Data: l_day(2) type C,
l_month(2) type C,
l_year(4) type C,
l_var type string.
l_year=sy-datum+0 (4).
l_month=sy-datum+4(2).
l_day=sy-datum+6(2).

Write:/ 'Month :', l_month.

Concatenate 'us01' l_year INTO l_var SEPERATED BY space.


Concatenate 'us01' l_year INTO l_var SEPERATED BY '-'.

IF sy-subrc EQ 0.
Write:/ 'Concatenate :', l_var.
END IF.
Session break point is applicable only for the session
External break point will be there for next 2 hrs
Structure declaration (structure local)

TYPES: BEGIN OF ty_kna1.


kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
land1 TYPE kna1-land1
name 2 TYPE kna1-name2
END of ty_kna1.

Internal Table Declaration


** Internal Table & work area
DATA: it_kna1 TYPE STANDARD TABLE OF ty_kna1.
wa_kna1 TYPE t.
Fetch Data from kna1 to internal table
SELECT
kunnr
name1
land1
name2
FROM kna1 INTO it_kna1 UP TO 10 Rows.
IF sy-subrc EQ 0.
**/ Print the value stored in Table
LOOP AT it_kna1 INTO wa_kna1
WRITE:/ 'Customer_Number : ' , wa_kna1_kunnr, '|', 'Name:', wa_kna1_name1.
ENDLOOP.
ENDIF

Internal Table Declaration


DATA: it_kna1 TYPE STANDARD TABLE OF ZKNA1_STR.
wa_kna1 TYPE ZKNA1_STR
Fetch Data from kna1 to internal table
SELECT
kunnr
name1
land1
name2
FROM kna1 INTO it_kna1 UP TO 10 Rows.
IF sy-subrc EQ 0.
**/ Print the value stored in Table
LOOP AT it_kna1 INTO wa_kna1
WRITE:/ 'Customer_Number : ' , wa_kna1_kunnr, '|', 'Name:', wa_kna1_name1.
ENDLOOP.
ENDIF

TYPES: BEGIN OF ty_knb1,


kunnr type of knb1_kunnr,
bukrs type of knb1_kunnr.
END OF TYPE ty_knb1.
DATA: it_kna1 TYPE STANDARD TABLE OF ZKNA1_STR.
wa_kna1 TYPE ZKNA1_STR

TYPES: BEGIN OF ty_final.


kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
land1 TYPE kna1-land1,
name 2 TYPE kna1-name2,
bukrs type of knb1_kunnr,
END of ty_final.

DATA: it_kna1 TYPE STANDARD TABLE OF ty_knb1.


wa_kna1 TYPE ty_knb1.

DATA: it_kna1 TYPE STANDARD TABLE OF ty_final.


wa_kna1 TYPE ty_final.

Fetch Data from kna1 to internal table


SELECT
kunnr
name1
land1
name2
FROM kna1 INTO it_kna1 UP TO 10 Rows.

IF sy-subrc EQ 0.
SELECT
kunnr
bukrs
FROM knb1 INTO it_knb1
FOR ALL ENTRIES IN it_kna1 WHERE kunnr=it_kna1-kunnr.

IF sy-subrc EQ 0.
**/ Print the value stored in Table
LOOP AT it_kna1 INTO wa_kna1
WRITE:/ 'Customer_Number : ' , wa_kna1_kunnr, '|', 'Name:', wa_kna1_name1.
ENDLOOP.
ENDIF
either field name - table name or data element name

Using Local Structre

followed by structure

Using Global Structre

Structure
Structure

Structure

Internal Table

Internal Table

We are checking table is having some data, will tell us whether the prvious statement is successful
IF not It_kna1() is INNITIAL.

Das könnte Ihnen auch gefallen