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 with alv report

Former Member
0 Likes
1,102

Following is the code, giving shortdump please tell me where the problem is exactly...........

Useful answer will be rewarded

Regards

&----


*

*& Report ZALV

*&

&----


*&

*&

&----


REPORT ZALV.

TABLES:LFA1,EKKO,EKPO.

select-options:s_lifnr for lfa1-lifnr.

DATA:Begin of itab occurs 0,

lifnr like lfa1-lifnr,

name1 like lfa1-lifnr,

end of itab.

Data:begin of jtab occurs 0,

ebeln like ekko-ebeln,

aedat like ekko-aedat,

end of jtab.

Data:begin of ktab occurs 0,

ebelp like ekpo-ebelp,

matnr like ekpo-matnr,

end of ktab.

type-pools:slis.

Data:fs_layout type slis_layout_alv,

t_layoout like standard table

of fs_layout.

DATA USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

data:REPID like sy-repid,

*user_command like sy-ucomm,

  • user_command like slis_ev_user_command,

f_lfa11 type slis_t_fieldcat_alv,

f_lfa1 type slis_fieldcat_alv,

f_ekko1 type slis_t_fieldcat_alv,

f_ekko type slis_fieldcat_alv,

f_ekpo1 type slis_t_fieldcat_alv,

f_ekpo type slis_fieldcat_alv,

i_events type slis_t_event,

s_events type slis_alv_event.

REPID = SY-REPID.

PERFORM COL_HEAD.

START-OF-SELECTION.

select lifnr name1 from lfa1 into table itab where lifnr in s_lifnr.

*set user-command 'user_command'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = USER_COMMAND

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = f_lfa11

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = i_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

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • 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.

FORM COL_HEAD.

f_lfa1-fieldname = 'lifnr'.

f_lfa1-ref_tabname = 'lfa1'.

f_lfa1-ref_fieldname = 'lifnr'.

append f_lfa1 to f_lfa11.

f_lfa1-fieldname = 'name1'.

f_lfa1-ref_tabname = 'lfa1'.

f_lfa1-ref_fieldname = 'name1'.

append f_lfa1 to f_lfa11.

f_ekko-fieldname = 'ebeln'.

f_ekko-ref_tabname = 'ekko'.

f_ekko-ref_fieldname = 'ebeln'.

append f_ekko to f_ekko1.

f_ekko-fieldname = 'aedat'.

f_ekko-ref_tabname = 'ekko'.

f_ekko-ref_fieldname = 'aedat'.

append f_ekko to f_ekko1.

f_ekpo-fieldname = 'ebelp'.

f_ekpo-ref_tabname = 'ekpo'.

f_ekpo-ref_fieldname = 'ebelp'.

append f_ekpo to f_ekpo1.

f_ekpo-fieldname = 'matnr'.

f_ekpo-ref_tabname = 'ekpo'.

f_ekpo-ref_fieldname = 'matnr'.

append f_ekpo to f_ekpo1.

s_events-name = 'USER_COMMAND'.

s_events-form = 'VAL'.

append s_events to i_events.

endform.

*form val using user_command like sy-ucomm

form VAL using USER_COMMAND like sy-ucomm

sel type slis_selfield.

DATA:v_lifnr(10) type N,

v_ebeln(10) type N,

v_matnr(10) type C.

if sel-fieldname = 'lifnr'.

v_lifnr = sel-value.

select ebeln aedat from ekko into table jtab where lifnr = v_lifnr.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = user_command

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = f_ekko1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = i_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

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = jtab.

  • 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.

endif.

if sel-fieldname = 'ebeln'.

v_ebeln = sel-value.

select ebelp matnr from ekpo into table ktab where ebeln = v_ebeln.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'item details'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

I_SCREEN_START_COLUMN = 10

I_SCREEN_START_LINE = 10

I_SCREEN_END_COLUMN = 27

I_SCREEN_END_LINE = 16

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'ekpo'

  • I_STRUCTURE_NAME =

IT_FIELDCAT = f_ekpo1

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

IMPORTING

ES_SELFIELD = sel

  • E_EXIT =

TABLES

T_OUTTAB = ktab.

  • 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.

endif.

if sel-fieldname = 'matnr'.

v_matnr = sel-value.

set parameter id 'mat' field v_matnr.

call transaction 'mm02' and skip first screen.

endif.

Following is the code, giving shortdump please tell me where the problem is exactly...........

Useful answer will be rewarded

Regards

&----


*

*& Report ZALV

*&

&----


*&

*&

&----


REPORT ZALV.

TABLES:LFA1,EKKO,EKPO.

select-options:s_lifnr for lfa1-lifnr.

DATA:Begin of itab occurs 0,

lifnr like lfa1-lifnr,

name1 like lfa1-lifnr,

end of itab.

Data:begin of jtab occurs 0,

ebeln like ekko-ebeln,

aedat like ekko-aedat,

end of jtab.

Data:begin of ktab occurs 0,

ebelp like ekpo-ebelp,

matnr like ekpo-matnr,

end of ktab.

type-pools:slis.

Data:fs_layout type slis_layout_alv,

t_layoout like standard table

of fs_layout.

DATA USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

data:REPID like sy-repid,

*user_command like sy-ucomm,

  • user_command like slis_ev_user_command,

f_lfa11 type slis_t_fieldcat_alv,

f_lfa1 type slis_fieldcat_alv,

f_ekko1 type slis_t_fieldcat_alv,

f_ekko type slis_fieldcat_alv,

f_ekpo1 type slis_t_fieldcat_alv,

f_ekpo type slis_fieldcat_alv,

i_events type slis_t_event,

s_events type slis_alv_event.

REPID = SY-REPID.

PERFORM COL_HEAD.

START-OF-SELECTION.

select lifnr name1 from lfa1 into table itab where lifnr in s_lifnr.

*set user-command 'user_command'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = USER_COMMAND

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = f_lfa11

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = i_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

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • 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.

FORM COL_HEAD.

f_lfa1-fieldname = 'lifnr'.

f_lfa1-ref_tabname = 'lfa1'.

f_lfa1-ref_fieldname = 'lifnr'.

append f_lfa1 to f_lfa11.

f_lfa1-fieldname = 'name1'.

f_lfa1-ref_tabname = 'lfa1'.

f_lfa1-ref_fieldname = 'name1'.

append f_lfa1 to f_lfa11.

f_ekko-fieldname = 'ebeln'.

f_ekko-ref_tabname = 'ekko'.

f_ekko-ref_fieldname = 'ebeln'.

append f_ekko to f_ekko1.

f_ekko-fieldname = 'aedat'.

f_ekko-ref_tabname = 'ekko'.

f_ekko-ref_fieldname = 'aedat'.

append f_ekko to f_ekko1.

f_ekpo-fieldname = 'ebelp'.

f_ekpo-ref_tabname = 'ekpo'.

f_ekpo-ref_fieldname = 'ebelp'.

append f_ekpo to f_ekpo1.

f_ekpo-fieldname = 'matnr'.

f_ekpo-ref_tabname = 'ekpo'.

f_ekpo-ref_fieldname = 'matnr'.

append f_ekpo to f_ekpo1.

s_events-name = 'USER_COMMAND'.

s_events-form = 'VAL'.

append s_events to i_events.

endform.

*form val using user_command like sy-ucomm

form VAL using USER_COMMAND like sy-ucomm

sel type slis_selfield.

DATA:v_lifnr(10) type N,

v_ebeln(10) type N,

v_matnr(10) type C.

if sel-fieldname = 'lifnr'.

v_lifnr = sel-value.

select ebeln aedat from ekko into table jtab where lifnr = v_lifnr.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = user_command

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = f_ekko1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = i_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

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = jtab.

  • 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.

endif.

if sel-fieldname = 'ebeln'.

v_ebeln = sel-value.

select ebelp matnr from ekpo into table ktab where ebeln = v_ebeln.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'item details'

  • I_SELECTION = 'X'

  • I_ALLOW_NO_SELECTION =

  • I_ZEBRA = ' '

I_SCREEN_START_COLUMN = 10

I_SCREEN_START_LINE = 10

I_SCREEN_END_COLUMN = 27

I_SCREEN_END_LINE = 16

  • I_CHECKBOX_FIELDNAME =

  • I_LINEMARK_FIELDNAME =

  • I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'ekpo'

  • I_STRUCTURE_NAME =

IT_FIELDCAT = f_ekpo1

  • IT_EXCLUDING =

  • I_CALLBACK_PROGRAM =

  • I_CALLBACK_USER_COMMAND =

  • IS_PRIVATE =

IMPORTING

ES_SELFIELD = sel

  • E_EXIT =

TABLES

T_OUTTAB = ktab.

  • 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.

endif.

if sel-fieldname = 'matnr'.

v_matnr = sel-value.

set parameter id 'mat' field v_matnr.

call transaction 'mm02' and skip first screen.

endif.

11 REPLIES 11
Read only

Former Member
0 Likes
1,082

endform.

is also there

Read only

Former Member
0 Likes
1,082

Can you tell what the error actually is and on which line is it giving an error

Read only

0 Likes
1,082

message is

'contradictory call back routinues in interface and it_events'

Regards

Read only

Former Member
0 Likes
1,082

hi Ravi,

Seems that you have not populated the event table and passing the same for the list display ... please populate that and I think that the problem will be solved... I am attesting a piece of code.....

FORM Z8_EVENTCAT USING P_I_EVENTCAT TYPE SLIS_T_EVENT .

DATA:L_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = P_I_EVENTCAT

EXCEPTIONS

LIST_TYPE_WRONG = 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.

CLEAR L_EVENT.

READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_USER_COMMAND INTO L_EVENT.

IF SY-SUBRC = 0.

MOVE 'Z8_USER_COMMAND' TO L_EVENT-FORM.

APPEND L_EVENT TO P_I_EVENTCAT.

ENDIF.

CLEAR L_EVENT.

READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_PF_STATUS_SET INTO L_EVENT.

IF SY-SUBRC = 0.

MOVE 'SET_STATUS' TO L_EVENT-FORM.

APPEND L_EVENT TO P_I_EVENTCAT.

ENDIF.

ENDFORM. " Z8_EVENTCAT

This code takes the user command event in the events table that you are passing...

Actually before using the user command you have to populate the events table

Regards,

Jayant

Read only

Former Member
0 Likes
1,082

Hi,

Gotot se39 and debug it

Thanks

Read only

Former Member
0 Likes
1,082

first you adress the people................is it a test that u will reward............stop saying this statement 'Useful answer will be rewarded'.......this is site which help each other.....i think u are new to this site.......once if a peson see's your way of asking ,if he know's the answer also he will not reply.............adress the people first

Read only

0 Likes
1,082

thank you

Read only

0 Likes
1,082

h

Read only

0 Likes
1,082

that is also reflected to you, I knwo i am new to the forum or not,

Give the suggestion if any in a right way,

take care when ur giving advices.

there is no need of ur answer for me

Read only

Former Member
0 Likes
1,082

hi

in fieldcatalog write

f_lfa11[]

instead of f_lfa11

and see

Read only

0 Likes
1,082

Thank u,

problem resolved,

watch this thread

https://www.sdn.sap.com/irj/sdn/forums