Skip to Content

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

IT_FIELDCATALOG IS NOT GETTING FILLED

HI friends

I have returned a program for workflow tracking. Am getting the output has led light alone no data's are displayed. I found that my IT_FIELDCATALOG = GT_FCAT is not getting filled. How to fill that. Am pasting my programming here. Kinldy help me out.


TYPE-POOLS: ABAP.
TABLES : PTREQ_ATTABSDATA,PTREQ_HEADER,PTREQ_ITEMS.

TYPES: BEGIN OF TY_S_OUTTAB,
        EXCEPTION   TYPE LVC_EXLED,
        PERNR TYPE P0001-PERNR,
        BEGDA TYPE PTREQ_ATTABSDATA-BEGDA,
        ENDDA TYPE PTREQ_ATTABSDATA-ENDDA,
        SUBTY TYPE SUBTY,
        STATUS TYPE PTREQ_HEADER-STATUS,
        END OF TY_S_OUTTAB.
TYPES: TY_T_OUTTAB TYPE STANDARD TABLE OF TY_S_OUTTAB
                   WITH DEFAULT KEY.
DATA : REQUEST_ID TYPE PTREQ_HEADER-REQUEST_ID.
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: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: GT_OUTTAB        TYPE TY_T_OUTTAB.

PARAMETERS:
 PERNR         TYPE PA0001-PERNR,
 REQ_ID        TYPE PTREQ_HEADER-REQUEST_ID,
 LEA_TY        TYPE PA0001-SUBTY,
 BEGDA         TYPE PA0001-BEGDA,
 ENDDA         TYPE PA0001-ENDDA.

REQ_ID = '52A08D487A9B5807E10000000A170133'.

START-OF-SELECTION.
  BREAK-POINT.
*  SELECT * FROM  PTREQ_ATTABSDATA INTO CORRESPONDING FIELDS OF TABLE gt_outtab
*         WHERE  PERNR  = PERNR AND SUBTY = LEA_TY.
  SELECT C~PERNR C~BEGDA C~ENDDA C~SUBTY A~STATUS 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 REQUEST_ID = REQ_ID AND REQUEST_TYPE = 'ABSREQ'
    AND VERSION_NO = ( SELECT MAX( VERSION_NO ) FROM PTREQ_HEADER
    WHERE  REQUEST_ID = REQ_ID ) AND
    ITEM_LIST_NO = ( SELECT MAX( ITEM_LIST_NO )
    FROM PTREQ_ITEMS WHERE ITEM_LIST_ID = A~ITEM_LIST_ID ) .

  PERFORM INIT_CONTROLS.
  PERFORM CHECK_CONDITION.

* Display data
  CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IS_LAYOUT       = GS_LAYOUT
      IS_VARIANT      = GS_VARIANT
      I_SAVE          = 'A'
    CHANGING
      IT_OUTTAB       = GT_OUTTAB
      IT_FIELDCATALOG = GT_FCAT
    EXCEPTIONS
      OTHERS          = 4.
  IF SY-SUBRC = 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*    MESSAGE ID mid TYPE mtype NUMBER num.
  ENDIF.
  CALL SCREEN '0100'.

END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.

**      CALL METHOD go_grid1->refresh_table_display
***        EXPORTING
***          IS_STABLE      =
***          I_SOFT_REFRESH =
**        EXCEPTIONS
**          FINISHED       = 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.
*OK-CODE->GD_OKCODE.
ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

  CASE GD_OKCODE.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0.
      LEAVE SCREEN.
    WHEN OTHERS.
      CALL METHOD GO_GRID->REFRESH_TABLE_DISPLAY
        EXCEPTIONS
          FINISHED = 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.
  ENDCASE.
  CLEAR: GD_OKCODE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&---------------------------------------------------------------------*
*&      Form  INIT_CONTROLS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM INIT_CONTROLS .


* Create ALV grid
  CREATE OBJECT GO_GRID
    EXPORTING
      I_PARENT = GO_DOCKING
    EXCEPTIONS
      OTHERS   = 5.
  IF SY-SUBRC = 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  PERFORM BUILD_FIELDCATALOG.
  PERFORM SET_LAYOUT_AND_VARIANT.

ENDFORM.                    " INIT_CONTROLS


*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG.
*fieldcatalog-fieldname  = 'EXPECTION'.
*  fieldcatalog-seltext_m  = 'LIGHT'.
*  fieldcatalog-col_pos    = 1.
*  fieldcatalog-outputlen  = 3.
**  fieldcatalog-emphasize  = 'X'.
*  APPEND fieldcatalog TO fieldcatalog.
*  CLEAR  fieldcatalog.

  FIELDCATALOG-FIELDNAME  = 'PERNR'.
  FIELDCATALOG-SELTEXT_M  = 'EMPLOYEE NO'.
  FIELDCATALOG-COL_POS    = 1.
  FIELDCATALOG-OUTPUTLEN  = 8.
  FIELDCATALOG-EMPHASIZE  = 'X'.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

  FIELDCATALOG-FIELDNAME  = 'REQ_ID'.
  FIELDCATALOG-SELTEXT_M  = 'REQUEST_ID'.
  FIELDCATALOG-COL_POS    = 2.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

  FIELDCATALOG-FIELDNAME  = 'LEA_TY'.
  FIELDCATALOG-SELTEXT_M  = 'LEAVE_TYPE'.
  FIELDCATALOG-COL_POS    = 3.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.


  FIELDCATALOG-FIELDNAME  = 'BEGDA'.
  FIELDCATALOG-SELTEXT_M  = 'BEGIN_DATE'.
  FIELDCATALOG-COL_POS    = 4.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.


  FIELDCATALOG-FIELDNAME  = 'ENDDA'.
  FIELDCATALOG-SELTEXT_M  = 'END_DATE'.
  FIELDCATALOG-COL_POS    = 5.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

  FIELDCATALOG-FIELDNAME  = 'STATUS'.
  FIELDCATALOG-SELTEXT_M  = 'STATUS'.
  FIELDCATALOG-COL_POS    = 6.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

*
* define local data
  DATA:
    LS_FCAT        TYPE LVC_S_FCAT.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
*    EXPORTING
*     I_BUFFER_ACTIVE              =
*      I_STRUCTURE_NAME             = 'TY_S_OUTTAB'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      CT_FIELDCAT                  = GT_FCAT
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3.
  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.                    " BUILD_FIELDCATALOG_KNB1


*&---------------------------------------------------------------------*
*&      Form  SET_LAYOUT_AND_VARIANT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SET_LAYOUT_AND_VARIANT .

  CLEAR: GS_LAYOUT,
         GS_VARIANT.

*  GS_LAYOUT-CWIDTH_OPT = ABAP_TRUE.
  GS_LAYOUT-ZEBRA      = ABAP_TRUE.
  GS_LAYOUT-EXCP_FNAME = 'EXCEPTION'.  " define column for LED
  GS_LAYOUT-EXCP_LED   = ABAP_TRUE.

  GS_VARIANT-REPORT = SYST-REPID.
  GS_VARIANT-HANDLE = 'GRID'.

ENDFORM.                    " SET_LAYOUT_AND_VARIANT


*&---------------------------------------------------------------------*
*&      Form  CHECK_CONDITION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM CHECK_CONDITION .
* define local data
  DATA: LS_OUTTAB   TYPE TY_S_OUTTAB.

  LOOP AT GT_OUTTAB INTO LS_OUTTAB.
    IF ( LS_OUTTAB-STATUS = 'APPROVED' ).
      LS_OUTTAB-EXCEPTION = '3'.  " GREEN LED/traffic light
    ELSE.
      LS_OUTTAB-EXCEPTION = '1'.  " RED LED / traffic light
    ENDIF.

    MODIFY GT_OUTTAB FROM LS_OUTTAB INDEX SYST-TABIX.
  ENDLOOP.

ENDFORM.                    " CHECK_CONDITION

Here in the function module 'LVC_FIELDCATALOG_MERGE'

GT_FACT is not getting filled. How to do that.

Regards

vijay

Former Member replied

some thing you are missing, but any you can also do this..

change the definiton of the fieldcatalog.

DATA: FIELDCATALOG TYPE lvc_t_fcat WITH HEADER LINE.

population change

FIELDCATALOG-FIELDNAME  = 'PERNR'.
  FIELDCATALOG-COLTEXT  = 'EMPLOYEE NO'.
  FIELDCATALOG-COL_POS    = 1.
  FIELDCATALOG-OUTPUTLEN  = 8.
  FIELDCATALOG-EMPHASIZE  = 'X'.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
 
  FIELDCATALOG-FIELDNAME  = 'REQ_ID'.
  FIELDCATALOG-COLTEXT  = 'REQUEST_ID'.
  FIELDCATALOG-COL_POS    = 2.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
 
  FIELDCATALOG-FIELDNAME  = 'LEA_TY'.
  FIELDCATALOG-COLTEXT  = 'LEAVE_TYPE'.
  FIELDCATALOG-COL_POS    = 3.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
 
 
  FIELDCATALOG-FIELDNAME  = 'BEGDA'.
  FIELDCATALOG-COLTEXT  = 'BEGIN_DATE'.
  FIELDCATALOG-COL_POS    = 4.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
 
 
  FIELDCATALOG-FIELDNAME  = 'ENDDA'.
  FIELDCATALOG-COLTEXT  = 'END_DATE'.
  FIELDCATALOG-COL_POS    = 5.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
 
  FIELDCATALOG-FIELDNAME  = 'STATUS'.
  FIELDCATALOG-COLTEXT = 'STATUS'.
  FIELDCATALOG-COL_POS    = 6.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

method call display change..

* Display data
  CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IS_LAYOUT       = GS_LAYOUT
      IS_VARIANT      = GS_VARIANT
      I_SAVE          = 'A'
    CHANGING
      IT_OUTTAB       = GT_OUTTAB
      IT_FIELDCATALOG = FIELDCATALOG[]
    EXCEPTIONS
      OTHERS          = 4.
  IF SY-SUBRC EQ  0.
  ENDIF.

apply all the changes and see...

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question