on 04-05-2006 3:13 PM
Hi Friends,
I have an ALV report. When it is executed, I have provided the user an option of picking multiple lines(output) and click on the the pushbuttons(this is a workflow report...there are 3 push buttons APPROVE, FORWARD and REJECT). When the user clicks on the APPROVE push button, I call a method to post the invoice. Once the invoice is posted, the user should not be able to pick this line again. How do I gray out this output line that way the user is not allowed to pick this line again. It could be multiple lines too..
Thanks
Hi,
set the PF-satus , for that use SE41 and copy some standard pf-status to your program and use it.
in double click event do what ever the processing and set the flag Processed, and then with the help of end_of_list grayout the check box. see the code.
REPORT ZTEST_ALV_GRAY .
type-pools: slis.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
check(1),
process(1),
end of itab.
data: it_fieldcat type slis_t_fieldcat_alv,
x_fieldcat type slis_fieldcat_alv,
x_events type slis_alv_event,
it_events type SLIS_T_EVENT.
x_events-NAME = SLIS_EV_END_OF_LIST.
x_events-FORM = 'END_OF_LIST'.
APPEND x_events TO iT_EVENTS.
CLEAR x_events .
select vbeln
posnr
into table itab
up to 100 rows
from vbap.
x_fieldcat-fieldname = 'CHECK'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-checkbox = 'X'.
x_fieldcat-input = 'X'.
x_fieldcat-edit = 'X'.
x_fieldcat-col_pos = 1.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
append x_fieldcat to it_fieldcat.
clear x_fieldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
it_events = it_events
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'.
ENDFORM. " STATUS
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
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'.
ITAB-PROCESS = 'X'.
"do what ever here....
modify itab index rs_selfield-tabindex transporting PROCESS.
endcase.
rs_selfield-refresh = 'X'.
ENDFORM. "USER_COMMAND
FORM END_OF_LIST.
data: l_vbeln like vbak-vbeln,
l_posnr like vbap-posnr,
l_index type sy-tabix.
DO 106 TIMES. "Here check your itab count and do that many times
CLEAR: L_VBELN, L_POSNR.
READ LINE SY-INDEX INDEX SY-LSIND
FIELD VALUE ITAB-VBELN INTO L_VBELN
ITAB-POSNR INTO L_POSNR .
"3lines are reserved for alv headings , so i am reading it form 4th line
"so 4th line is equal to 1st line of itab
IF SY-SUBRC = 0 AND SY-INDEX GE 4.
l_index = sy-index - 3.
READ TABLE ITAB INDEX l_index.
IF SY-SUBRC = 0 AND ITAB-PROCESS = 'X'.
*-Modifying current list
MODIFY LINE SY-INDEX INDEX SY-LSIND
FIELD FORMAT ITAB-CHECK INPUT OFF.
ENDIF.
ENDIF.
ENDDO.
ENDFORM.
Regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rachana,
1. for that purpose,
alv list (and not alv grid)
can server the purpose.
2. here also we have to use
the concept of BOX_FIEDLNAME
(for showing the CHECKBOX for selecting the row)
3. thru that, we can control,
whether the row is GREYED OUT
or is enabled for selecting thru checkbox.
4. But for that,
u will have to use USER_COMMAND (call back)
on pressing the button,
and change the internal table
field (for checkbox) accordingly.
5. just copyp paste this program
to have a taste of it.
(it will show all ODD rows as GREYED OUT
and all EVEN rows enabled for selection)
6.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0,
flag TYPE c.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
*----
Select
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.
.
data : rem type i.
*----
IMPORTANT.
LOOP AT itab.
rem = sy-tabix MOD 2.
IF rem = 1.
itab-flag = '0'.
ELSE.
ITAB-FLAG = ''.
ENDIF.
MODIFY itab.
ENDLOOP.
*----
alvly-box_fieldname = 'FLAG'.
*----
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
I think Rich is right..
you can delete that entry from your itab, or put a validation on that line for multiple selection.
Regards,
Naimesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think that you can do that sort of thing with ALV grid. You can either select any, or none.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.