Skip to Content
0
Former Member
Dec 17, 2013 at 11:31 AM

Please review this program.

88 Views

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