Skip to Content
-2
Jul 14, 2020 at 03:38 PM

Abap report exit details

660 Views

Can anyone please help me with this code, i am trying here to inner join two of the table pa0000 and zempdetl.

i am getting error as this

When escaped, all host variables must be escaped using @. The variable L_DAT is not escaped in the same way as the preceding host variables.

here is my code.

REPORT zhr_exitdetails.

TABLES : pa0000,zempdetl.

TYPES : BEGIN OF ty_struc,
pernr TYPE pa0000-pernr,
begda TYPE pa0000-begda,
massn TYPE pa0000-massn,
END OF ty_struc.
DATA : itab TYPE TABLE OF ty_struc,
wa TYPE ty_struc.


TYPES : BEGIN OF ty_struc1,
department TYPE zempdetl-department,
emp_plantloc TYPE zempdetl-emp_plantloc,
gender TYPE zempdetl-gender,
END OF ty_struc1.
DATA : itab01 TYPE TABLE OF ty_struc1,
wa01 TYPE ty_struc1.

TYPES : BEGIN OF ty_final,
pernr TYPE pa0000-pernr,
begda TYPE pa0000-begda,
massn TYPE pa0000-massn,
department TYPE zempdetl-department,
emp_plantloc TYPE zempdetl-emp_plantloc,
gender TYPE zempdetl-gender,
END OF ty_final.
DATA : itab02 TYPE TABLE OF ty_final,
wa02 TYPE ty_final.

DATA:i_layout TYPE slis_layout_alv,
i_events TYPE slis_t_event,
i_fieldtab TYPE slis_t_fieldcat_alv,
s_fieldtab LIKE LINE OF i_fieldtab.

SELECTION-SCREEN BEGIN OF BLOCK btop WITH FRAME TITLE TEXT-001. "ZHR_COP_BDC
SELECT-OPTIONS: l_dat FOR pa0000-begda.
SELECTION-SCREEN END OF BLOCK btop.


START-OF-SELECTION.

PERFORM get_data.
PERFORM display.


FORM get_data.

SELECT a~pernr,a~begda,a~massn,b~department,b~emp_plantloc,b~gender FROM pa0000 AS a JOIN zempdetl AS b ON a~pernr EQ b~empid
INTO CORRESPONDING FIELDS OF TABLE @itab02 WHERE a~massn = 'ZJ' AND a~begda IN l_dat .

ENDFORM.

FORM display.
*-----------------------------------------------------------------------------
CLEAR : i_layout.
i_layout-zebra = 'X'.
i_layout-colwidth_optimize = 'X'.


s_fieldtab-col_pos = '1'.
s_fieldtab-fieldname = 'PERNR'.
s_fieldtab-seltext_m = 'EMPLOYEE NUMBER'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.

s_fieldtab-col_pos = '2'.
s_fieldtab-fieldname = 'BEGDA'.
s_fieldtab-seltext_m = 'START DATE'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.

s_fieldtab-col_pos = '3'.
s_fieldtab-fieldname = 'MASSN'.
s_fieldtab-seltext_m = 'ACTION TAKEN'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.

s_fieldtab-col_pos = '4'.
s_fieldtab-fieldname = 'DEPARTMENT'.
s_fieldtab-seltext_m = 'DEPARTMENT'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.

s_fieldtab-col_pos = '5'.
s_fieldtab-fieldname = 'EMP_PLANTLOC'.
s_fieldtab-seltext_m = 'LOCATION'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.

s_fieldtab-col_pos = '6'.
s_fieldtab-fieldname = 'GENDER'.
s_fieldtab-seltext_m = 'GENDER'.
APPEND s_fieldtab TO i_fieldtab.
CLEAR s_fieldtab.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'SY-REPID'
is_layout = i_layout
it_fieldcat = i_fieldtab[]
i_default = 'X'
TABLES
t_outtab = itab02
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.