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 Member
0 Likes
1,828

Hi all, i'm using this coding to update nast table for Purchase Order .This coding is not working.

please help me to solve this problem.

Your help is greatly appreciated.

tables nast.

nast-MANDT = sy-mandt.

nast-KAPPL = 'EF'.

nast-OBJKY = '4100000477'.

nast-KSCHL = 'NEU'.

nast-SPRAS = sy-langu.

nast-PARNR = '0000100165'.

nast-PARVW = 'LF'.

nast-ERDAT = sy-datum.

nast-ERUHR = sy-uzeit.

nast-NACHA = '1'.

nast-ANZAL = '0'.

nast-VSZTP = '1'.

nast-MANUE = 'X'.

nast-USNAM = sy-UNAME.

nast-VSTAT = '0'.

nast-LDEST = 'HOIT'.

nast-TDID = 'BEWG'.

nast-TDSPRAS = sy-langu.

nast-NAUTO = 'X'.

nast-TDRECEIVER = sy-UNAME.

nast-TDCOVTITLE = 'New Purchase Order Printout'.

CALL FUNCTION 'NAST_SAVE_OBJECT'

EXPORTING

pi_nast = nast

PI_LINK_OBJECT = 'X'

PI_PROCESSING = 'X'

EXCEPTIONS

NOT_SAVED = 1

OTHERS = 2

.

IF sy-subrc <> 0.

write: / 'NOT SAVED'.

ELSE.

write: / 'SAVED'.

ENDIF.

IF sy-subrc = 0.

COMMIT WORK.

write / 'TABLE "NAST" WAS UPDATED'.

else.

rollback work.

write / 'TABLE "NAST" WAS NOT UPDATED'.

endif.

Hi all, i'm using this coding to update nast table for Purchase Order .This coding is not working.

please help me to solve this problem.

Your help is greatly appreciated.

tables nast.

nast-MANDT = sy-mandt.

nast-KAPPL = 'EF'.

nast-OBJKY = '4100000477'.

nast-KSCHL = 'NEU'.

nast-SPRAS = sy-langu.

nast-PARNR = '0000100165'.

nast-PARVW = 'LF'.

nast-ERDAT = sy-datum.

nast-ERUHR = sy-uzeit.

nast-NACHA = '1'.

nast-ANZAL = '0'.

nast-VSZTP = '1'.

nast-MANUE = 'X'.

nast-USNAM = sy-UNAME.

nast-VSTAT = '0'.

nast-LDEST = 'HOIT'.

nast-TDID = 'BEWG'.

nast-TDSPRAS = sy-langu.

nast-NAUTO = 'X'.

nast-TDRECEIVER = sy-UNAME.

nast-TDCOVTITLE = 'New Purchase Order Printout'.

CALL FUNCTION 'NAST_SAVE_OBJECT'

EXPORTING

pi_nast = nast

PI_LINK_OBJECT = 'X'

PI_PROCESSING = 'X'

EXCEPTIONS

NOT_SAVED = 1

OTHERS = 2

.

IF sy-subrc <> 0.

write: / 'NOT SAVED'.

ELSE.

write: / 'SAVED'.

ENDIF.

IF sy-subrc = 0.

COMMIT WORK.

write / 'TABLE "NAST" WAS UPDATED'.

else.

rollback work.

write / 'TABLE "NAST" WAS NOT UPDATED'.

endif.

7 REPLIES 7
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,322

Hi,

The following piece of coding should be changed as

IF sy-subrc <> 0.

write: / 'NOT SAVED'.

ELSE.

write: / 'SAVED'.

ENDIF.

IF sy-subrc = 0.

COMMIT WORK.

write / 'TABLE "NAST" WAS UPDATED'.

else.

rollback work.

write / 'TABLE "NAST" WAS NOT UPDATED'.

endif.

<u>Changed code:</u>

IF sy-subrc <> 0.

rollback work.

write / 'TABLE "NAST" WAS NOT UPDATED'.

ELSE.

COMMIT WORK.

write / 'TABLE "NAST" WAS UPDATED'.

ENDIF.

Read only

Former Member
0 Likes
1,322

still not working

Read only

0 Likes
1,322

When you say 'not working', does it mean, it is giving error or it is not updating NAST table.

Read only

Former Member
0 Likes
1,322

message displayed:

TABLE "NAST" WAS UPDATED

but not updated in database

Read only

0 Likes
1,322

I think you need to use NAST_MAIL_COMMIT which is used after this FM.

Read only

Former Member
0 Likes
1,322

can i use 'NAST_MAIL_COMMIT'

instead of 'NAST_SAVE_OBJECT' FM ?

Read only

0 Likes
1,322

No, you need to use NAST_MAIL_COMMIT after using NAST_SAVE_OBJECT