03-15-2007 9:15 AM
The numbers of radiobutton is decided by the nubmer of entries of table SFLIGHT,
if table sflight has 20 records, then 20 radiobuttons should be displayed on the screen... Is there any advice?? thaks for your kind help in advance.
03-16-2007 2:46 AM
hi,
you can use the ALV Grid to implement it.
first ,you should define an internal table for alv output.including all the fileds you need and another field type c. for this field ,it has an attribute 'CHECKBOX'. if you set the value as 'X' ,the the column will be selected, otherwise if you set the value as SPACE, then the column will be unselected. the following is part of the coding for example:
DATA : gs_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
gs_fieldcat-col_pos = 2.
gs_fieldcat-fieldname = 'BOX'.
gs_fieldcat-seltext_l = 'delete.
gs_fieldcat-outputlen = 4.
gs_fieldcat-EDIT = 'X'.
gs_fieldcat-CHECKBOX = 'X' . "pay attention to this attribute
gs_fieldcat-fix_column = 'X'.
APPEND gs_fieldcat.
Regards
qiuguo
03-16-2007 2:21 AM
someone told me perhaps this could be changed to ALV grid. Any other advices? thaks again for your help.
03-16-2007 2:46 AM
hi,
you can use the ALV Grid to implement it.
first ,you should define an internal table for alv output.including all the fileds you need and another field type c. for this field ,it has an attribute 'CHECKBOX'. if you set the value as 'X' ,the the column will be selected, otherwise if you set the value as SPACE, then the column will be unselected. the following is part of the coding for example:
DATA : gs_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
gs_fieldcat-col_pos = 2.
gs_fieldcat-fieldname = 'BOX'.
gs_fieldcat-seltext_l = 'delete.
gs_fieldcat-outputlen = 4.
gs_fieldcat-EDIT = 'X'.
gs_fieldcat-CHECKBOX = 'X' . "pay attention to this attribute
gs_fieldcat-fix_column = 'X'.
APPEND gs_fieldcat.
Regards
qiuguo
03-16-2007 2:48 AM
Hi....
Just try the following code.....
it will despaly a checkbox for each record....
REPORT ZTEST.
TYPE-POOLS: SLIS.
DATA:
BEGIN OF FS_SFLIGHT,
CHECKBOX.
INCLUDE TYPE SFLIGHT.
DATA:END OF FS_SFLIGHT.
DATA:
T_SFLIGHT LIKE
STANDARD TABLE
OF FS_SFLIGHT.
DATA: T_LAYOUT TYPE SLIS_LAYOUT_ALV.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE T_SFLIGHT
FROM SFLIGHT.
T_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = T_LAYOUT
IT_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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = T_SFLIGHT
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.
Reward points is useful.......
Suresh......
03-16-2007 4:45 AM
Hi,
This is the sample report for dynamic alv report.
REPORT YMS_DYNAMICALV.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
build the dynamic internal table
perform build_dyn_itab.
write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
call the alv grid.
perform call_alv.
************************************************************************
Build_dyn_itab
************************************************************************
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields .
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
*********************************************************************
Form build_report
*********************************************************************
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
do p_flds times.
index = sy-index.
Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
<b> assign component index of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.</b>
enddo.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
************************************************************************
CALL_ALV
************************************************************************
form call_alv.
data: wa_cat like line of alv_fldcat.
do p_flds times.
clear wa_cat.
wa_cat-fieldname = sy-index.
wa_cat-seltext_s = sy-index.
wa_cat-outputlen = '5'.
append wa_cat to alv_fldcat.
enddo.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
endform.
Hope it will helps to u.
Thanks,
Shankar
03-16-2007 4:47 AM
Hi,
This is the sample report for dynamic alv report.
REPORT YMS_DYNAMICALV.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
build the dynamic internal table
perform build_dyn_itab.
write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
call the alv grid.
perform call_alv.
************************************************************************
Build_dyn_itab
************************************************************************
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields .
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
*********************************************************************
Form build_report
*********************************************************************
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
do p_flds times.
index = sy-index.
Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
<b> assign component index of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.</b>
enddo.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
************************************************************************
CALL_ALV
************************************************************************
form call_alv.
data: wa_cat like line of alv_fldcat.
do p_flds times.
clear wa_cat.
wa_cat-fieldname = sy-index.
wa_cat-seltext_s = sy-index.
wa_cat-outputlen = '5'.
append wa_cat to alv_fldcat.
enddo.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
endform.
Hope it will helps to u.
Thanks,
Shankar