Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ERROR IN PROGRAM

Former Member
0 Likes
1,509

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,481
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

11 REPLIES 11
Read only

FredericGirod
Active Contributor
0 Likes
1,481

The program have no problem with the activation.

Please explain your problem.

Rgd

Frédéric

Read only

Former Member
0 Likes
1,481

Hi,

Which is the problem exactly? Message error, isn't it compiling...?

I've tried it and it compiles.

Please help us.

Mireia

Read only

Former Member
0 Likes
1,481

this program just selects the data from VBAK and displays it in grid or list format according to the radio button selection..

now i face a problem with "no fieldcatalog found"...when i execute it I am able to fetch the detaisl into internal table

Read only

0 Likes
1,481

Rahul,

I think there is a problem with the generation of field catalog from an internal table. I was also having problem.

So, to test you can try generating it from VBAK table and pass VBAK to the STRUCTURE parameter in the field catalog.

Check if the field catalog is getting generated or not.

Regards,

Ravi

Read only

Former Member
0 Likes
1,482
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

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,481

what error u r getting?

where is perform statement for list_disp / grid_disp?

Read only

0 Likes
1,481

The problem is solved, thanks for ur replies, vijays post helped in that

the perform is according to the radio button selected oruganti....

btw vijay what does this do



I_INCLNAME             = sy-repid

when we have already mentioned the program name



I_PROGRAM_NAME         = SY-REPID

Message was edited by: Rahul Kavuri

Read only

0 Likes
1,481

Instead of finding a fieldcatalog in the workbench dictionnary, your program tries to find the structure of the table in the description you have done at the top of the program.

That works, but there was some buffer problem, you must set to by-pass buffer, or each time you made change, you will not see anything change.

SY-REPID is the actual program execute. Look the structure SYST (with the transaction SE11).

Fred

Read only

0 Likes
1,481

hi,

it is used to include the program while building the catalog, it reads the report and build the fieldcat from itab.

Regards

vijay

Read only

FredericGirod
Active Contributor
0 Likes
1,481

be carefull,

when you use the function REUSE_ALV_FIELDCATALOG_MERGE, the internal table must be declare only with the LIKE not the TYPE.

Rgd

Frédéric

Read only

Former Member
0 Likes
1,481

Hi Rahul

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'ITAB'

I_INCLNAME = SY-REPID

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.

THANKS,

PRIYA