ptreq_attabsdata - ptreq_header - ptreq_items join is not getting data

976 views Asked by At

I'm trying to join three tables and call the report with personal number or begin/end date. However gt_outtab is filling with nothing. Can someone help me to make the join work ? I'm sharing whole code below. Thanks.

REPORT  zd_ptreq_hdrtoattab.

INCLUDE zinc_alv_templ.
TABLES : ptreq_attabsdata,ptreq_header,ptreq_items,icon.

DATA : BEGIN OF gt_outtab OCCURS 0,
         exception TYPE lvc_exled,
         pernr     LIKE p0001-pernr,
         begda     LIKE ptreq_attabsdata-begda,
         endda     LIKE ptreq_attabsdata-endda,
         subty     LIKE ptreq_attabsdata-subty,
         status    LIKE ptreq_header-status,
         mod_user  LIKE ptreq_header-mod_user,
       END OF gt_outtab .

DATA:
  gd_repid   TYPE syrepid,
  gd_okcode  TYPE ui_func,
  gt_fcat    TYPE lvc_t_fcat,
  gs_layout  TYPE lvc_s_layo,
  gs_variant TYPE disvariant,
  go_docking TYPE REF TO cl_gui_docking_container,
  go_grid    TYPE REF TO cl_gui_alv_grid.

DATA extab TYPE slis_t_extab.

DATA:
  pernr1  TYPE pa0001-pernr,
  lea_ty1 TYPE pa0001-subty,
  begda1  TYPE pa0001-begda,
  endda1  TYPE pa0001-endda.

SELECTION-SCREEN BEGIN OF BLOCK 01 WITH FRAME.
SELECT-OPTIONS pernr FOR pernr1.

SELECT-OPTIONS lea_ty FOR lea_ty1.
SELECT-OPTIONS begda FOR begda1.
SELECT-OPTIONS endda FOR endda1.

SELECTION-SCREEN END OF BLOCK 01.
*REQ_ID = '52A08D487A9B5807E10000000A170133'.
SELECTION-SCREEN BEGIN OF BLOCK 02 WITH FRAME.
PARAMETERS : p_vari LIKE disvariant-variant
             DEFAULT '/DEFAULT'.
SELECTION-SCREEN END   OF BLOCK 02.

INITIALIZATION.
  PERFORM zinc_alv_initialization.

START-OF-SELECTION.
  IF p_vari IS INITIAL.
    PERFORM zinc_alv_vari_def USING p_vari.
  ENDIF.

SELECT a~request_id a~status a~mod_user
      c~pernr c~subty c~begda c~endda
INTO CORRESPONDING FIELDS OF TABLE gt_outtab
FROM
ptreq_header AS a
 INNER JOIN
ptreq_items AS b ON a~item_list_id = b~item_list_id
 INNER JOIN
ptreq_attabsdata AS c ON b~item_ins = c~item_id
WHERE c~pernr IN pernr AND
           c~begda IN begda AND
           c~endda IN endda.
  append gt_outtab.
END-OF-SELECTION.
PERFORM display_alv.

FORM display_alv.

  DATA : lt_fieldcat    TYPE slis_t_fieldcat_alv,
         w_fieldcat_alv TYPE slis_fieldcat_alv,
         lw_layout      TYPE slis_layout_alv,
         lw_events      TYPE slis_t_event,
         lw_eventexit   TYPE slis_t_event_exit.

  PERFORM zinc_alv_catalog USING 'GT_OUTTAB'
                          CHANGING lt_fieldcat.
DATA : l_modified TYPE xflag.
LOOP AT lt_fieldcat INTO w_fieldcat_alv.
  CLEAR l_modified.
  CASE w_fieldcat_alv-fieldname.
    WHEN 'PERNR'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Personel Numarası'.
    WHEN 'BEGDA'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Geçerlilik Başlangıcı'.
    WHEN 'ENDDA'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Geçerlilik Sonu'.
    WHEN 'SUBTY'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Alt Tip'.
    WHEN 'STATUS'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Durum'.
    WHEN 'MOD_USER'.
      l_modified = 'X'.
      w_fieldcat_alv-reptext_ddic = 'Son Değiştiren'.
  ENDCASE.
  IF l_modified NE space.
    w_fieldcat_alv-seltext_l = w_fieldcat_alv-reptext_ddic.
    w_fieldcat_alv-seltext_m = w_fieldcat_alv-reptext_ddic.
    w_fieldcat_alv-seltext_s = w_fieldcat_alv-reptext_ddic.
  ENDIF.
  w_fieldcat_alv-key = space.
  MODIFY lt_fieldcat FROM w_fieldcat_alv.
ENDLOOP.
 PERFORM zinc_alv_grid_display TABLES gt_outtab
                             USING lt_fieldcat
                                   p_vari
                                   'STANDARD'
                                   'USER_COMMAND'
                                   lw_layout
                                   lw_events
                                   lw_eventexit.
ENDFORM.
FORM standard USING  extab TYPE slis_t_extab.
  SET PF-STATUS 'STANDARD' EXCLUDING extab.
ENDFORM.                    "standard
0

There are 0 answers