Wednesday 31 January 2024

SAP program to inner join two custom tables

 REPORT zsm_innerjoin.


TYPES: BEGIN OF ty_str,

         id       TYPE int4,

         name     TYPE char20,                                         " Fields

         salary   TYPE int4,

*         location TYPE char20,

       END OF ty_str.                                                    " Creation of  Structure.


DATA: it TYPE STANDARD TABLE OF ty_str,     " Creation of Internal Table.

      wa TYPE ty_str.                                                    " Creation of Work Area


select  zvp_student~id

        zvp_student~name

        zvp_salary~salary

  FROM zvp_student INNER JOIN zvp_salary ON zvp_student~id = zvp_salary~id


  INTO TABLE it.                                                        " Operation for inner join.



LOOP AT it INTO wa.

  WRITE: wa-id, wa-name, wa-salary.

ENDLOOP.                                                                  " Displaying the output of the program.




          O   U   T   P   U   T     :-




                                            

No comments:

Post a Comment