Skip to Content
0
Former Member
Jun 28, 2008 at 06:15 AM

alv grid

18 Views

I have devloped one alv grid program but when i am going to run this program with the test data i am getting runtime error.can u check my code and tell me where the code is wrong.i am giving the program code.

&----


*& Include ZIRPR002_DELAY_REPORT_TOP

&----


TABLES : zrpa_prd_delay.

TYPE-pools : slis.

  • Type defination

TYPES : begin of ty_zrpa_prd_delay,

  • werks like zrpa_prd_delay-werks,

PI_AUFART like zrpa_prd_delay-PI_AUFART, "Order category for process orders

SHIFT like zrpa_prd_delay-SHIFT, " Shift

ZZDATE like zrpa_prd_delay-ZZDATE, " Field of type DATS

GSUZS like zrpa_prd_delay-GSUZS , " Scheduled start time

GLUZS like zrpa_prd_delay-GLUZS, "Scheduled finish time

RE_DELAY like zrpa_prd_delay-RE_DELAY, " Reason for Delay

T_DELAY like zrpa_prd_delay-T_DELAY , " Total Delay

end of ty_zrpa_prd_delay.

data : i_zrpa_prd_delay type standard table of ty_zrpa_prd_delay initial size 0,

wa_zrpa_prd_delay type ty_zrpa_prd_delay,

i_tab_fieldcat type slis_t_fieldcat_alv,

wa_fieldcat type slis_fieldcat_alv,

i_tab_header type slis_t_listheader,

wa_header type slis_listheader.

*Data declearation for select-options.

data : g_pi_aufart type pi_aufart,

g_shift type zzshift,

g_date type dats,

g_re_delay type zzre_delay.

data : g_repid LIKE sy-repid.

data : g_top_of_page type SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.

&----


*& Include ZIRPR002_DLY_RPT_SELECT_DATA

&----


&----


*& Form VALIDATION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATION .

*Validation

select single PI_AUFART from ZRPA_PRD_DELAY

into g_pi_aufart

where pi_aufart in s_order.

if sy-subrc <> 0.

message e004.

endif.

select single SHIFT from ZRPA_PRD_DELAY

into g_shift

where shift in s_shift.

if sy-subrc <> 0.

message e005.

endif.

select single RE_DELAY from ZRPA_PRD_DELAY

into g_re_delay

where re_delay in s_resion.

if sy-subrc <> 0.

message e006.

ENDIF.

ENDFORM. " VALIDATION

&----


*& Form SELECT_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SELECT_DATA .

select

PI_AUFART

SHIFT

ZZDATE

GSUZS

GLUZS

RE_DELAY

T_DELAY from ZRPA_PRD_DELAY

into table i_zrpa_prd_delay

where pi_aufart in s_order

and shift in s_shift

and zzdate in s_date

and re_delay in s_resion.

IF SY-SUBRC <> 0.

MESSAGE E007.

ENDIF.

ENDFORM. " SELECT_DATA

&----


*& Form BUILD_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BUILD_FIELDCAT .

wa_fieldcat-col_pos = 1.

wa_fieldcat-fieldname = 'pi_aufart'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Order Type'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 2.

wa_fieldcat-fieldname = 'ZZDATE'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Date'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 3.

wa_fieldcat-fieldname = 'SHIFT'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Shift'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 4.

wa_fieldcat-fieldname = 'GSUZS'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Start Time'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 5.

wa_fieldcat-fieldname = 'GLUZS'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Finish Time'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 6.

wa_fieldcat-fieldname = 'RE_DELAY'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Reason'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

wa_fieldcat-col_pos = 7.

wa_fieldcat-fieldname = 'T_DELAY'.

wa_fieldcat-tabname = 'i_zrpa_prd_delay'.

wa_fieldcat-seltext_l = 'Total Delay'.

append wa_fieldcat to i_tab_fieldcat.

clear wa_fieldcat.

ENDFORM. " BUILD_FIELDCAT

form top_of_page.

wa_header-typ = 'H'.

wa_header-info = 'Production Delay Report'.

append wa_header to i_tab_header.

clear wa_header.

wa_header-typ = 'H'.

wa_header-info = 'Bokaro Steel Plant'.

append wa_header to i_tab_header.

clear wa_header.

wa_header-typ = 'H'.

wa_header-info = 'Date:'.

append wa_header to i_tab_header.

clear wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = i_tab_header.

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

endform. "Top Of Page

&----


*& Form GRID_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GRID_DISPLAY .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = g_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_CALLBACK_TOP_OF_PAGE = g_top_of_page

  • I_CALLBACK_HTML_TOP_OF_PAGE =

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = i_tab_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 = i_zrpa_prd_delay

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_DISPLAY