Skip to Content

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

statement is not accessible in call function

hi when i going to activate this alv report i m geting statement is not accessible please help me getting fix in this issue

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

*& Report  ZSG_ALV

*&

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

*&

*&

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

REPORT  ZSG_ALV.

TABLEs: mara.

TYPE-POOLS : SLIS.

TYPES: BEGIN OF ty_mara,

        matnr TYPE matnr,

        mtart TYPE mtart,

        MBRSH TYPE MBRSH,

        matkl TYPE matkl,

        END OF ty_mara.

data : it_mara TYPE STANDARD TABLE OF ty_mara,

        wa_mara TYPE ty_mara,

        FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

        GD_REPID like sy-repid.

GD_REPID = SY-REPID.

SELECT-OPTIONS s_matnr for mara-matnr.

START-OF-SELECTION.

SELECT matnr mtart MBRSH matkl FROM mara into TABLE it_mara WHERE

matnr in s_matnr.

PERFORM build_fieldcatalog.

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

*&      Form  BUILD_FIELDCATALOG

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

*       text

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

*  -->  p1        text

*  <--  p2        text

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

form BUILD_FIELDCATALOG .

FIELDCATALOG-col_pos = 0.

FIELDCATALOG-fieldname = 'matnr'.

FIELDCATALOG-seltext_m = 'MATERIAL NO'.

APPEND FIELDCATALOG to FIELDCATALOG.

CLEAR FIELDCATALOG.

   FIELDCATALOG-col_pos = 1.

   FIELDCATALOG-fieldname = 'mtart'.

   FIELDCATALOG-seltext_m = 'MATERIAL TYPE'.

   APPEND FIELDCATALOG TO FIELDCATALOG.

   CLEAR FIELDCATALOG.

   FIELDCATALOG-col_pos = 2.

   FIELDCATALOG-fieldname = 'mbrsh'.

   FIELDCATALOG-seltext_m = 'Industry sector'.

   APPEND FIELDCATALOG TO FIELDCATALOG.

   CLEAR FIELDCATALOG.

   FIELDCATALOG-col_pos = 3.

   FIELDCATALOG-fieldname = 'matkl'.

   FIELDCATALOG-seltext_m = 'material group'.

   APPEND FIELDCATALOG TO FIELDCATALOG.

   CLEAR FIELDCATALOG.

endform.                    " BUILD_FIELDCATALOG

  PERFORM DISPLAY_ALV_REPORT.

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

*&      Form  DISPLAY_ALV_REPORT

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

*       text

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

*  -->  p1        text

*  <--  p2        text

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

form DISPLAY_ALV_REPORT .

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

     i_callback_program = GD_REPID

*  is_layout          = w_layout

     it_fieldcat        = FIELDCATALOG[]

*  it_events          = i_events

   TABLES

     t_outtab           = it_mara

   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_REPORT

replied

Hi Sudip,

Write the "GD_REPID = SY-REPID" either inside the Start-of-selection or inside INITIALIZATION event.

And Give the Field Catalog-FIELNAME in CAPITAL Format.

Regards.

Praveer.

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