Hi All,
I am using alv grid to print the out put. It is comming correct. I want to add check box before each line of out put. How can I do it?
And in the selection screen I want delivery block p_lifsk as '01' fixed, so that user cannot change the value.
Please help me.
Thanks
Veni.
PERFORM get_data. PERFORM PROCESS_data. perform sub_alv_routines. perform comment_build using t_list_top_of_page[]. g_repid = sy-repid. perform alv_build_fieldcat using 'IT_OUTPUT' g_repid. perform sub_call_alv_grid tables it_output.
Hi,
By pressing the Control button you can select more than rows...
Also it will be easy for you to handle if you are going to have additional buttons on the application toolbar..
For the selected rows..You can just use the following statements..
LOOP AT IT_OUTPUT WHERE CHECK = 'X'.
ENDLOOP.
If you are having a check box in the screen..And if you have additional buttons..It is not properly capturing the rows that are selected...I checked it..
Let me know if you have any questions..
Thanks,
Naren
add a field for the check box in the internal table and in the field catalog add a check box.
eg:
fcat_wa-col_pos = col_pos.
fcat_wa-fieldname = field.
fcat_wa-datatype = rtable.
fcat_wa-inttype = rinttype.
fcat_wa-outputlen = routputlength.
fcat_wa-decimals_out = rdecimal.
fcat_wa-seltext_l = rseltext.
fcat_wa-ref_tabname = rtable.
fcat_wa-key = key.
fcat_wa-checkbox = checkbox.
if you are updating the check box after the grid is created then dont forget to refresh the selected line
rs-refresh = 'X'
Hi,
In the internal table it_output have a field for the check box..
CHECK TYPE CHAR1,
After calling the FIELDCATALOG_MERGE function module..Modify the fieldcatalog internal table..
DATA: S_FIELDCATALOG type SLIS_T_FIELDCAT_ALV.
s_fieldcatalog-checkbox = 'X'.
MODIFY it_alv_field_cat from s_fieldcatalog
transporting checkbox
where fieldname = 'CHECK'.
Thanks,
Naren
Hi,
The changes are marked in bold..
form alv_build_fieldcat using lt_output l_repid.
<b>DATA: S_FIELDCATALOG type SLIS_T_FIELDCAT_ALV.</b>
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = l_repid
i_internal_tabname = lt_output
i_inclname = l_repid
changing
ct_fieldcat = s_fieldcatalog[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0. "something went wrong...
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
<b>s_fieldcatalog-checkbox = 'X'.
MODIFY it_alv_field_cat from s_fieldcatalog
transporting checkbox
where fieldname = 'CBOX'.</b>
endform. " ALV_BUILD_FIELDCAT
Hi,
Check this sample program..
TYPE-POOLS: slis.
DATA: BEGIN OF itab1 OCCURS 0,
check TYPE c,
vbeln LIKE vbep-vbeln,
posnr LIKE vbep-posnr,
END OF itab1.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'ITAB1'
i_inclname = v_repid
CHANGING
ct_fieldcat = t_fieldcatalog.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-checkbox = 'X'.
s_fieldcatalog-edit = 'X'.
MODIFY t_fieldcatalog FROM s_fieldcatalog
TRANSPORTING checkbox edit
WHERE fieldname = 'CHECK'.
DATA: s_layout TYPE slis_layout_alv.
SELECT vbeln posnr UP TO 10 ROWS
FROM vbep
INTO CORRESPONDING FIELDS OF TABLE itab1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = t_fieldcatalog
is_layout = s_layout
TABLES
t_outtab = itab1
EXCEPTIONS
program_error = 1
OTHERS = 2.
Thanks,
Naren
Hi,
In the internal table it_output use type c instead of type char1 for the field check..
DATA: Begin of IT_OUTPUT occurs 0,
<b> CHECK TYPE C,</b>
VBELN like LIKP-VBELN,
LFDAT like LIKP-LFDAT,
KUNNR like LIKP-KUNNR,
KNKLI LIKE LIKP-KNKLI,
NETWR like LIKP-NETWR,
End of IT_OUTPUT.
THanks,
Naren
Add a comment