Application Development 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: 

Please review this program.

Former Member
0 Kudos

Dear all gurus,

Can you please review this Code and guide me why on earth it is going DUMP.

Here is the code for your reference.

REPORT zitnter_alv.

TYPE-POOLS : slis.

TABLES: ekko,ekpo.

DATA:BEGIN OF wa_ekko,

     ebeln TYPE ekko-ebeln,

     bukrs TYPE ekko-bukrs,

     bstyp TYPE ekko-bstyp,

     bsart TYPE ekko-bsart,

END OF wa_ekko.

DATA: BEGIN OF wa_ekpo,

loekz TYPE ekpo-loekz,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

ebeln TYPE ekpo-ebeln,

END OF wa_ekpo.

DATA: it_ekko LIKE TABLE OF wa_ekko,

      it_ekpo LIKE TABLE OF wa_ekpo.

DATA : it_fcat TYPE slis_t_fieldcat_alv,

       wa_fcat LIKE LINE OF it_fcat,

it_fcat1 TYPE slis_t_fieldcat_alv,

       wa_fcat1 LIKE LINE OF it_fcat1.

SELECT ebeln bukrs bstyp bsart FROM ekko

INTO TABLE it_ekko UP TO 20 ROWS.

wa_fcat-fieldname = 'EBELN'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '1'.

wa_fcat-seltext_s = 'PO.DOC NO'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BUKRS'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '2'.

wa_fcat-seltext_s = 'COMP.CODE'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BSTYP'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '3'.

wa_fcat-seltext_s = 'PO.CATG'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BSART'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '4'.

wa_fcat-seltext_s = 'PO.DOC TYPE'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  EXPORTING

i_callback_program      = sy-cprog

i_callback_user_command = 'AT_LINE_SELECTION'

it_fieldcat             = it_fcat

  TABLES

    t_outtab                = it_ekko

  EXCEPTIONS

program_error           = 1.

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

*& Form  at_line_selection

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

*       text

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

*  -->  p1 text

*  <--  p2 text

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

FORM at_line_selection USING a LIKE sy-ucomm

                             b TYPE slis_selfield.

  CASE a.

    WHEN '&IC1'.

      IF b-fieldname = 'EBELN'.

        SELECT  loekz

              statu

              aedat

              ebeln

             FROM ekpo INTO TABLE it_ekpo WHERE ebeln = b-value.

        PERFORM prepare.

      ELSE.

        MESSAGE 'Please click on EBELN' TYPE 'S'.

      ENDIF.

  ENDCASE.

  1. "at_line_selection

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

*& Form  PREPARE

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

*       text

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

FORM prepare.

wa_fcat1-fieldname = 'LOEKZ'.

  wa_fcat1-tabname = 'EKPO'.

  wa_fcat1-col_pos = '2'.

wa_fcat1-seltext_s = 'DEL. INDC.'.

  APPEND wa_fcat1 TO it_fcat1.

  CLEAR wa_fcat1.

wa_fcat1-fieldname = 'STATU'.

  wa_fcat1-tabname = 'EKPO'.

  wa_fcat1-col_pos = '3'.

wa_fcat1-seltext_s = 'STATUS'.

  APPEND wa_fcat1 TO it_fcat1.

  CLEAR wa_fcat1.

wa_fcat1-fieldname = 'AEDATE'.

  wa_fcat1-tabname = 'EKPO'.

  wa_fcat1-col_pos = '1'.

wa_fcat1-seltext_s = 'DATE'.

  APPEND wa_fcat1 TO it_fcat1.

  CLEAR wa_fcat1.

  wa_fcat1-fieldname = 'EBELN'.

  wa_fcat1-tabname = 'EKPO'.

  wa_fcat1-col_pos = '4'.

wa_fcat1-seltext_s = 'PO'.

  APPEND wa_fcat1 TO it_fcat1.

  CLEAR wa_fcat1.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

* I_INTERFACE_CHECK                 = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

i_callback_program = sy-cprog

* 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 = I_STRUCTURE_NAME

* I_BACKGROUND_ID = ' '

*     I_GRID_TITLE                      = I_GRID_TITLE

* I_GRID_SETTINGS = I_GRID_SETTINGS

* IS_LAYOUT = IS_LAYOUT

it_fieldcat = it_fcat1

* IT_EXCLUDING = IT_EXCLUDING

* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

*     IT_SORT                           = IT_SORT

* IT_FILTER = IT_FILTER

* IS_SEL_HIDE = IS_SEL_HIDE

* I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

* IS_VARIANT = IS_VARIANT

* IT_EVENTS = IT_EVENTS

* IT_EVENT_EXIT = IT_EVENT_EXIT

*     IS_PRINT                          = IS_PRINT

* IS_REPREP_ID = 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_ALV_GRAPHICS

* IT_HYPERLINK = IT_HYPERLINK

* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

*   IMPORTING

* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

* ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER

    TABLES

      t_outtab                          = it_ekpo

   EXCEPTIONS

program_error = 1

            .

  1. "prepare
1 ACCEPTED SOLUTION

former_member184569
Active Contributor
0 Kudos

Hari,

Except for two endforms missing here, which I believe you have given in your program, but just missed when you posted in here, (otherwise it would have given syntax error), I dont find any errors.

In fact, I got the output when I executed it.

Can you send the screenshot of your short dump?

8 REPLIES 8

ThomasZloch
Active Contributor
0 Kudos

Don't expect the gurus to run this for you. What exactly does the short dump say, what is the title and what is mentioned under "error analysis"? Did you search for existing answers first?

Thomas

former_member187748
Active Contributor
0 Kudos

This message was moderated.

former_member184569
Active Contributor
0 Kudos

Hari,

Except for two endforms missing here, which I believe you have given in your program, but just missed when you posted in here, (otherwise it would have given syntax error), I dont find any errors.

In fact, I got the output when I executed it.

Can you send the screenshot of your short dump?

0 Kudos

Hari,

I did get a dump on double click event.

I resolved by just changing the number of column position in the field catalog in the subroutine prepare.

You could also just comment out these lines in bold. (   wa_fcat1-col_pos = ' '.) It would still work.

FORM prepare.

wa_fcat1-fieldname = 'LOEKZ'.
    wa_fcat1-tabname = 'EKPO'.
   wa_fcat1-col_pos = '1'.
  wa_fcat1-seltext_s = 'DEL. INDC.'.
    APPEND wa_fcat1 TO it_fcat1.
    CLEAR wa_fcat1.

wa_fcat1-fieldname = 'STATU'.
    wa_fcat1-tabname = 'EKPO'.
   wa_fcat1-col_pos = '2'.
  wa_fcat1-seltext_s = 'STATUS'.
    APPEND wa_fcat1 TO it_fcat1.
    CLEAR wa_fcat1.

wa_fcat1-fieldname = 'AEDATE'.
    wa_fcat1-tabname = 'EKPO'.
   wa_fcat1-col_pos = '3'.
  wa_fcat1-seltext_s = 'DATE'.
    APPEND wa_fcat1 TO it_fcat1.
    CLEAR wa_fcat1.

    wa_fcat1-fieldname = 'EBELN'.
    wa_fcat1-tabname = 'EKPO'.
   wa_fcat1-col_pos = '4'.
   wa_fcat1-seltext_s = 'PO'.
    APPEND wa_fcat1 TO it_fcat1.
    CLEAR wa_fcat1.

former_member187748
Active Contributor
0 Kudos

Here is the output that i have got from your program.

if still you are not getting result then reply me.

Former Member
0 Kudos

Please check the tables ekko,ekpo..active or not!!

former_member187748
Active Contributor
0 Kudos

Hello Hari,

as Susmitha Susan Thomas,  has been sujjested, please change your code as shown below, on double click

you will get data as shown below.

Your revised code, as sujjested by Thomas should be.

Still if you are not satisfying then reply.

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

*& Report  ZTEST_SCN

*&

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

*&

*&

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

REPORT  ZTEST_SCN.

*REPORT zitnter_alv.

TYPE-POOLS : slis.

TABLES: ekko,ekpo.

DATA:BEGIN OF wa_ekko,

      ebeln TYPE ekko-ebeln,

      bukrs TYPE ekko-bukrs,

      bstyp TYPE ekko-bstyp,

      bsart TYPE ekko-bsart,

END OF wa_ekko.

DATA: BEGIN OF wa_ekpo,

loekz TYPE ekpo-loekz,

statu TYPE ekpo-statu,

aedat TYPE ekpo-aedat,

ebeln TYPE ekpo-ebeln,

END OF wa_ekpo.

DATA: it_ekko LIKE TABLE OF wa_ekko,

       it_ekpo LIKE TABLE OF wa_ekpo.

DATA : it_fcat TYPE slis_t_fieldcat_alv,

        wa_fcat LIKE LINE OF it_fcat,

it_fcat1 TYPE slis_t_fieldcat_alv,

        wa_fcat1 LIKE LINE OF it_fcat1.

SELECT ebeln bukrs bstyp bsart FROM ekko

INTO TABLE it_ekko UP TO 20 ROWS.

wa_fcat-fieldname = 'EBELN'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '1'.

wa_fcat-seltext_s = 'PO.DOC NO'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BUKRS'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '2'.

wa_fcat-seltext_s = 'COMP.CODE'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BSTYP'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '3'.

wa_fcat-seltext_s = 'PO.CATG'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

wa_fcat-fieldname = 'BSART'.

wa_fcat-tabname = 'EKKO'.

wa_fcat-col_pos = '4'.

wa_fcat-seltext_s = 'PO.DOC TYPE'.

APPEND wa_fcat TO it_fcat.

CLEAR wa_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

i_callback_program      = sy-cprog

i_callback_user_command = 'AT_LINE_SELECTION'

it_fieldcat             = it_fcat

   TABLES

     t_outtab                = it_ekko

   EXCEPTIONS

program_error           = 1.

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

*& Form  at_line_selection

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

*       text

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

*  -->  p1 text

*  <--  p2 text

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

FORM at_line_selection USING a LIKE sy-ucomm

                              b TYPE slis_selfield.

   CASE a.

     WHEN '&IC1'.

       IF b-fieldname = 'EBELN'.

         SELECT  loekz

               statu

               aedat

               ebeln

              FROM ekpo INTO TABLE it_ekpo WHERE ebeln = b-value.

         PERFORM prepare.

       ELSE.

         MESSAGE 'Please click on EBELN' TYPE 'S'.

       ENDIF.

   ENDCASE.

  ENDFORM.

"at_line_selection

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

*& Form  PREPARE

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

*       text

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

FORM prepare.

wa_fcat1-fieldname = 'LOEKZ'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '1'.

wa_fcat1-seltext_s = 'DEL. INDC.'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

wa_fcat1-fieldname = 'STATU'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '2'.

wa_fcat1-seltext_s = 'STATUS'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

wa_fcat1-fieldname = 'AEDATE'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '3'.

wa_fcat1-seltext_s = 'DATE'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

wa_fcat1-fieldname = 'EBELN'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '4'.

wa_fcat1-seltext_s = 'PO'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

* I_INTERFACE_CHECK                 = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

i_callback_program = sy-cprog

* 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 = I_STRUCTURE_NAME

* I_BACKGROUND_ID = ' '

*     I_GRID_TITLE                      = I_GRID_TITLE

* I_GRID_SETTINGS = I_GRID_SETTINGS

* IS_LAYOUT = IS_LAYOUT

it_fieldcat = it_fcat1

* IT_EXCLUDING = IT_EXCLUDING

* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS

*     IT_SORT                           = IT_SORT

* IT_FILTER = IT_FILTER

* IS_SEL_HIDE = IS_SEL_HIDE

* I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

* IS_VARIANT = IS_VARIANT

* IT_EVENTS = IT_EVENTS

* IT_EVENT_EXIT = IT_EVENT_EXIT

*     IS_PRINT                          = IS_PRINT

* IS_REPREP_ID = 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_ALV_GRAPHICS

* IT_HYPERLINK = IT_HYPERLINK

* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT

* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO

* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER

*   IMPORTING

* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

* ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER

     TABLES

       t_outtab                          = it_ekpo

    EXCEPTIONS

program_error = 1

             .

  ENDFORM.

Former Member
0 Kudos

hi,

     your code is working fine..

FORM prepare.

wa_fcat1-fieldname = 'LOEKZ'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '1'.

wa_fcat1-seltext_s = 'DEL. INDC.'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

wa_fcat1-fieldname = 'STATU'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '2'.

wa_fcat1-seltext_s = 'STATUS'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

wa_fcat1-fieldname = 'AEDATE'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '3'.

wa_fcat1-seltext_s = 'DATE'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

   wa_fcat1-fieldname = 'EBELN'.

   wa_fcat1-tabname = 'EKPO'.

   wa_fcat1-col_pos = '4'.

wa_fcat1-seltext_s = 'PO'.

   APPEND wa_fcat1 TO it_fcat1.

   CLEAR wa_fcat1.

* ENDFORM.

just chnage the pos . it ll work

Regards

gopi