You are on page 1of 4

(a)

types: BEGIN OF ty_c00,


customer_no(10) TYPE c,
customer_name TYPE char30,
city TYPE char30,
END OF ty_c00.

Data: it TYPE TABLE OF ty_c00,


wa TYPE ty_c00.

wa-customer_no = 'c001'.
wa-customer_name = 'john'.
wa-city = 'new york'.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c002'.
wa-customer_name = 'mike'.
wa-city = 'london'.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c003'.
wa-customer_name = 'arnold'.
wa-city = 'minnesota'.

APPEND wa to it.
CLEAR wa.

SORT it by customer_no DESCENDING.

loop at it into wa.

WRITE:/ wa.

ENDLOOP.

***********************************************************************************
**********

1(b)

ypes: BEGIN OF ty_c00,


customer_no(10) TYPE c,
customer_name TYPE char30,
amount TYPE i,
END OF ty_c00.

Data: it TYPE TABLE OF ty_c00,


it1 TYPE TABLE OF ty_c00,
wa TYPE ty_c00.

wa-customer_no = 'c001'.
wa-customer_name = 'john'.
wa-amount = 5000.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c002'.
wa-customer_name = 'mike'.
wa-amount = 2000.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c003'.
wa-customer_name = 'arnold'.
wa-amount = 2000.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c002'.
wa-customer_name = 'mike'.
wa-amount = 2000.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c001'.
wa-customer_name = 'john'.
wa-amount = 1000.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c003'.
wa-customer_name = 'arnold'.
wa-amount = 3000.

APPEND wa to it.
CLEAR wa.

loop at it INTO wa.

COLLECT wa INTO it1.


CLEAR wa.

ENDLOOP.

loop at it1 INTO wa.

WRITE:/ wa-customer_no, wa-customer_name,wa-amount.

ENDLOOP.

***********************************************************************************
*************************************************

1(c)
types: BEGIN OF ty_purchase,
pur_no(10) TYPE c,
customer_no(10) TYPE c,
quantity type i,
customer_name TYPE char30,
END OF ty_purchase.

types: BEGIN OF ty_customer,


cust_no(4) TYPE c,
cust_name TYPE char30,
city TYPE char30,
END OF ty_customer.

Data: it TYPE TABLE OF ty_purchase,


it1 TYPE TABLE OF ty_customer,
wa1 TYPE ty_customer,
wa TYPE ty_purchase.

wa-customer_no = 'c001'.
wa-quantity = 10.
wa-pur_no = '6001'.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c002'.
wa-quantity = 20.
wa-pur_no = '6002'.

APPEND wa to it.
CLEAR wa.

wa-customer_no = 'c003'.
wa-quantity = 15.
wa-pur_no = '6003'.

APPEND wa to it.
CLEAR wa.

wa1-cust_no = 'c001'.
wa1-cust_name = 'john'.
wa1-city = 'new york'.

APPEND wa1 to it1.


CLEAR wa.

wa1-cust_no = 'c002'.
wa1-cust_name = 'mike'.
wa1-city = 'london'.

APPEND wa1 to it1.


CLEAR wa.

wa1-cust_no = 'c003'.
wa1-cust_name = 'arnold'.
wa1-city = 'florida'.
APPEND wa1 to it1.
CLEAR wa.

LOOP AT it1 INTO wa1.

LOOP at it INTO wa WHERE customer_no eq wa1-cust_no.

move wa1-cust_name to wa-customer_name.

MODIFY it FROM wa TRANSPORTING customer_name.

ENDLOOP.

ENDLOOP.

LOOP at it INTO wa.

write: / wa-pur_no,wa-customer_no,wa-quantity,wa-customer_name.

ENDLOOP.

You might also like