Application Development and Automation 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: 
Read only

update NAST

former_member582701
Contributor
0 Likes
3,812

Hi,

Have somebody any example code updating NAST table?

I have found in forum multiples results but there are not consensus in what FM you must use.

I have found

WFMC_MESSAGE_SINGLE

RV_MESSAGE_INSERT

NAST_SAVE_OBJECT

thx

6 REPLIES 6
Read only

Former Member
0 Likes
3,044

Hi,

Nast table holds the output types to be processed.

1) Hence any new document is created which is required to be processed by an output type, the entry automatically inserted into the NAST table.

2) If the existing document is reprocessed, again entry goes into the NAST table.

This is how nast table updates.

Regards,

Shahu

Read only

Former Member
0 Likes
3,044

Hi,

Please try this FM RV_MESSAGE_UPDATE_SINGLE to update table NAST.

Regards,

Ferry Lianto

Read only

former_member582701
Contributor
0 Likes
3,044

I think you only have read the title of the post but not the content.

I need update manually the table

Thx in any case.

Read only

Former Member
0 Likes
3,044

Hi Manel,

<b>RV_MESSAGE_UPDATE_SINGLE</b> function module will INSERT an entry to NAST table and You can give the requiered values to the structure <b>MSG_NAST</b>(Importing parameters).

Thanks,

Vinay

Read only

former_member582701
Contributor
0 Likes
3,044

ok, thx.

Seeing the code probably it will be satisfactory.

NAST = MSG_NAST.

UPDATE NAST.

IF SY-SUBRC NE 0.

INSERT NAST.

IF SY-SUBRC NE 0.

MESSAGE A013 WITH NAST-KAPPL NAST-OBJKY.

ENDIF.

ENDIF.

Do you have any example filling import strcuture?

Thx

Read only

Kartehiik
Explorer
0 Likes
2,754

Use this code for updating NAST from custom program 

* Data Declaration
DATA: ls_nast TYPE nast,
lv_msg_doc TYPE char50,
lv_vbeln TYPE vbeln_vl.
* Constants
CONSTANTS: lc_v2 TYPE char2 VALUE 'V2',
lc_nacha TYPE char1 VALUE '6',
lc_vsztp TYPE char1 VALUE '4',
lc_zld2 TYPE char4 VALUE 'ZLD2',
lc_01 TYPE na_anzal VALUE '01',
lc_vstat TYPE na_vstat VALUE '1',
lc_msid TYPE sy-msgid VALUE 'E0',
lc_msgno TYPE sy-msgno VALUE '045'.
* Clear
CLEAR: ls_nast, lv_msg_doc, lv_vbeln.
* Logic to update NAST for all deliveries
LOOP AT p_li_docid INTO DATA(ls_docid).
lv_vbeln = ls_docid-docno+25(10).
lv_msg_doc = lv_docnum.
CALL FUNCTION 'NAST_PROTOCOL_INITIALIZE'.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = lc_msid
msg_nr = lc_msgno
msg_ty = lc_s
msg_v1 = lv_msg_doc.
CALL FUNCTION 'NAST_PROTOCOL_STORE' ##FM_SUBRC_OK
IMPORTING
msg_cmfpnr = ls_nast-cmfpnr
EXCEPTIONS
no_protocol_update = 1
OTHERS = 2.
ls_nast-spras = sy-langu.
ls_nast-anzal = lc_01.
ls_nast-vstat = lc_vstat. "'1'.
ls_nast-usnam = sy-uname.
ls_nast-kappl = lc_v2.
ls_nast-objky = lv_vbeln.
ls_nast-kschl = lc_zld2.
ls_nast-parnr = p_ls_cust-kunnr.
ls_nast-parvw = lc_we.
ls_nast-erdat = sy-datum.
ls_nast-eruhr = sy-uzeit.
ls_nast-nacha = lc_nacha.
ls_nast-vsztp = lc_vsztp.
ls_nast-manue = abap_true.
ls_nast-datvr = sy-datum.
ls_nast-uhrvr = sy-uzeit.

CALL FUNCTION 'RV_MESSAGE_UPDATE_SINGLE'
EXPORTING
msg_nast = ls_nast.

CLEAR: ls_docid, ls_nast.
ENDLOOP.