2023 Feb 27 2:28 PM
If I delete multiple record s from a table how to add message for deleting multiple record.
Eg if I delete material no 1580, 1581,1582
It will show a status message that 'material no 1580,1581,1582 successfully deleted.How can I write kindly suggest. Thanks in advance
2023 Feb 28 4:46 PM
If you mean an internal table:
TYPES tt_mara TYPE TABLE OF mara WITH EMPTY KEY.
DATA(lt_mara) = VALUE tt_mara( ( matnr = '1580') ( matnr = '1581') ( matnr = '1582') ).
TYPES tt_matnr TYPE TABLE OF matnr WITH EMPTY KEY.
DATA(lt_matnr) = VALUE tt_matnr( ( '1580') ( '1581') ( '1582') ).
TYPES tt_matnr_range TYPE RANGE OF matnr.
DATA(lt_matnr_range) = VALUE tt_matnr_range( FOR <matnr> IN lt_matnr
( sign = 'I' option = 'EQ' low = <matnr> ) ).
DELETE lt_mara WHERE matnr IN lt_matnr_range.
IF sy-subrc = 0.
MESSAGE |Materials { concat_lines_of( table = lt_matnr sep = ',' ) } have been deleted.| TYPE 'S'.
ENDIF.
Where do you want to show this message? Are you sure you can display an unlimited message in case there are many materials deleted?
2023 Feb 28 12:58 PM
Hi,
You can use the MESSAGE statement in ABAP to display a message after deleting multiple records from a table.
MESSAGE 'Materials 1580, 1581, and 1582 have been deleted.' TYPE 'S'.
OR try to use BAPIRET2 and call the method cl_rmsl_message=>display( lt_bapiret2 ).
DATA: lt_bapiret2 TYPE STANDARD TABLE OF bapiret2,
ls_bapiret2 TYPE bapiret2.
* Check if some condition is met
IF some_condition.
ls_bapiret2-type = 'S'.
ls_bapiret2-id = 'MY_APP'.
ls_bapiret2-number = '001'.
ls_bapiret2-message = 'Materials has been deleted.'.
ls_bapiret2-MESSAGE_V1 = Mat1.
Append ls_bapiret2 to lt_bapiret2.
ls_bapiret2-MESSAGE_V1 = Mat2.
Append ls_bapiret2 to lt_bapiret2.
cl_rmsl_message=>display( lt_bapiret2 ).
2023 Mar 01 9:23 AM
2023 Feb 28 4:46 PM
If you mean an internal table:
TYPES tt_mara TYPE TABLE OF mara WITH EMPTY KEY.
DATA(lt_mara) = VALUE tt_mara( ( matnr = '1580') ( matnr = '1581') ( matnr = '1582') ).
TYPES tt_matnr TYPE TABLE OF matnr WITH EMPTY KEY.
DATA(lt_matnr) = VALUE tt_matnr( ( '1580') ( '1581') ( '1582') ).
TYPES tt_matnr_range TYPE RANGE OF matnr.
DATA(lt_matnr_range) = VALUE tt_matnr_range( FOR <matnr> IN lt_matnr
( sign = 'I' option = 'EQ' low = <matnr> ) ).
DELETE lt_mara WHERE matnr IN lt_matnr_range.
IF sy-subrc = 0.
MESSAGE |Materials { concat_lines_of( table = lt_matnr sep = ',' ) } have been deleted.| TYPE 'S'.
ENDIF.
2023 Mar 01 9:16 AM
2023 Mar 01 9:33 PM
To delete more records add corresponding keys to the table lt_matnr.
2023 Feb 28 6:15 PM
Where do you want to show this message? Are you sure you can display an unlimited message in case there are many materials deleted?
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |