Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV list with empty data - What could have gone wrong?

Dear experts,

I'm currently working on some codes to display data (the tables involved really do contain data), but when the codes are executed, the ALV list does not contain any data in it (only the column headers are fine).

What could have gone wrong? I've been staring at the codes for hours now. Please help. Appreciate any help at all.

Displaying ALV data with REUSE_ALV_LIST_DISPLAY:

form display_alv_data .

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
*     I_INTERFACE_CHECK              = ' '
*     I_BYPASSING_BUFFER             =
*     I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = w_prog
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
*     I_STRUCTURE_NAME               =
*     IS_LAYOUT                      =
      IT_FIELDCAT                    = gt_field_cat[]
*     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
*     IR_SALV_LIST_ADAPTER           =
*     IT_EXCEPT_QINFO                =
*     I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
    TABLES
      T_OUTTAB                       = gt_final
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2.

  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

endform.                    " display_alv_data

Retrieving data from the database tables into the internal table:

form retrieve_data .

  " For internal table 1
  SELECT ekbe~ebeln
         mseg~mblnr
         ekbe~belnr
         ekbe~ebelp
         ekbe~matnr
         ekbe~menge
         ekbe~dmbtr
         ekbe~werks
         mseg~lgort
         mseg~lifnr
         lfa1~name1
  FROM ekbe INNER JOIN mseg ON ekbe~ebeln = mseg~ebeln
            INNER JOIN lfa1 ON mseg~lifnr = lfa1~lifnr
  INTO CORRESPONDING FIELDS OF TABLE gt_1
  WHERE mseg~bwart = '101' AND      " Movement type: Goods Receipt
        ekbe~vgabe = '2' AND        " Transaction / event type for Invoice Verification Number
        ekbe~matnr IN s_m_num AND
        mseg~lifnr IN s_v_num.

  " For internal table 2
  SELECT ekbe~ebeln
         makt~maktx
         eket~eindt       		
  FROM ekbe INNER JOIN makt ON ekbe~matnr = makt~matnr
            INNER JOIN eket ON ekbe~ebeln = eket~ebeln
  INTO CORRESPONDING FIELDS OF TABLE gt_2
  WHERE eket~eindt IN s_d_date.

  " For internal table 3
  SELECT ekbe~ebeln
         ekko~bedat
         ekko~ekorg
         ekko~ekgrp
         ekko~bukrs
  FROM ekbe INNER JOIN ekko ON ekbe~ebeln = ekko~ebeln
  INTO CORRESPONDING FIELDS OF TABLE gt_3
  WHERE ekko~bedat IN s_p_date AND
        ekko~ekorg IN s_p_org AND
        ekko~ekgrp IN s_p_grp.

  " For the final internal table
  SORT: gt_1, gt_2, gt_3.

  LOOP AT gt_1.

    MOVE-CORRESPONDING gt_1 TO gt_final.
    READ TABLE gt_2 WITH KEY gfs_ebeln = gt_1-gfs_ebeln BINARY SEARCH.
    MOVE-CORRESPONDING gt_2 TO gt_final.
    READ TABLE gt_3 WITH KEY gfs_ebeln = gt_1-gfs_ebeln BINARY SEARCH.
    MOVE-CORRESPONDING gt_3 TO gt_final.
    APPEND gt_final.

  ENDLOOP.

endform.                    " retrieve_data

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question