04-18-2006 11:23 AM
hi,
i managed to display an internal table with this function , but now i want to select a line so i can collect more specific info, that i also want to display (also with this function)
is there an internal table that will be exported to the calling program with the selected line items where i could reprocess the data? or do i have to follow another way to collect and show the new data?
thx in advance,
04-18-2006 1:51 PM
Hi erik,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
<b>I_CALLBACK_PF_STATUS_SET = 'STATUS'</b>
<b>I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
* I_SCREEN_START_COLUMN = 10
* I_SCREEN_START_LINE = 1
* I_SCREEN_END_COLUMN = 50
* I_SCREEN_END_LINE = 20
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 double click and create and activate
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'.
"here you can show the selected rows.
endcase.
ENDFORM. "USER_COMMAND
or else you can do with normal Detail button which is there in tool bar,
Reagrds
vijay
04-18-2006 11:28 AM
Hello,
you have to put one checkbox in your table and
put in layout like,
f_layout-ctab_fname = 'CHK'. " CHK is field of ITAB
Whenever you tick the checkbox on the screen, system will update the CHK field of the ITAB.
Put your rest code in USER_COMMAND form.
Regards,
Naimesh
04-18-2006 11:53 AM
Hi,
You can do that with the Help of PF-status , Enable F2 (Give FCODE for F2 as PICK) , and activate it. then if you double click on a line it will automatically show the data in popup. or else click on Detail button(CTRLSHFTF3) by selecting the line. is that you are looking for or anything else..
Regards
Vijay
04-18-2006 1:26 PM
hi,
how do i enable this F2?
does it work this way?
I_CALLBACK_PF_STATUS_SET = 'F2'
do i also have to activate the user command?
I_CALLBACK_USER_COMMAND = ' '
regards,
Erik
04-18-2006 1:51 PM
Hi erik,
1. use CALL Back concept.
2. just copy paste in new program.
It will show alv grid of t001 table.
If you double-click on any row,
it will capture the details.
3.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_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
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
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.
READ TABLE itab INDEX whatrow-tabindex.
WRITE itab-bukrs.
break-point.
ENDFORM. "ITAB_user_command
regards,
amit m.
04-18-2006 1:51 PM
Hi erik,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
<b>I_CALLBACK_PF_STATUS_SET = 'STATUS'</b>
<b>I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
* I_SCREEN_START_COLUMN = 10
* I_SCREEN_START_LINE = 1
* I_SCREEN_END_COLUMN = 50
* I_SCREEN_END_LINE = 20
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 double click and create and activate
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'.
"here you can show the selected rows.
endcase.
ENDFORM. "USER_COMMAND
or else you can do with normal Detail button which is there in tool bar,
Reagrds
vijay
04-19-2006 9:53 AM
hi, i still didn't solve the problem,
i get an error each time the module user_command is called from sapslvscreen,
this is my code so far, i nothing can go wrong with it,
the set_status deactivates the standard buttons, but has no effect on the error,
what could go wrong?
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'.
"here you can show the selected rows.
endcase.
.
endform. "user_command
FORM f_output .
DATA:
lv_title TYPE lvc_title,
lv_repid LIKE sy-repid " Current program.
.
CONSTANTS:
c_alv_save VALUE 'A'.
PERFORM f_preparations_alv.
Initialization of local data.
lv_repid = 'ZCD_REP1011A_DISP_CUST_ACC'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
I_CALLBACK_PF_STATUS_SET = 'set_pf_status'
I_CALLBACK_USER_COMMAND = 'user_command'
04-19-2006 9:59 AM
Hi Eric,
Y=Try giving the user_command routine name in capital letters:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
<b>I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
REgards,
Ravi
04-19-2006 10:15 AM