0% found this document useful (0 votes)
4 views3 pages

Report from Multiple Tables_M

The document is an ABAP report that retrieves employee data from the PA0000 and PA0001 tables based on selected personnel numbers. It combines the data into a final structure and prepares it for display using an ALV grid. The report includes field catalog definitions for the displayed columns, such as Employee Number, Action, Reason, Position, Org Unit, and Employee Name.

Uploaded by

tlninfo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Report from Multiple Tables_M

The document is an ABAP report that retrieves employee data from the PA0000 and PA0001 tables based on selected personnel numbers. It combines the data into a final structure and prepares it for display using an ALV grid. The report includes field catalog definitions for the displayed columns, such as Employee Number, Action, Reason, Position, Org Unit, and Employee Name.

Uploaded by

tlninfo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

REPORT ZTRK_MUL_TAB_REPORT_M.

tables : pa0001.
types : begin of lty_data_0,
PERNR type PERSNO,
MASSN type PA0000-MASSN,
MASSG type PA0000-MASSG,
End of lty_data_0.

types : begin of lty_data_1,


PERNR type PERSNO,
PLANS type PA0001-PLANS,
ORGEH type PA0001-ORGEH,
ENAME type PA0001-ENAME,
End of lty_data_1.

types : begin of lty_data_final,


PERNR type PERSNO,
MASSN type PA0000-MASSN,
MASSG type PA0000-MASSG,
PLANS type PA0001-PLANS,
ORGEH type PA0001-ORGEH,
ENAME type PA0001-ENAME,
End of lty_data_final.

data : lt_data_0 type table of lty_data_0.


data : lwa_data_0 type lty_data_0.
data : lt_data_1 type table of lty_data_1.
data : lwa_data_1 type lty_data_1.
data : lt_data_final type table of lty_data_final.
data : lwa_data_final type lty_data_final.
data : lt_fieldcat type SLIS_T_FIELDCAT_ALV.
data : ls_fieldcat type slis_fieldcat_alv.

data : pers type persno.

select-options : s_pa for pers.

select PERNR MASSN MASSG


FROM PA0000
into table lt_data_0
where PERNR in s_pa.

if lt_data_0 is not initial.


select PERNR PLANS ORGEH ENAME
FROM PA0001
into table lt_data_1
for all entries in lt_data_0
where PERNR = lt_data_0-pernr.

endif.

loop at lt_data_0 into lwa_data_0.


loop at lt_data_1 into lwa_data_1 where PERNR = lwa_data_0-pernr.
lwa_data_final-pernr = lwa_data_0-pernr.
lwa_data_final-massn = lwa_data_0-massn.
lwa_data_final-massg = lwa_data_0-massg.
lwa_data_final-plans = lwa_data_1-plans.
lwa_data_final-orgeh = lwa_data_1-orgeh.
lwa_data_final-ename = lwa_data_1-ename.
append lwa_data_final to lt_data_final.
clear lwa_data_final.
endloop.
endloop.

ls_fieldcat-COL_POS = '1'.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-tabname = 'lt_data_final'.
ls_fieldcat-seltext_l = 'Employee Number'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.

*ls_fieldcat-COL_POS = '2'.
*ls_fieldcat-fieldname = 'MASSN'.
*ls_fieldcat-tabname = 'lt_data_final'.
*ls_fieldcat-seltext_l = 'Action'.
*append ls_fieldcat to lt_fieldcat.
*clear ls_fieldcat.

*ls_fieldcat-COL_POS = '3'.
*ls_fieldcat-fieldname = 'MASSG'.
*ls_fieldcat-tabname = 'lt_data_final'.
*ls_fieldcat-seltext_l = 'Reason'.
*append ls_fieldcat to lt_fieldcat.
*clear ls_fieldcat.

ls_fieldcat-COL_POS = '4'.
ls_fieldcat-fieldname = 'PLANS'.
ls_fieldcat-tabname = 'lt_data_final'.
ls_fieldcat-seltext_l = 'Position'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.

ls_fieldcat-COL_POS = '5'.
ls_fieldcat-fieldname = 'ORGEH'.
ls_fieldcat-tabname = 'lt_data_final'.
ls_fieldcat-seltext_l = 'Org Unit'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.

ls_fieldcat-COL_POS = '2'.
ls_fieldcat-fieldname = 'ENAME'.
ls_fieldcat-tabname = 'lt_data_final'.
ls_fieldcat-seltext_l = 'Emp Name'.
append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = lt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = lt_data_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy