Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Please help me in executing the following code.

$
0
0

IWhen I execute the object, its throwing the exception as "Exception condition "NO_FIELDCATALOG_AVAILABLE" raised. "

 

REPORT ZALV_SALES.

 

 

TYPE-POOLS: SLIS.

TABLES VBAK.

 

 

DATA: BEGIN OF IT_VBAK OCCURS 10,

       VBELN LIKE VBAK-VBELN,

       ERDAT LIKE VBAK-ERDAT,

       ERNAM LIKE VBAK-ERNAM,

       AUDAT LIKE VBAK-AUDAT,

       AUART LIKE VBAK-AUART,

       NETWR LIKE VBAK-NETWR,

       VKORG LIKE VBAK-VKORG,

       KUNNR LIKE VBAK-KUNNR,

       END OF IT_VBAK.

DATA IT_VBAP TYPE TABLE OF VBAP.

DATA IT_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

DATA V_PROGRAM LIKE SY-REPID.

 

 

SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM BUILD_FCAT_SEMI_AUTO.

PERFORM DISPLAY_ALV_GRID.

*&---------------------------------------------------------------------*

*&      Form  GET_DATA

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM GET_DATA .

SELECT * FROM VBAK

        INTO CORRESPONDING FIELDS OF TABLE IT_VBAK

        WHERE VBELN IN S_VBELN.

V_PROGRAM = SY-REPID.

ENDFORM.                    " GET_DATA

FORM BUILD_FCAT_SEMI_AUTO.

 

 

*&---------------------------------------------------------------------*

*&      Form  BUILD_FCAT_SEMI_AUTO

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

                         call function 'REUSE_ALV_FIELDCATALOG_MERGE'

                          EXPORTING

                            I_PROGRAM_NAME               = V_PROGRAM

                            I_INTERNAL_TABNAME           = 'IT_VBAK'

*                            I_STRUCTURE_NAME             =

*                            I_CLIENT_NEVER_DISPLAY       = 'X'

                            I_INCLNAME                   = V_PROGRAM

*                            I_BYPASSING_BUFFER           =

*                            I_BUFFER_ACTIVE              =

                           changing

                             ct_fieldcat                  = IT_FCAT[]

                          EXCEPTIONS

                            INCONSISTENT_INTERFACE       = 1

                            PROGRAM_ERROR                = 2

                            OTHERS                       = 3.

 

 

 

 

 

 

                         IF SY-SUBRC = 0.

LOOP AT IT_FCAT.

CASE IT_FCAT-FIELDNAME.

WHEN 'VBELN'.

IT_FCAT-JUST = 'C'.

WHEN 'ERNAM'.

IT_FCAT-EMPHASIZE = 'C501'.

WHEN 'AUDAT'.

IT_FCAT-EDIT_MASK = '__/__/____'.

WHEN 'NETWR'.

IT_FCAT-DO_SUM = 'X'.

ENDCASE.

MODIFY IT_FCAT.

ENDLOOP.

ELSE.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER

SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

 

 

                       ENDIF.

 

 

ENDFORM.                    " BUILD_FCAT_SEMI_AUTO

 

 

 

 

 

 

*&---------------------------------------------------------------------*

*&      Form  DISPLAY_ALV_GRID

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM DISPLAY_ALV_GRID.

 

 

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROGRAM

*   I_CALLBACK_PF_STATUS_SET          = ' '

   I_CALLBACK_USER_COMMAND           = 'HANDLE_DOUBLE_CLK '

   I_CALLBACK_TOP_OF_PAGE            = 'HANDLE_PAGE_HEADING'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

   I_GRID_TITLE                      = 'SALES REPORT'

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

*   IT_FIELDCAT                       =

*   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

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = IT_VBAK

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_GRID

 

 

FORM HANDLE_PAGE_HEADING.

 

 

DATA IT_LIST TYPE SLIS_T_LISTHEADER WITH HEADER LINE.

 

 

*H = HEADER.

IT_LIST-TYP = 'H'.

IT_LIST-KEY = 'VBELN'.

IT_LIST-INFO = 'SALES HEADER DATA'.

APPEND IT_LIST.

 

 

*S = SELECTION.

IT_LIST-TYP = 'S'.

IT_LIST-KEY = 'VBELN'.

IT_LIST-INFO = 'SALES DATA'.

APPEND IT_LIST.

 

 

 

 

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  EXPORTING

    IT_LIST-COMMENTARY       = IT_LIST[]

*  I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

          .

 

 

ENDFORM.

 

 

FORM HANDLE_DOUBLE_CLK USING V_FCODE LIKE SY-UCOMM

                            WA TYPE SLIS_SELFIELD.

READ TABLE IT_VBAK INDEX WA-TABINDEX.

IF SY-SUBRC = 0.

SELECT * FROM VBAP INTO TABLE IT_VBAP

          WHERE VBELN = IT_VBAK-VBELN.

 

 

IF SY-SUBRC = 0.

 

 

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROGRAM

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   I_CALLBACK_TOP_OF_PAGE            = ' '

*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

   I_STRUCTURE_NAME                  = 'VBAP'

*   I_BACKGROUND_ID                   = ' '

   I_GRID_TITLE                      = 'SALES ITEM DATA'

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

*   IT_FIELDCAT                       =

*   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

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = IT_VBAP

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

ENDIF.

ENDIF.

ENDFORM.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>