SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Delete Entries in NAST Table using RSCLNAST ABAP Program

To delete NAST entries in SAP system, developers can run RSCLNAST ABAP program. RSCLNAST enables to delete data from NAST table where output message status records are stored. ABAP report RSCLNAST provides a selection screen which enables SAP developer to choose the NAST entries to delete using output application, object key, output type (output message type), transmission medium of output message, etc. These selection criteria makes deleting output status records in NAST table easier.

Recently, I had to delete incorrectly processed output messages from productive SAP system. I experienced that using RSCLNAST ABAP report is very handy for the deletion of NAST entries that cause problems. Later on I had to trigger output determination procedure for creation of deleted NAST entries for billing documents (invoices) in our SD system. Now in this SAP tutorial, I want to show you how you can use RSCLNAST ABAP program in case you need to delete output messages in SAP.

Please note that this ABAP program is deletes entries in NAST table, so take care of consistency of your application before executing on your productive systems. RSCLNAST will delete output messages in NAST table without checking if they're processed correctly, or processed incorrectly or waiting in unprocessed status if they match the criteria you provide in selection screen.

Call transaction SE38 to activate ABAP Editor initial screen. Type the RSCLNAST ABAP report.

RSCLNAST ABAP program to delete NAST output messages

RSCLNAST is a standard ABAP report in SAP systems. We are now ready to execute and run ABAP program titled "Report for Deleting Output Status Records (Note Consistency)" by pressing F8

delete data from NAST ABAP table in SAP

Provide the required information to filter ABAP NAST table entries. This will enable us to delete NAST entries we want to remove from NAST table.

RSCLNAST select screen to delete NAST entries

As ABAP developers will realize, there are 3 options for the execution of RSCLNAST program. Normal deletion process,
Simulation only, no deletion,
Confirm each deletion options

Normal deletion process can be selected if you want to delete NAST entries or output messages matching with your filter criterias at once.
Confirm each deletion selection will request the executing SAP user's approval for each NAST record one by one before removing it from ABAP NAST table.
If you just want to test the report, choose the Simulation only option for a test run.

SAP SD output message deletion from NAST ABAP table

When DELETE process is approved the ABAP codes in CLEANSWEEP form routine is executed. I think is is useful to see the ABAP codes in this form routine

FORM CLEANSWEEP USING INAST STRUCTURE NAST.

DATA: TDNAME LIKE THEAD-TDNAME,
 L_MESSAGE TYPE SWC_OBJECT.
SWC_CONTAINER LT_CONTAINER.
* CLEAR PROTOCOL
IF NOT INAST-CMFPNR IS INITIAL.
 CALL FUNCTION 'NAST_PROTOCOL_DELETE'
  EXPORTING
   NR = INAST-CMFPNR
  EXCEPTIONS
   CALLED_WITHOUT_VALUES = 01.
ENDIF.
* clear mailtexts
TDNAME = INAST(66).
IF INAST-NACHA = '7'.
* delete object (where applicable)
 IF INAST-TDNAME NE SPACE.
  SWC_CREATE_OBJECT L_MESSAGE 'MESSAGE' INAST-TDNAME.
  SWC_CALL_METHOD L_MESSAGE 'Delete' LT_CONTAINER.
 ENDIF.
* delete mailtext
 CALL FUNCTION 'DELETE_TEXT'
  EXPORTING
* CLIENT = " SY-MANDT
   ID = 'BEWG'
   LANGUAGE = SY-LANGU
   NAME = TDNAME
   OBJECT = 'OCS'
   SAVEMODE_DIRECT = 'X'
* TEXTMEMORY_ONLY = " ' '
  EXCEPTIONS
   NOT_FOUND = 01.
ENDIF.
* CLEAR TABLE NAST
MOVE-CORRESPONDING INAST TO NAST.
DELETE NAST.

ENDFORM.
Code

If ABAP developers want to see all codes of the ABAP program RSCLNAST, they can display source codes in ABAP Editor using SAP transactions SE80 or SE38

delete output message NAST entries using ABAP program



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.