on 02-06-2008 5:11 AM
Hi,
what exactly we need to do inorder to generate ALV interactive report using usercommand? What I know is
use:
it_events type slis_t_events,
it_layout type slis_layout,
it_fieldcatalog type slis_t_fieldcatalog ( optional),
we have to populate the it_events table ,
from this table we have to extract user command form routine using 'slis_ev_usercommand' name.
we have to set pf status
and then we have to use user command.
are these steps right?
will be better if anyone explain with one example?
hi,
please go through this code.
REPORT ZSTEST_037 .
TABLES VBAK.
TYPE-POOLS SLIS.
*--ALV
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA I_KNA1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
ERNAM LIKE VBAK-ERNAM,
KUNNR LIKE VBAK-KUNNR,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
NETWR LIKE VBAP-NETWR,
END OF ITAB1.
SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.
START-OF-SELECTION.
SELECT VBELN
ERDAT
ERNAM
KUNNR FROM VBAK INTO TABLE ITAB WHERE VBELN IN S_VBELN.
END-OF-SELECTION.
*--1
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'Sal doc no'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-HOTSPOT = 'X'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--2
WA_FIELDCAT-FIELDNAME = 'ERDAT'.
WA_FIELDCAT-SELTEXT_L = 'Date'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--3
WA_FIELDCAT-FIELDNAME = 'ERNAM'.
WA_FIELDCAT-SELTEXT_L = 'Name'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--4
WA_FIELDCAT-FIELDNAME = 'KUNNR'.
WA_FIELDCAT-SELTEXT_L = 'Customer'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--LAYOUT
I_LAYOUT-ZEBRA = 'X'.
I_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = '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 = I_LAYOUT
IT_FIELDCAT = I_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
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 USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
L_SELTEXT TYPE SLIS_SELFIELD.
DATA L_VALUE(10) TYPE N.
IF L_UCOMM EQ '&IC1' or L_UCOMM EQ 'VBAP'.
CASE L_SELTEXT-FIELDNAME.
WHEN 'VBELN' .
L_VALUE = L_SELTEXT-VALUE.
SELECT VBELN
POSNR
MATNR
NETWR FROM VBAP INTO TABLE ITAB1
WHERE VBELN EQ L_VALUE.
REFRESH I_FIELDCAT.
*--1
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'Sal doc no'.
WA_FIELDCAT-KEY = 'X'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--2
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-SELTEXT_L = 'Item no'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--3
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_L = 'material no'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
*--4
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'Amount'.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
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 =
IT_FIELDCAT = I_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
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.
*********************************************
WHEN 'KUNNR'.
L_VALUE = L_SELTEXT-VALUE.
SELECT * FROM KNA1 INTO TABLE I_KNA1
WHERE KUNNR EQ L_VALUE.
REFRESH I_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
I_INTERNAL_TABNAME = 'I_KNA1'
I_STRUCTURE_NAME = 'KNA1'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = I_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
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 =
IT_FIELDCAT = I_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_KNA1
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.
ENDCASE.
ENDIF.
ENDFORM. "USER_COMMAND
&----
*& Form PF_STATUS
&----
text
----
-->SLIS_T_EXTAtext
----
FORM PF_STATUS USING SLIS_T_EXTAB.
SET PF-STATUS 'SSS'.
ENDFORM. "PF_STATUS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Mahaboob pathan,
u mean that there is no need to create pf - status for creating ALV interactive report, as we are using the standard function code '&lc1' for using the user command.
But u have mentioned that form of pf-status is to be used.I.e., u have created the pf-status SSS. What exactly we have to do there?
Generally we create our own function codes in classical interactive reports, shall we have to create the same thing in above mentioned pf-status SSS, obviously not, because we r using the standard function code '&lc1'. Please explain this.
Regards
khadeer.
Hi,
To write the user command no need to use reuse_alv_events_get function.
In the reuse_alv_grid_display or reuse_alv_list_display give the routine name for user command parameter. Usually user_command.
And also for pf status parameter give routine name as pf_status.
The syntax for the routine pf status is
form pf_status using slis_t_extab.
set pf-status 'STATUS'.
endform.
The syntax for user command is
form user_command using r_ucomm like sy-ucomm
r_selfield type slis_selfield.
case r_ucomm.
when 'DISP'.
write code.
when 'BACK'.
write code.
endcase.
endform.
regards,
kamala.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
u have to use this
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
L_SELTEXT TYPE SLIS_SELFIELD.
DATA L_VALUE(10) TYPE N.
IF L_UCOMM EQ '&IC1' or L_UCOMM EQ 'VBAP'.
CASE L_SELTEXT-FIELDNAME.
WHEN 'VBELN' .
L_VALUE = L_SELTEXT-VALUE.
after this witer select query for interactive list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Khader,
Follow the below steps for interactive report.
1. Get the data from db table into it_data
2. Fill the fieldcatalog table it_fieldcatlog
3. fill the events table it_events like as below
form event_builder using p_it_events1 type slis_t_event.
wa_events1-name = 'TOP_OF_PAGE'.
wa_events1-form = 'TOP_OF_PAGE_FOR_MARA'.
append wa_events1 to it_events1.
clear wa_events1.
wa_events1-name = 'USER_COMMAND'.
wa_events1-form = 'USER_COMMAND'.
append wa_events1 to it_events1.
clear wa_events1.
wa_events1-name = 'PF_STATUS_SET'.
wa_events1-form = 'PF_STATUS_FOR_MARA'.
append wa_events1 to it_events1.
clear wa_events1.
endform. " event_builder
4.Now fill the forms with proper code.example for user command form
Form USER_COMMAND using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
read table i_mara index rs_selfield-tabindex.
if sy-subrc = 0.
Perform get_marc_data.
Perform modify_fieldcat.
Perform event_build using it_events2[].
Perform header_build using it_listhead2[].
Perform Display_alv_data.
endif.
endcase.
endform.
5.Now call the ALV FM and populate events,fieldcatlog,data table. Upto now basic alv will display.
6. Now similarly fill all performs in user command form.
7. Then it will display seconadary report
8. Declarations are given below
it_fieldcat1 type slis_t_fieldcat_alv,
it_fieldcat2 type slis_t_fieldcat_alv,
it_events1 type slis_t_event,
it_events2 type slis_t_event,
wa_fieldcat1 type slis_fieldcat_alv,
wa_fieldcat2 type slis_fieldcat_alv,
wa_events1 type slis_alv_event,
wa_events2 type slis_alv_event,
it_listhead1 type slis_t_listheader,
it_listhead2 type slis_t_listheader,
r_ucomm like sy-ucomm,
g_ucomm like sy-ucomm.
Thanks,
Suma.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
at user command in when case use &IC1 for the interactive report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.