* REPORT Z_SET_IDOC_DELETION_FLAG .
*
* Description: This program sets IDOC-status to '68' (Error - no further
* processing), so it won't be processed any longer or be
* seen in the status monitor for ALE messages.
* The relevant IDOC-number(s) is an input value for this
* action.
*
* Created by:
* Created at:
*
************************************************************************
* IDOC-Status values.
CONSTANTS: c_idoc_status_delete LIKE edi_ds-status VALUE '68'.
* tables
TABLES: edidc.
DATA: t_edidc LIKE edidc OCCURS 0 WITH HEADER LINE.
DATA: total_idocs TYPE i.
DATA: c_no(1) VALUE 'N'.
DATA: c_yes(1) VALUE 'J'.
DATA: textline1 TYPE string.
DATA: answer(1) TYPE c.
DATA: numbers(2) TYPE c.
* Selection-screen
SELECTION-SCREEN: BEGIN OF BLOCK selects WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_idocnr FOR edidc-docnum NO INTERVALS.
SELECTION-SCREEN: END OF BLOCK selects.
* Allow only multiple single values; no ranges in Selection-screen
TYPE-POOLS: sscr.
DATA: restrict TYPE sscr_restrict,
opt_list TYPE sscr_opt_list,
ass TYPE sscr_ass.
INITIALIZATION.
CLEAR opt_list.
MOVE: 'EQ' TO opt_list-name
, 'X' TO opt_list-options-eq.
APPEND opt_list TO restrict-opt_list_tab.
CLEAR ass.
MOVE: 'S' TO ass-kind
, 'S_IDOCNR' TO ass-name
, 'I' TO ass-sg_main
, ' ' TO ass-sg_addy
, 'EQ' TO ass-op_main
.
APPEND ass TO restrict-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = restrict.
START-OF-SELECTION.
CLEAR total_idocs.
LOOP AT s_idocnr.
total_idocs = total_idocs + 1.
* Check if Idoc-number exists..
SELECT SINGLE * FROM edidc AS h WHERE h~docnum EQ s_idocnr-low.
IF sy-dbcnt <> 0.
MOVE s_idocnr-low TO t_edidc-docnum.
APPEND t_edidc.
ELSE.
WRITE: /.
WRITE: / 'IDoc ',s_idocnr-low, ' does not exist.'.
ENDIF.
IF total_idocs > 0.
MOVE 'You selected $1 IDoc(s ) for deletion. Continue ?'
TO textline1.
MOVE total_idocs TO numbers.
REPLACE '$1' WITH numbers INTO textline1.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = c_no
textline1 = textline1
titel = text-003
IMPORTING
answer = answer.
IF answer <> c_yes.
EXIT.
ENDIF.
LOOP AT t_edidc.
* For every single existing idoc-number
PERFORM delete_idoc USING t_edidc-docnum.
IF sy-subrc <> 0.
WRITE: / 'An error occured while removing IDoc ', t_edidc-docnum, '
. please check the idoc-number and try again.'.
ELSE.
WRITE: / 'IDoc ',t_edidc-docnum, ' has been deleted.'.
ENDIF.
ENDLOOP.
*IF total_idocs > 0.
ENDIF.
*---------------------------------------------------------------------*
* --> PI_IDOC_NUMBER IDOC number *
*---------------------------------------------------------------------*
FORM delete_idoc USING pi_idoc_number LIKE edidc-docnum.
DATA: BEGIN OF t_idoc_status OCCURS 0.
INCLUDE STRUCTURE bdidocstat.
DATA: END OF t_idoc_status.
* Set IDOC's status to "ready for deletion".............................
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.