2008 Jul 07 1:45 PM
hi,
I have displayed alv grid. First column in the display is check box.Now when I check any of the check boxes, then I should write select statement in which ' where condition' is to be used.This I have written in user command.
That where condition is like this
case sy-ucomm.
when 'ISSUE'.
select -
from tab1
into tab2
where field1 eq slis_selfield .
now field1 is aufnr, But slis_selfield is check box.so how can I match. This is very urgent.
Rgds,
khadeer.
2008 Jul 08 7:22 AM
slis_selfield-tabindex will hold the row on which you check the checkbox.
use the index and get the AUFNR value from the internal table.
read table it_final index slis_selfield-tabindex.
select
from tab1
into tab2
where field1 eq it_final-aufnr .
hi,
I have displayed alv grid. First column in the display is check box.Now when I check any of the check boxes, then I should write select statement in which ' where condition' is to be used.This I have written in user command.
That where condition is like this
case sy-ucomm.
when 'ISSUE'.
select -
from tab1
into tab2
where field1 eq slis_selfield .
now field1 is aufnr, But slis_selfield is check box.so how can I match. This is very urgent.
Rgds,
khadeer.
2008 Jul 07 1:56 PM
Hi,
select
from tab1
into tab2
where field1 eq slis_selfield
and checkbox = 'X'..
checkbox is the first field name in your output table.
Regards,
kiran
2008 Jul 07 1:59 PM
If you are selecting one check box then use read table and then move the data into other workarea.
read table tablename with key check = check.
or if you are selecting multiple check box then use loop.
loop at itab where check = 'X'.
move itab to itab1.
append itab1.
endloop.
case sy-ucomm.
when 'ISSUE'.
select
-
from tab1
into tab2
where field1 eq slis_selfield . -> here use work area or internal table
now field1 is aufnr, But slis_selfield is check box.so how can I match. This is very urgent.
Thanks
Seshu
2008 Jul 07 2:01 PM
Hi Khadeer,
The value of the check box will either be 'X' or Space. So, do in the following way.
case sy-ucomm.
when 'ISSUE'.
select <field names>
from tab1
into tab2
where field1 eq 'X' .
Regards,
Swapna.
2008 Jul 07 2:02 PM
U cannot match it. U have to match aufnr with aufnr only then select will be successful. I think in ur ALV there should be onw field that contains the aufnr value. May be u can find the index from structure where slis_selfield belongs based on that index read the output table that u have passed to ALV and then find the aufnr value and then based on it select data.
Regards,
joy.
2008 Jul 07 2:05 PM
first from your select i got that uyou r useing select on internal table this is not possible.
in layout u will have BOX field fill that with the check box field name.
now use get selected row method. you will get all the records which r checked.
or
case sy-ucomm.
when 'ISSUE'.
loop at output table where slis_selfield = 'X'
pass the records to outher table itab.
endloop.
process the itab.
2008 Jul 08 7:16 AM
hi s.r.v.r kumar,
can u please be elaborate on 'what is get selected row method'.
rgds,
khadeer.
2008 Jul 08 7:22 AM
slis_selfield-tabindex will hold the row on which you check the checkbox.
use the index and get the AUFNR value from the internal table.
read table it_final index slis_selfield-tabindex.
select
from tab1
into tab2
where field1 eq it_final-aufnr .
2008 Jul 08 8:04 AM
hi vijay,
First Thanks for the reasonable reply. But onething is with read, only one row can be fetched. But in the present scenario any of the checkboxes can be selected. Then how can I get the aufnr of the corresponding.
If I do like this,
loop at itab1 into wa_itab1 where index slis_seltab-tabindex.
It says index is unknown field. Please suggest.
2008 Jul 08 8:08 AM
I mentioned the solution in the other thread you opened recently..
Check this..
You need use the Function moduel in the user command.
GET_GLOBALS_FROM_SLVC_FULLSCRfollow the sample code.
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,
X_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
CHK(1),
color(4),
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-HOTSPOT = 'X'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
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 = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-info_fieldname = 'COLOR'.
*L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
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
&---------------------------------------------------------------------
text
----------------------------------------------------------------------
-->P_EXTAB text
----------------------------------------------------------------------
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.
DATA: GD_REPID LIKE SY-REPID, "Exists
REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
ENDIF.
loop at itab where chk = 'X'.
itab-color = 'C300'.
modify itab index sy-tabix transporting color.
endloop.
RS_SELFIELD-refresh = 'X'.
break-point.
ENDFORM. "USER_COMMAND
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |