Hi Experts,
I need one small help,
my requirement is like this,
i will run a report the say i will get 50 records for the output, all those 50 records out should come with check box.
then i will select some lines (some check box from the output), and i need to press a push button in the output it self then those recors to be deleted.
Please help me on this..
thanks,
Suresh
Hi
Declare a single CHAR field in the Output Internal table as a first field and display the checkbox in the output.
then in the USER COMMAND event after selecting the some of the check boxes in a DO...ENDDO loop read the SY-LISEL field and capture that record if the check box is checked and move all those records into another internal table
and delete them from the output list
Regards
anji
.
<b>Hi Suresh,</b>
CHeckbox is possible (radio button not)
2. For that u declare ONE EXTRA FIELD
OF TYPE C (1 CHARACTER)
IN THE INTERNAL TABLE.
3. Then in layout ,
use layout-box_fieldname = 'FLAG'
(where flag is the field name of the extra field)
4. This will display checkboxes.
REPORT Z_TEST7 .
*Table declaration
tables: vbak,vbap.
*internal table
data: begin of i_sales occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
audat like vbak-audat,
kunnr like vbak-kunnr,
vkorg like vbak-vkorg,
matnr like vbap-matnr,
netpr like vbap-netpr,
check type c, "checkbox
end of i_sales.
type-pools: slis.
data: v_fieldcat type slis_fieldcat_alv,
gt_fieldcat type slis_t_fieldcat_alv,
gt_layout type slis_layout_alv,
gt_sort type slis_sortinfo_alv,
fieldcat like line of gt_fieldcat.
*Selection screen
parameters: p_vkorg like vbak-vkorg.
select-options: s_vbeln for vbak-vbeln.
*start of selection.
start-of-selection.
perform get_data.
perform fill_fieldcatalog.
perform write_data.
&----
*& Form get_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM get_data .
select avbeln aerdat aaudat akunnr avkorg bmatnr b~netpr into
corresponding fields of table i_sales from vbak
as a inner join vbap as b on avbeln = bvbeln
where a~vkorg = p_vkorg and
a~vbeln in s_vbeln.
ENDFORM. " get_data
&----
*& Form write_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM write_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = gt_layout
IT_FIELDCAT = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = i_sales
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.
ENDFORM. " write_data
&----
*& Form fill_fieldcatalog
&----
text
----
--> p1 text
<-- p2 text
----
FORM fill_fieldcatalog .
sort i_sales by vbeln.
clear v_fieldcat.
"for check box
v_fieldcat-col_pos = 1.
v_fieldcat-fieldname = 'CHECK'.
v_fieldcat-seltext_m = 'chek'.
v_fieldcat-checkbox = 'X'.
v_fieldcat-input = 'X'.
v_fieldcat-edit = 'X'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 2.
v_fieldcat-fieldname = 'VBELN'.
v_fieldcat-seltext_m = 'Sales Document'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 3.
v_fieldcat-fieldname = 'ERDAT'.
v_fieldcat-seltext_m = 'Creation Date'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 4.
v_fieldcat-fieldname = 'AUDAT'.
v_fieldcat-seltext_m = 'Document Date'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 5.
v_fieldcat-fieldname = 'KUNNR'.
v_fieldcat-seltext_m = 'Customer'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 6.
v_fieldcat-fieldname = 'VKORG'.
v_fieldcat-seltext_m = 'Sales Organization'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 7.
v_fieldcat-fieldname = 'MATNR'.
v_fieldcat-seltext_m = 'Material'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
v_fieldcat-col_pos = 8.
v_fieldcat-fieldname = 'NETPR'.
v_fieldcat-seltext_m = 'Net Value'.
append v_fieldcat to gt_fieldcat.
clear v_fieldcat.
endform.
Regards
SANTOSH K.
Check the following code...
DATA: BEGIN OF itab OCCURS 0,
check,
value(20),
END OF itab.
SET PF-STATUS 'TEST1'.
itab-value = 'ETSAT'.
APPEND itab.
itab-value = 'ETSATADSF'.
APPEND itab.
itab-value = 'ETSAT'.
APPEND itab.
LOOP AT itab.
WRITE: / itab-check AS CHECKBOX,
itab-value.
ENDLOOP.
AT USER-COMMAND.
DATA: wa LIKE itab.
DATA: itab_download LIKE itab OCCURS 0 WITH HEADER LINE.
IF sy-ucomm = 'DOWNLOAD'.
DESCRIBE TABLE itab.
DO sy-tfill TIMES.
READ LINE sy-index FIELD VALUE itab-check.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CHECK itab-check = 'X'.
itab_download-value = itab-value.
APPEND itab_download.
ENDDO.
DOWNLOAD
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:\TEST.XLS '
TABLES
data_tab = itab_download.
ENDIF.
REPORT ZREPORT_DELETE . TABLES: marav. DATA: BEGIN OF imat OCCURS 100, matnr LIKE marav-matnr, "Material number maktx LIKE marav-maktx, "Material short text END OF imat. DATA : pick. SELECT-OPTIONS: s_matnr FOR marav-matnr MATCHCODE OBJECT mat1. *---------------------------------------------------------------------* AT LINE-SELECTION. "Here I'm using AT line-slection event..in your program modify as AT USER COMMAND "because you are using push button DO. READ LINE sy-index FIELD VALUE pick imat-matnr. IF sy-subrc = 0. IF pick = 'X'. DELETE imat WHERE matnr EQ imat-matnr. ENDIF. ELSE. EXIT. ENDIF. ENDDO. PERFORM display_list. START-OF-SELECTION. * read data into table imat SELECT * FROM marav INTO CORRESPONDING FIELDS OF TABLE imat UP TO 100 ROWS WHERE matnr IN s_matnr. PERFORM display_list. *&---------------------------------------------------------------------* *& Form DISPLAY_LIST *&---------------------------------------------------------------------* FORM display_list. LOOP AT imat. WRITE :/ pick AS CHECKBOX, imat-matnr, imat-maktx. ENDLOOP. HIDE imat. ENDFORM. "DISPLAY_LIST
Add a comment