REPORT Z_ITAB_JOINS.
TYPES: BEGIN OF ty_student_main,
id(10) TYPE C,
firstname(40) TYPE C,
lastname(40) TYPE C,
age(2) TYPE N,
* email TYPE c,
* phone TYPE c,
END OF ty_student_main.
TYPES: BEGIN OF ty_student_email,
id(10) TYPE C,
email_type(2) TYPE C,
email(60) TYPE C,
END OF ty_student_email.
TYPES: BEGIN OF ty_student_phone,
id(10) TYPE C,
phone_type(2) TYPE C,
phone(10) TYPE C,
END OF ty_student_phone.
TYPES: BEGIN OF ty_student_out,
id(10) TYPE C,
firstname(40) TYPE C,
lastname(40) TYPE C,
age(2) TYPE N,
email_type(2) TYPE C,
email(60) TYPE C,
phone_type(2) TYPE C,
phone(10) TYPE C,
END OF ty_student_out.
DATA : wa_student_main TYPE ty_student_main,
wa_student_email TYPE ty_student_email,
wa_student_phone TYPE ty_student_phone,
wa_student_out TYPE ty_student_out,
lt_student_main TYPE TABLE OF ty_student_main,
lt_student_email TYPE TABLE OF ty_student_email,
lt_student_phone TYPE TABLE OF ty_student_phone.
*** Student main
wa_student_main-id = '0001'.
wa_student_main-firstname = 'Selva'.
wa_student_main-lastname = 'Mani'.
wa_student_main-age = 18.
append wa_student_main TO lt_student_main.
clear wa_student_main.
wa_student_main-id = '0002'.
wa_student_main-firstname = 'Sadique'.
wa_student_main-lastname = 'Ali'.
wa_student_main-age = 24.
append wa_student_main to lt_student_main.
clear wa_student_main.
wa_student_main-id = '0003'.
wa_student_main-firstname = 'Shafique'.
wa_student_main-lastname = 'Ali'.
wa_student_main-age = 23.
append wa_student_main to lt_student_main.
*** student email.
wa_student_email-id = '0001'.
wa_student_email-email_type = 'P'.
wa_student_email-email = 'selvamanikandan089@gmail.com'.
append wa_student_email to lt_student_email.
clear wa_student_email.
wa_student_email-id = '0001'.
wa_student_email-email_type = 'S'.
wa_student_email-email = 'selva@gmail.com'.
append wa_student_email to lt_student_email.
clear wa_student_email.
wa_student_email-id = '0002'.
wa_student_email-email_type = 'P'.
wa_student_email-email = 'sadique@gmail.com'.
append wa_student_email to lt_student_email.
clear wa_student_email.
wa_student_email-id = '0002'.
wa_student_email-email_type = 'S'.
wa_student_email-email = 'sadique2222@gmail.com'.
append wa_student_email to lt_student_email.
clear wa_student_email.
wa_student_email-id = '0003'.
wa_student_email-email_type = 'P'.
wa_student_email-email = 'Shafique@gmail.com'.
append wa_student_email to lt_student_email.
clear wa_student_email.
wa_student_email-id = '0003'.
wa_student_email-email_type = 'S'.
wa_student_email-email = 'sadique333333@gmail.com'.
append wa_student_email to lt_student_email.
*** student phone.
wa_student_phone-id = '0001'.
wa_student_phone-phone_type = 'P'.
wa_student_phone-phone = '678523445'.
append wa_student_phone to lt_student_phone.
clear wa_student_phone.
wa_student_phone-id = '0002'.
wa_student_phone-phone_type = 'P'.
wa_student_phone-phone = '888523445'.
append wa_student_phone to lt_student_phone.
clear wa_student_phone.
wa_student_phone-id = '0003'.
wa_student_phone-phone_type = 'P'.
wa_student_phone-phone = '777523445'.
append wa_student_phone to lt_student_phone.
BREAK-POINT.
clear : wa_student_main, wa_student_email, wa_student_phone.
READ TABLE lt_student_main INTO wa_student_main WITH KEY id = '0001'.
IF sy-subrc EQ 0.
wa_student_out-id = wa_student_main-id.
wa_student_out-firstname = wa_student_main-firstname.
wa_student_out-lastname = wa_student_main-lastname.
wa_student_out-age = wa_student_main-age.
READ TABLE lt_student_email INTO wa_student_email WITH KEY id = '0001'.
IF sy-subrc EQ 0.
wa_student_out-email_type = wa_student_email-email_type.
wa_student_out-email = wa_student_email-email.
ENDIF.
READ TABLE lt_student_phone INTO wa_student_phone WITH KEY id = '0001'.
IF sy-subrc EQ 0.
wa_student_out-phone_type = wa_student_phone-phone_type.
wa_student_out-phone = wa_student_phone-phone.
ENDIF.
ENDIF.
break-POINT.
write : /
wa_student_out-id,
wa_student_out-firstname,
wa_student_out-lastname,
wa_student_out-email,
wa_student_out-email_type,
wa_student_out-phone,
wa_student_out-phone_type.
ULINE.
Output :
