2006 Jul 11 6:28 AM
Hi All,
i am doing ALV Interactive report.I have writen some code to execute customer transaction when i click customer number.but i am not getting please advice for that.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'KUNNR'.
READ TABLE ITAB INDEX rs_selfield-tabindex.
SET PARAMETER ID 'KUN' FIELD ITAB-KUNNR.
CALL TRANSACTION 'XD01' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. .
Hi All,
i am doing ALV Interactive report.I have writen some code to execute customer transaction when i click customer number.but i am not getting please advice for that.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'KUNNR'.
READ TABLE ITAB INDEX rs_selfield-tabindex.
SET PARAMETER ID 'KUN' FIELD ITAB-KUNNR.
CALL TRANSACTION 'XD01' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. .
2006 Jul 11 6:34 AM
Hi praveen,
1. The callback FORM seems to be ok.
2. Just check whether in debug mode,
the control comes here or not.
3. Also make sure while calling the FM,
u have passed the necessary parameters,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
4. To get a taste of it,
just copy paste in new program.
5.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
*----
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*----
CALL BACK FORM
*----
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
*----
IMPORTANT.
data : m(100) type c.
m = whatrow-tabindex.
condense m.
concatenate 'Row Number is ' m into m separated by space.
concatenate m ' : Field Clicked is ' whatrow-fieldname into m separated
by space.
message m type 'I'.
ENDFORM. "ITAB_user_command
regards,
amit m.
2006 Jul 11 6:36 AM
I think you have created a button for customer number.Assign any function code (FCODE) to this button in PF-STATUS and use this Function code here.
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'FCODE'.
READ TABLE i_out1 INTO wa_out1 INDEX rs_selfield-tabindex.
SET PARAMETER ID 'KUN' FIELD wa_out1-prueflos.
ENDIF.
CALL TRANSACTION 'XD01' AND SKIP FIRST SCREEN.
Pass this form name to the FM reuse_grid_alv_display for displaying ALV in the user command parameter
Message was edited by: mukesh kumar
2006 Jul 11 6:38 AM
Hi Kumar ,
u have to post ur code over here then only we can come to know where is the Problem.
How u are calling this Events in ALV FM ?
<b> call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = lv_repid
i_callback_user_command = 'Z_USER_COMMAND'
is_layout = fs_layo
it_fieldcat = fcat[]
i_default = 'X'
i_save = 'U'
it_events = fevents[]
tables
t_outtab = final[].</b>Regards
Prabhu
2006 Jul 11 6:43 AM
1. Check whether u gave FCODE correctly...and check whether u arebusing the same FCODE in the FORM.
2. Check in debug mode whether the cursor is coming to that case.
2006 Jul 11 6:47 AM
Hi,
Below is my example in one of my interactive ALV reports. Please check it out.
CASE p_ucomm.
WHEN '&IC1'.
IF p_selfield-fieldname = 'VBELN'.
SET PARAMETER ID 'AUN' FIELD p_selfield-value.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
Regards!
P.S. Please award points for useful answers.Thanks!
2006 Jul 11 6:44 AM
Hi,
XD01 requires more information other than customer number ( since XD01 is to CREATE CUSTOMER so it requires information like account group, sales area ). Call XD03 and you should be having no problem at all.
2006 Jul 11 8:09 AM
Hi Amith,
thanx for advice ok i under stood.But in my program i am not getting please check it send me feed back.
TYPE-POOLS : SLIS.
TABLES : KNA1.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR LIKE KNA1-KUNNR ,
NAME1 LIKE KNA1-NAME1,
LAND1 LIKE KNA1-LAND1,
END OF ITAB.
DATA : FIELD TYPE SLIS_T_FIELDCAT_ALV.
DATA : WFIELD TYPE SLIS_FIELDCAT_ALV.
DATA : HEADER TYPE SLIS_T_LISTHEADER.
DATA : WHEADER TYPE SLIS_LISTHEADER.
DATA : EVENT TYPE SLIS_T_EVENT.
DATA : WEVENT TYPE SLIS_ALV_EVENT.
DATA : REPID LIKE SY-REPID.
START-OF-SELECTION.
PERFORM GETDATA.
PERFORM DISPLAY.
PERFORM EVENTS.
FORM GETDATA.
SELECT KUNNR NAME1 LAND1 FROM KNA1 INTO TABLE ITAB UP TO 20 ROWS.
ENDFORM.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'KUNNR'.
READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
SET PARAMETER ID 'KUN' FIELD ITAB-KUNNR.
CALL TRANSACTION 'XD02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
FORM DISPLAY.
PERFORM FIELD.
CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE = '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 = FIELD
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE = 'X'
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVENT
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_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
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.
FORM FIELD.
WFIELD-FIELDNAME = 'KUNNR'.
WFIELD-reptext_ddic = 'CUSTOMER NUMBER'.
WFIELD-TABNAME = ITAB.
WFIELD-HOTSPOT = 'X'.
*WFIELD-KEY = 'X'.
*WFIELD-DO_SUM = 'X'.
*WFIELD-emphasize = 'C2'.
APPEND WFIELD TO FIELD.
WFIELD-FIELDNAME = 'NAME1'.
WFIELD-reptext_ddic = 'CUSTOMER NAME'.
WFIELD-TABNAME = ITAB.
APPEND WFIELD TO FIELD.
WFIELD-FIELDNAME = 'LAND1'.
WFIELD-REPTEXT_DDIC = 'CUSTOMER LAND'.
WFIELD-TABNAME = ITAB.
APPEND WFIELD TO FIELD.
ENDFORM.
FORM EVENTS.
WEVENT-FORM = 'TOP-OF-PAGE'.
WEVENT-NAME = 'TOP OF PAGE'.
APPEND WEVENT TO EVENT.
WEVENT-FORM = 'USER_COMMAND'.
WEVENT-NAME = 'USER COMMAND'.
APPEND WEVENT TO EVENT.
ENDFORM.
FORM TOP-OF-PAGE.
WHEADER-TYP = 'H'.
WHEADER-INFO = 'CUSTOMER DETAILS'.
APPEND WHEADER TO HEADER.
*WHEADER-TYP = 'S'.
*WHEADER-INFO = 'DATE'.
*
*APPEND WHEADER TO HEADER.
*
*WHEADER-TYP = 'A'.
*WHEADER-INFO = 'PRAVEEN'.
*
*APPEND WHEADER TO HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = HEADER.
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
*
*CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = EVENT.
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.
*
2006 Jul 11 8:19 AM
Hi Praveen,
you missed one thing set the PF-satus for Double click as &IC1 for F2 key.
for this do the following steps..
Go to SE41 give the Program name SAPLKKBL
and status as STANDARD
now click Copy status (CTRL+F6), now give your Program name , and PF-status and copy it. now save it and activate the pf-satus which you have copied. and use it in your PF-status form.don't forget to give &IC1 for F2key.
and try now....
report ztest_alv_check message-id zz .
type-pools: slis.
data: x_fieldcat type slis_fieldcat_alv,
it_fieldcat type slis_t_fieldcat_alv,
l_layout type slis_layout_alv.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of itab.
select vbeln
posnr
from vbap
up to 20 rows
into table itab.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
l_layout-zebra = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = l_layout
<b> i_callback_pf_status_set = 'STATUS'
i_callback_user_command = 'USER_COMMAND'</b>
it_fieldcat = it_fieldcat
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 status using p_extab type slis_t_extab.
*- Pf status
set pf-status 'STATUS' excluding p_extab.
endform. " STATUS
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'BACK' or 'CANC' or 'EXIT'.
leave to screen 0.
when '&IC1'.
if rs_selfield-fieldname = 'VBELN'.
set parameter id 'AUN' field rs_selfield-value.
call transaction 'VA03' and skip first screen.
endif.
endcase.
endform. "USER_COMMANDRegards
vijay
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |