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

Problem in alv program

Chaitanyat
Participant
0 Likes
470

hi all,

the following code is for an alv grid. The program is working fine. But after execution when the report is displayed the code is going for a dump when the back button is clicked. Could anyone tell as to whats going wrong. And when the highlighted part in the code is commented it is not giving a dump. The highligted part was used to include the row selection in the alv because

<b>s_layout-sel_mode = 'A'</b>.

was not working.

&----


*& Report ZFI_9KE0

*&

&----


*&

*&

&----


REPORT zfi_9ke0.

*----


*TYPE-POOLS

*----


TYPE-POOLS : slis.

*----


*DATA

*----


DATA: BEGIN OF wa,

blart LIKE bsis-blart,

hkont LIKE bsis-hkont,

budat LIKE bsis-budat,

wrbtr LIKE bsis-wrbtr,

prctr LIKE bsis-prctr,

pprct LIKE bsis-pprct,

sgtxt LIKE bsis-sgtxt,

END OF wa.

DATA: v_counter TYPE i.

*----


*ALV SPECIFIC DECLARATIONS

*----


DATA : t_events TYPE slis_t_event.

DATA : t_fieldcat TYPE slis_t_fieldcat_alv.

DATA : t_list TYPE slis_t_listheader.

DATA : v_repid TYPE sy-repid.

DATA : v_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

DATA : v_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

DATA : s_getinfo TYPE slis_keyinfo_alv.

DATA : s_layout TYPE slis_layout_alv.

&----


*&INTERNAL TABLE

&----


DATA: itab LIKE STANDARD TABLE OF wa WITH HEADER LINE.

&----


*&SELECTION SCREEN

&----


*SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

*PARAMETER: p_acc type bsis-hkont.

*SELECTION-SCREEN : END OF BLOCK blk1.

&----


*&INITIALIZATION.

&----


INITIALIZATION.

PERFORM init.

&----


*&START-OF-SELECTION.

&----


START-OF-SELECTION.

PERFORM get_data.

&----


*&END-OF-SELECTION.

&----


END-OF-SELECTION.

PERFORM sub_comment_write.

PERFORM sub_layout.

PERFORM sub_call_alv.

&----


*& Form billing_init

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM init .

v_repid = sy-repid.

PERFORM sub_events.

PERFORM sub_fieldcat.

ENDFORM. " BILLING_INIT

&----


*& Form SUB_EVENTS

&----


  • text

----


FORM sub_events .

DATA : wa_event TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = t_events.

SORT t_events.

READ TABLE t_events WITH KEY name = slis_ev_top_of_page BINARY SEARCH

INTO wa_event.

MOVE v_top_of_page TO wa_event-form.

IF sy-subrc EQ 0.

APPEND wa_event TO t_events.

ENDIF.

SORT t_events.

  • READ TABLE t_events WITH KEY name = slis_ev_user_command BINARY SEARCH

  • INTO wa_event.

*

  • MOVE v_user_command TO wa_event-form.

*

  • IF sy-subrc EQ 0.

*

  • APPEND wa_event TO t_events.

*

  • ENDIF.

ENDFORM. " SUB_EVENTS

&----


*& Form SUB_FIELDCAT

&----


  • text

----


FORM sub_fieldcat .

PERFORM insert_field USING :

'BLART' 'DOCUMENT TYPE' 'X' 20 ,

'HKONT' 'GL DOCUMENT' space 20 ,

'BUDAT' 'DOCUMENT DATE' space 20 ,

'WRBTR' 'PROFIT AMOUNT' space 20 ,

'PRCTR' 'MATERIAL RECIEVED PROFIT CENTER' space 40 ,

'PPRCTR' 'MATERIAL SEND PROFIT CENTER' space 40 ,

'SGTXT' 'TEXT' space 40.

ENDFORM. " SUB_FIELDCAT

&----


*& Form INSERT_FIELD

&----


  • text

----


FORM insert_field USING value(p_fname)

value(p_tname)

value(p_key)

value(p_length).

DATA : wa_fieldcat TYPE slis_fieldcat_alv.

v_counter = v_counter + 1.

wa_fieldcat-col_pos = v_counter.

wa_fieldcat-fieldname = p_fname.

wa_fieldcat-seltext_m = p_tname.

wa_fieldcat-key = p_key.

wa_fieldcat-outputlen = p_length.

IF wa_fieldcat-col_pos = 6.

wa_fieldcat-do_sum = 'X'.

ENDIF.

APPEND wa_fieldcat TO t_fieldcat.

ENDFORM. " INSERT_FIELD

&----


*& Form GET_DATA

&----


  • text

----


FORM get_data .

CLEAR: itab.

SELECT blart

hkont

budat

wrbtr

prctr

pprct

sgtxt

FROM bsis

INTO TABLE itab

WHERE blart = 'WA'.

  • AND hkont EQ p_acc.

  • OR hkont EQ '277500000'.

ENDFORM. " GET_DATA

&----


*& Form SUB_COMMENT_WRITE

&----


  • text

----


FORM sub_comment_write .

DATA : wa_list TYPE slis_listheader.

wa_list-typ = 'H'.

wa_list-info = 'FI DOCUMENT POSTING '.

APPEND wa_list TO t_list.

ENDFORM. " SUB_COMMENT_WRITE

&----


*& Form SUB_LAYOUT

&----


  • text

----


FORM sub_layout .

s_layout-detail_popup = 'X'.

  • s_layout-sel_mode = 'A'.

s_layout-zebra = 'X'.

s_layout-colwidth_optimize = 'X'.

<b> s_layout-box_fieldname = 'SELECT'.

s_layout-box_tabname = 'itab'.</b>

ENDFORM. " SUB_LAYOUT

&----


*& Form SUB_CALL_ALV

&----


  • text

----


FORM sub_call_alv .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = v_repid

  • 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_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

is_layout = s_layout

it_fieldcat = t_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

it_events = t_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 = 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. " SUB_CALL_ALV

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM top_of_page .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_list

i_logo = 'ENJOYSAP_LOGO'.

ENDFORM. "top_of_page

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
436

Hi,

in ur code box_fieldname = 'select' should be a field in the table itab.

for that define itab like this.

data begin of itab occurs 0.

include structure wa.

data select.

data end of itab.

rgds,

bharat.

4 REPLIES 4
Read only

Former Member
0 Likes
436

s_layout-box_tabname = 'itab'.

first change the above assignment to

s_layout-box_tabname = 'ITAB'. and then get back to us.

Read only

0 Likes
436

The problem isn't solved even after the change has been made. Can you please now try giving an answer to the question.

regards,

chaitanya

null

Read only

Former Member
0 Likes
437

Hi,

in ur code box_fieldname = 'select' should be a field in the table itab.

for that define itab like this.

data begin of itab occurs 0.

include structure wa.

data select.

data end of itab.

rgds,

bharat.

Read only

Former Member
0 Likes
436

JUST ADD THIS

DATA: BEGIN OF wa,

<b>SELECT,</b>

blart LIKE bsis-blart,

hkont LIKE bsis-hkont,

budat LIKE bsis-budat,

wrbtr LIKE bsis-wrbtr,

prctr LIKE bsis-prctr,

pprct LIKE bsis-pprct,

sgtxt LIKE bsis-sgtxt,

END OF wa.

IN

s_layout-box_fieldname = 'SELECT'.

*s_layout-box_tabname = 'ITAB'.

ADD THE BOX FIELD IN WA

REGARDS

SHIBA DUTTA