Skip to Content

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

ERROR IN PROGRAM

hi

I am new to ABAP..I am facing problem with this code...please let me know whats the error in this...

REPORT  Z_50657_ALV_EX2 NO STANDARD PAGE HEADING MESSAGE-ID ZZ.
TABLES: VBAK.

TYPE-POOLS: SLIS.

DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      VBTYP LIKE VBAK-VBTYP,
      AUDAT LIKE VBAK-AUDAT,
      AUGRU LIKE VBAK-AUGRU,
      NETWR LIKE VBAK-NETWR,
      WAERK LIKE VBAK-WAERK,
      ICON TYPE ICON-ID,
      END OF ITAB.

DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LAYOUT TYPE SLIS_LAYOUT_ALV.
******************************************************SELECTION

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
            GRID RADIOBUTTON GROUP G1.

SELECTION-SCREEN END OF BLOCK B2.

********************************************START-OF-SELECTION.
START-OF-SELECTION.

  PERFORM SEARCH_DETAILS.
  PERFORM CHECK_OPTION.


*&--------------------------------------------------------------------*
*&      Form  SEARCH_DETAILS
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM SEARCH_DETAILS.

  SELECT VBELN
         VBTYP
         AUDAT
         AUGRU
         NETWR
         WAERK FROM VBAK INTO TABLE ITAB
         WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
         AND ERDAT > '01.01.2004' AND NETWR > 0.

  SORT ITAB BY VBELN VBTYP.

  LOOP AT ITAB.

    IF ITAB-NETWR < 10000.
      ITAB-ICON = '@08@'.

    ELSEIF ITAB-NETWR > 100000.
      ITAB-ICON = '@10@'.

    ELSE.
      ITAB-ICON = '@09@'.

    ENDIF.

    MODIFY ITAB INDEX SY-TABIX.

  ENDLOOP.

ENDFORM.                    "SEARCH_DETAILS

*&--------------------------------------------------------------------*
*&      Form  CHECK_OPTION
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM CHECK_OPTION.

  IF LIST = 'X'.

    PERFORM LIST_DISP.

  ENDIF.
  IF GRID = 'X'.

    PERFORM GRID_DISP.

  ENDIF.

  ENDFORM.                    "CHECK_OPTION


*&--------------------------------------------------------------------*
*&      Form  LIST_DISP
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM LIST_DISP.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME         = SY-REPID
      I_INTERNAL_TABNAME     = 'ITAB'

    CHANGING
      CT_FIELDCAT            = IT_FIELDCAT

    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.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM             = SY-REPID
     IS_LAYOUT                      = LAYOUT
     IT_FIELDCAT                    = IT_FIELDCAT
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
    TABLES
     T_OUTTAB                       = ITAB
*   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.                    "LIST_DISP


*&--------------------------------------------------------------------*
*&      Form  GRID_DISP
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM GRID_DISP.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME         = SY-REPID
      I_INTERNAL_TABNAME     = 'ITAB'

    CHANGING
      CT_FIELDCAT            = IT_FIELDCAT

    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.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

 EXPORTING
   I_CALLBACK_PROGRAM                = SY-REPID
   IS_LAYOUT                         = LAYOUT
   IT_FIELDCAT                       = IT_FIELDCAT

    TABLES
      T_OUTTAB                       = ITAB

* 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.                    "GRID_DISP

Tags:
replied
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME         = SY-REPID
      I_INTERNAL_TABNAME     = 'ITAB'
      <b>I_INCLNAME             = sy-repid</b>
    CHANGING
      CT_FIELDCAT            = IT_FIELDCAT
    
    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.

add the bold one.

Regards

vijay

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