Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABOUT NAST RSNAST00

Former Member
0 Kudos

Hi,

How ABOUT NAST RSNAST00 this are linked with ABAP Code?

Example if any?

Thanks

Avi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Check this one The simplest way to create IDocs, is to write an ABAP. The individual ABAP can either be a triggering ABAP which runs at certain events, e.g. every night, or it can be an ABAP which does the complete IDoc creation from scratch.

Triggering ABAP

A triggering ABAP would simply try to determine which IDocs need sending and call the appropriate IDoc creation routines.

ABAP creates the whole IDoc

You may also imagine the ABAP to do all the job. As this is mostly reinventing the wheel, it is not really recommended and should be reserved to situation, where the other solution do not provide an appropriate mean.

1.1 NAST Messages Based Outbound IDocs

You can use the R/3 message concept to trigger IDocs the same way as you trigger SAPscript printing.

One of the key tables in R/3 is the table NAST. This table records reminders written by applications. Those reminders are called messages.

Applications write messages to NAST, which will be processed by a message handler

Every time when an applications sees the necessity to pass information to a third party. a message is written to NAST. A message handler will eventually check the entries in the table and cause an appropriate action.

EDI uses the same mechanism as printing

The concept of NAST messages has originally been designed for triggering SAPscript printing. The very same mechanism is used for IDocs, where the IDoc processor replaces the print task, as an IDoc is only the paperless form of a printed document.

Condition technique can mostly be used

The messages are usually be created using the condition technique, a mechanism available to all major R/3 applications.

Printing, EDI and ALE use the same trigger

The conditions are set up the same way for any output media. So you may define a condition for printing a document and then just change the output media from printer to IDoc/EDI or ALE.

Figure 1: Communicating with message via table NAST

NAST messages are created by application by calling function module MESSAGING

Creating NAST messages is a standard functionality in most of the SAP core applications. Those applications - e.g. VA01, ME21 - perform calls to the central function module MESSAGING of group V61B. The function module uses customizing entries, mainly those of the tables T681* to T685*.

NAST contains object key, sender and receiver

A NAST output message is stored as a single record in the table NAST. The record stores all information that is necessary to create an IDoc. This includes mainly an object key to identify the processed object and application to the message handler and the sender and receiver information.

Programs RSNAST00 and RSNASTED provide versatile subroutines for NAST processing

The messages are typically processed by

FORM ENTRY in PROGRAM RSNAST00.

If we are dealing with printing or faxing and

FORM EDI_PROCESSING in PROGRAM RSNASTED.

If we are dealing with IDocs

FORM ALE_PROCESSING in PROGRAM RSNASTED.

If we are dealing with ALE.

The following piece of code does principally the same thing as RSNAST00 does and makes full use of all customizing settings for message handling.

FORM einzelnachricht IN PROGRAM RSNAST00

TABLES: NAST.

SELECT * FROM NAST ...

PERFORM einzelnachricht IN PROGRAM RSNAST00

Programs are customized in table TNAPR

The processing routine for the respective media and message is customized in the table TNAPR. This table records the name of a FORM routine, which processes the message for the chosen media and the name of an ABAP where this FORM is found.

1.2 The RSNAST00 ABAP

The ABAP RSNAST00 is the standard ABAP, which is used to collect unprocessed NAST message and to execute the assigned action.

RSNAST00 is the standard batch collector for messages

RSNAST00 can be executed as a collector batch run, that eventually looks for unprocessed IDocs. The usual way of doing that is to define a batch-run job with transaction SM37. This job has to be set for periodic processing and start a program that triggers the IDoc re-sending.

RSNAST00 processes only messages of a certain status

Cave! RSNAST00 will only look for IDocs which are set to NAST-VSZTP = '1' or '2' (Time of processing). VSZPT = '3' or '4' is ignored by RSNAST00.

For batch execution a selection variant is required

Start RSNAST00 in the foreground first and find the parameters that match your required selection criteria. Save them as a VARIANT and then define the periodic batch job using the variant.

If RSNAST00 does not meet 100% your needs you can create an own program similar to RSNAST00. The only requirement for this program are two steps:

  • Read the NAST entry to process into structure NAST

tables nast.

data: subrc like sy-subrc.....

select from NAST where .......

  • then call FORM einzelnachricht(rsnast00) to process the record

PERFORM einzelnachricht(rsnast00) USING subrc.

1.3 Sending IDocs Via RSNASTED

Standard R/3 provides you with powerful routines, to trigger, prepare and send out IDocs in a controlled way. There are only a few rare cases, where you do not want to send IDocs the standard way.

The ABAP RSNAST00 is the standard routine to send IDocs from entries in the message control. This program can be called directly, from a batch routine with variant or you can call the FORM einzelnachricht_screen(RSNAST00) from any other program, while having the structure NAST correctly filled with all necessary information.

RSNAST00 determines if it is IDoc or SAPscript etc.

If there is an entry in table NAST, RSNAST00 looks up the associated processing routine in table TNAPR. If it is to send an IDoc with standard means, this will usually be the routine RSNASTED(EDI_PROCESSING) or RSNASTED(ALE_PROCESSING) in the case of ALE distribution.

RSNASTED processes IDocs

RSNASTED itself determines the associated IDoc outbound function module, executes it to fill the EDIDx tables and passes the prepared IDoc to the port.

You can call the standard processing routines from any ABAP, by executing the following call to the routine. You only have to make sure that the structure NAST is declared with the tables statement in the calling routine and that you fill at least the key part and the routine (TNAPR) information before.

TABLES NAST.

NAST-MANDT = SY-MANDT.

NAST-KSCHL = 'ZEDIK'.

NAST-KAPPL = 'V1'.

NAST-OBJKY = '0012345678'.

NAST-PARNR = 'D012345678'.

PERFORM einzelnachricht_screen(RSNAST00).

Calling einzelnachricht_screen determines how the message is processed. If you want to force the IDoc-processing you can call it directly:

TNAPR-PROGN = ''.

TNAPR-ROUTN = 'ENTRY'.

PERFORM edi_processing(RSNASTED).

1.4 Sending IDocs Via RSNAST00

Here is the principle flow how RSNAST00 processes messages for IDocs.

Figure 2: Process logic of RSNAST00 ABAP

1.5 Workflow Based Outbound IDocs

Unfortunately, there are application that do not create messages. This is especially true for master data applications. However, most applications fire a workflow event during update, which can easily be used to trigger the IDoc distribution.

SWE_EVENT_CREATE

Many SAP R/3 applications issue a call to the function SWE_EVENT_CREATE during update. This function module ignites a simple workflow event.

Workflow is a call to a function module

Technically a workflow event is a timed call to a function module, which takes the issuing event as the key to process a subsequent action.

Applications with change documents always trigger workflow events

If an application writes regular change documents (ger.: Änderungsbelege) to the database, it will issue automatically a workflow event. This event is triggered from within the function CHANGEDOCUMENT_CLOSE. The change document workflow event is always triggered, independent of the case whether a change document is actually written.

Workflow coupling can be done by utility functions

In order to make use of the workflow for IDoc processing, you do not have to go through the cumbersome workflow design procedure as it is described in the workflow documentation. For the mentioned purpose, you can register the workflow handler from the menu, which says Event Coupling from the BALD transaction.

Workflow cannot easily be restarted

Triggering the IDoc from a workflow event has a disadvantage: if the IDoc has to be repeated for some reason, the event cannot be repeated easily. This is due to the nature of a workflow event, which is triggered usually from a precedent action. Therefore you have to find an own way how to make sure that the IDoc is actually generated, even in the case of an error. Practically this is not a very big problem for IDocs. In most cases the creation of the IDoc will always take place. If there is a problem, then the IDoc would be stored in the IDoc base with a respective status. It will shown in transaction WE05 and can be resend from there.</b>

Thanks

Manju

2 REPLIES 2

Former Member
0 Kudos

Hi

Check this one The simplest way to create IDocs, is to write an ABAP. The individual ABAP can either be a triggering ABAP which runs at certain events, e.g. every night, or it can be an ABAP which does the complete IDoc creation from scratch.

Triggering ABAP

A triggering ABAP would simply try to determine which IDocs need sending and call the appropriate IDoc creation routines.

ABAP creates the whole IDoc

You may also imagine the ABAP to do all the job. As this is mostly reinventing the wheel, it is not really recommended and should be reserved to situation, where the other solution do not provide an appropriate mean.

1.1 NAST Messages Based Outbound IDocs

You can use the R/3 message concept to trigger IDocs the same way as you trigger SAPscript printing.

One of the key tables in R/3 is the table NAST. This table records reminders written by applications. Those reminders are called messages.

Applications write messages to NAST, which will be processed by a message handler

Every time when an applications sees the necessity to pass information to a third party. a message is written to NAST. A message handler will eventually check the entries in the table and cause an appropriate action.

EDI uses the same mechanism as printing

The concept of NAST messages has originally been designed for triggering SAPscript printing. The very same mechanism is used for IDocs, where the IDoc processor replaces the print task, as an IDoc is only the paperless form of a printed document.

Condition technique can mostly be used

The messages are usually be created using the condition technique, a mechanism available to all major R/3 applications.

Printing, EDI and ALE use the same trigger

The conditions are set up the same way for any output media. So you may define a condition for printing a document and then just change the output media from printer to IDoc/EDI or ALE.

Figure 1: Communicating with message via table NAST

NAST messages are created by application by calling function module MESSAGING

Creating NAST messages is a standard functionality in most of the SAP core applications. Those applications - e.g. VA01, ME21 - perform calls to the central function module MESSAGING of group V61B. The function module uses customizing entries, mainly those of the tables T681* to T685*.

NAST contains object key, sender and receiver

A NAST output message is stored as a single record in the table NAST. The record stores all information that is necessary to create an IDoc. This includes mainly an object key to identify the processed object and application to the message handler and the sender and receiver information.

Programs RSNAST00 and RSNASTED provide versatile subroutines for NAST processing

The messages are typically processed by

FORM ENTRY in PROGRAM RSNAST00.

If we are dealing with printing or faxing and

FORM EDI_PROCESSING in PROGRAM RSNASTED.

If we are dealing with IDocs

FORM ALE_PROCESSING in PROGRAM RSNASTED.

If we are dealing with ALE.

The following piece of code does principally the same thing as RSNAST00 does and makes full use of all customizing settings for message handling.

FORM einzelnachricht IN PROGRAM RSNAST00

TABLES: NAST.

SELECT * FROM NAST ...

PERFORM einzelnachricht IN PROGRAM RSNAST00

Programs are customized in table TNAPR

The processing routine for the respective media and message is customized in the table TNAPR. This table records the name of a FORM routine, which processes the message for the chosen media and the name of an ABAP where this FORM is found.

1.2 The RSNAST00 ABAP

The ABAP RSNAST00 is the standard ABAP, which is used to collect unprocessed NAST message and to execute the assigned action.

RSNAST00 is the standard batch collector for messages

RSNAST00 can be executed as a collector batch run, that eventually looks for unprocessed IDocs. The usual way of doing that is to define a batch-run job with transaction SM37. This job has to be set for periodic processing and start a program that triggers the IDoc re-sending.

RSNAST00 processes only messages of a certain status

Cave! RSNAST00 will only look for IDocs which are set to NAST-VSZTP = '1' or '2' (Time of processing). VSZPT = '3' or '4' is ignored by RSNAST00.

For batch execution a selection variant is required

Start RSNAST00 in the foreground first and find the parameters that match your required selection criteria. Save them as a VARIANT and then define the periodic batch job using the variant.

If RSNAST00 does not meet 100% your needs you can create an own program similar to RSNAST00. The only requirement for this program are two steps:

  • Read the NAST entry to process into structure NAST

tables nast.

data: subrc like sy-subrc.....

select from NAST where .......

  • then call FORM einzelnachricht(rsnast00) to process the record

PERFORM einzelnachricht(rsnast00) USING subrc.

1.3 Sending IDocs Via RSNASTED

Standard R/3 provides you with powerful routines, to trigger, prepare and send out IDocs in a controlled way. There are only a few rare cases, where you do not want to send IDocs the standard way.

The ABAP RSNAST00 is the standard routine to send IDocs from entries in the message control. This program can be called directly, from a batch routine with variant or you can call the FORM einzelnachricht_screen(RSNAST00) from any other program, while having the structure NAST correctly filled with all necessary information.

RSNAST00 determines if it is IDoc or SAPscript etc.

If there is an entry in table NAST, RSNAST00 looks up the associated processing routine in table TNAPR. If it is to send an IDoc with standard means, this will usually be the routine RSNASTED(EDI_PROCESSING) or RSNASTED(ALE_PROCESSING) in the case of ALE distribution.

RSNASTED processes IDocs

RSNASTED itself determines the associated IDoc outbound function module, executes it to fill the EDIDx tables and passes the prepared IDoc to the port.

You can call the standard processing routines from any ABAP, by executing the following call to the routine. You only have to make sure that the structure NAST is declared with the tables statement in the calling routine and that you fill at least the key part and the routine (TNAPR) information before.

TABLES NAST.

NAST-MANDT = SY-MANDT.

NAST-KSCHL = 'ZEDIK'.

NAST-KAPPL = 'V1'.

NAST-OBJKY = '0012345678'.

NAST-PARNR = 'D012345678'.

PERFORM einzelnachricht_screen(RSNAST00).

Calling einzelnachricht_screen determines how the message is processed. If you want to force the IDoc-processing you can call it directly:

TNAPR-PROGN = ''.

TNAPR-ROUTN = 'ENTRY'.

PERFORM edi_processing(RSNASTED).

1.4 Sending IDocs Via RSNAST00

Here is the principle flow how RSNAST00 processes messages for IDocs.

Figure 2: Process logic of RSNAST00 ABAP

1.5 Workflow Based Outbound IDocs

Unfortunately, there are application that do not create messages. This is especially true for master data applications. However, most applications fire a workflow event during update, which can easily be used to trigger the IDoc distribution.

SWE_EVENT_CREATE

Many SAP R/3 applications issue a call to the function SWE_EVENT_CREATE during update. This function module ignites a simple workflow event.

Workflow is a call to a function module

Technically a workflow event is a timed call to a function module, which takes the issuing event as the key to process a subsequent action.

Applications with change documents always trigger workflow events

If an application writes regular change documents (ger.: Änderungsbelege) to the database, it will issue automatically a workflow event. This event is triggered from within the function CHANGEDOCUMENT_CLOSE. The change document workflow event is always triggered, independent of the case whether a change document is actually written.

Workflow coupling can be done by utility functions

In order to make use of the workflow for IDoc processing, you do not have to go through the cumbersome workflow design procedure as it is described in the workflow documentation. For the mentioned purpose, you can register the workflow handler from the menu, which says Event Coupling from the BALD transaction.

Workflow cannot easily be restarted

Triggering the IDoc from a workflow event has a disadvantage: if the IDoc has to be repeated for some reason, the event cannot be repeated easily. This is due to the nature of a workflow event, which is triggered usually from a precedent action. Therefore you have to find an own way how to make sure that the IDoc is actually generated, even in the case of an error. Practically this is not a very big problem for IDocs. In most cases the creation of the IDoc will always take place. If there is a problem, then the IDoc would be stored in the IDoc base with a respective status. It will shown in transaction WE05 and can be resend from there.</b>

Thanks

Manju

ferry_lianto
Active Contributor
0 Kudos

Hi,

Program RSNAST00 is used to issue an output type such as IDoc.

In order to use this program, you need to setup condition for output control using transaction NACE.

Regards,

Ferry Lianto