UPDATE NAST

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,
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.

Similar Messages

  • Reg:Updating NAST Table

    Hi Gurus,
    In my requirement i want to set  the data base field VSTAT as 1 in NAST table when the order is processed. I'm using UPDATE statement to update the database field but it does not work. i write the code like this
    update nast set vstat = 1
               where kappl     = 'EF' and
                         objky  = '5500000002'  and
                        kschl   = 'LEFT'.
    but it doesn't work fine sy-subrc set to 4. Is there any way to set the value of vstat as 1. Please help me.

    same here, you need to write your issue clearly. Why are you trying to update NAST. it contains the output from the transaction, why not letting it processed instead of doing something stupid bu updating in in the code. if you dont weant output to be processed remove the condition record.
    You would help yourself if you write the problem yiu are facing more clearly.  eg you are writing the code but where? which program ? user exit?  how  can one imagin what your issue is

  • Error updating NAST

    When trying to Process the In bound IDOC I am facing the error that "Error updating NAST"
    Could any one of you suggest me what are the conditions needs to be satisfied NAST table

    thx

  • FM to update NAST table

    hi ,
    Due to my specific requirements , I want to update Procesing status field in NAST table.
    Can u plz tell me da name of the FM to update that / any other way

    refer same thread...
    Re: Update NAST

  • Updating NAST values while saving Delivery

    Hi All,
    I am creating Inbound delivery using VL31N transaction while saving Inbound Delivery an output type
    is created with option '4. send imeediately'....' and '0 unprocessed' , but I need to change it to
    '3. Procees with transaction..' and '0 unprocessed' while saving, without changing the master using NACE
    is there any exit/badi by which I can change the values of NAST  i.e fields vztvp, vstat
    so that its bypass the nace setting for Output type.
    thanks
    tanmay

    Hi Anuradha,
    the condition record setting is ok, with processing mode like '4' send immediately,  but I have to to change the same in a routine I have created say 901 using tcode v/27 fro Inbound delivery and I want it to set to '3. Call with transaction' , but when I  am changing to 'Call with transaction' it automatically set again to 'send immediately' , the problem is how to change the same , Is there any method to do so.
    thanks
    tanmay

  • How NAST table is updated

    Hi,
    I have a sales order and I am generating billing document . for the same billing doument have a script form and conditional records
    Please let me know how the NAST table is updated and also how the field nast-vsztp is updated with the conditonal records for the billing documents
    if i have the conditional records How nast-vsztp is updated for a billing document .
    Thanks in advance
    Sudhakar

    Hi,
    The billing document generated with refrence of credimemo( sales order ) .Unable to put the messages.
    I maintained same customer grp3 . what conditional records contain . Still it is taking default value for the ouput type.
    Please let me know why the conditional records is not considering at all and why it is not updating NAST-VSZTP.
    Thanks in advance
    Sudhakar

  • NAST Table update

    HI
    We have around 200o invoice in which one specific output type called ZIDR is in process yellow state. We wanted to update it to green.
    Is there any utility program which updates NAST-VSTAT based on message type?
    Reg
    shan1242

    Hi Shan .,
       Program                                   Short description
       ASTBKF08                              Convert processing status single NAST
       NASTVF08                              Convert processing status single NAST
    if You need Function modules
    RV_MESSAGE_SET_PROCESS_STATE
    thanks
    Sreenivas Reddy
    Edited by: Sreenivas Reddy Dommata on Aug 21, 2008 10:56 AM

  • Duplicando registro tabela NAST após chamada J_1BNFE_CALL_RSNAST00

    Boa tarde pessoal,
    estava conversando com o Fernando nesta [Thread|; e resolvi abrir uma nova thread.
    Estava implementando a badi de impressão do danfe e notei um comportamento estranho.
    Após gerar uma NFe, é gerado um registro na NAST.
    Na sequencia, executo o FM J_1B_NFE_XML_IN para simular o aceite desta NFe, o que acarreta na chamada da badi de impressão e na minha badi tenho a chamada p/ o FM J_1BNFE_CALL_RSNAST00.
    Dentro deste FM, ele move alguns parâmetros de entrada para a NAST e chama o form einzelnachricht, que chama tnaprlesen_, optischearchivierung_, programmaufrufen_, protocolstore_ e finalmente o nastupdate_.
    Neste ponto do programa, a chave que tenho no header da tabela NAST é diferente da que já consta na tabela do bd.
    No BD tenho este registro na NAST:
    MANDT     321
    KAPPL     NF
    OBJKY     0003347752
    KSCHL     ZNFE
    SPRAS     E
    PARNR                                                                               
    PARVW                                                                               
    ERDAT     06/24/2009
    ERUHR     14:38:41
    e no programa, no form nastupdate_, tenho o header da NAST assim:
    MANDT
    KAPPL     NF
    OBJKY     0003347752
    KSCHL     ZNFE
    SPRAS     
    PARNR     
    PARVW     
    ERDAT     00000000
    ERUHR     000000
    Sendo assim, quando ele dá o update nast. ele dá sy-subrc = 4, e na sequencia, o código trata if sy-subrc ne 0, insert nast. Com isso tenho 2 registros na NAST pra mesma NF, um com o status VSTAT = 1, mas com o SPRAS/ERDAT/ERUHR não preenchidos e o outro, o "original", com tudo preenchido porém com o status VSTAT = 0.
    Olhando o Spool na SP01 eu vejo a NFe "impressa" apenas uma vez, o que está correto. Mas o que me incomoda é que ele acaba gerando registros duplicados.
    Segue meu código da BADI:
      IF  i_active-code EQ '100'         "NF-e autorizada
      AND i_active-printd IS INITIAL     "só imprimir automaticamente se ainda não foi impressa
      AND i_active-cancel IS INITIAL     "não faz sentido imprimir autom. se ela foi cancelada
      AND i_active-conting_s IS INITIAL. "não faz sentido imprimir autom. se ela foi alternada
                                         "p/conting. pois deverá ser cancelada
        CALL FUNCTION 'J_1BNFE_CALL_RSNAST00'
        EXPORTING
          I_ACTIVE = i_active
          I_DIMME  = 'X'
          I_PRINTER = vl_printer
        EXCEPTIONS
          no_printer = 1
          others = 2.
        COMMIT WORK.
        IF sy-subrc = 0.
          CALL FUNCTION 'J_1B_NFE_ERROR_PROTOKOLL'
          EXPORTING
            i_docnum = i_active-docnum.
        ENDIF.
      ENDIF.
    Para "resolver" esse pequeno problema (ao meu ver, não sei se está correto ou não este comportamento), criei um FM Z com o seguinte código:
    FUNCTION ZBR_J_1BNFE_CALL_RSNAST00.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_ACTIVE) TYPE  J_1BNFE_ACTIVE
    *"     VALUE(I_KAPPL) TYPE  NAST-KAPPL DEFAULT 'NF'
    *"     VALUE(I_NACHA) TYPE  NAST-NACHA DEFAULT '1'
    *"     VALUE(I_DIMME) TYPE  NAST-DIMME DEFAULT 'X'
    *"     VALUE(I_PRINTER) TYPE  RSPONAME OPTIONAL
    *"  EXCEPTIONS
    *"      PRINT_ERROR
    TABLES: nast.
    SELECT SINGLE *
        FROM nast
       WHERE kappl = i_kappl AND
             objky = i_active-docnum AND
             kschl = i_active-form AND
             nacha = i_nacha AND
             vstat = '0'.
    start printing
      nast-kappl = i_kappl.
      nast-objky = i_active-docnum.
      nast-kschl = i_active-form.
      nast-nacha = i_nacha.          "1 = print output
      "nast-ldest = i_printer.
      "nast-dimme = i_dimme.          "X = print immidiately
      PERFORM einzelnachricht IN PROGRAM rsnast00 USING sy-subrc.
      IF NOT sy-subrc IS INITIAL.
        MESSAGE i230(8b) with i_active-docnum RAISING print_error. "#EC *
      ENDIF.
    ENDFUNCTION.
    e na BADI, o chamei desta forma:
    CALL FUNCTION 'ZBR_J_1BNFE_CALL_RSNAST00'
        IN BACKGROUND TASK
        EXPORTING
          i_active = i_active
        EXCEPTIONS
          no_printer = 1
          others = 2.
    Desta maneira, não ocorreu a duplicação dos registros da NAST e a nota também foi impressa OK.
    A minha dúvida é se realmente o comportamento esperado utilizando o primeiro procedimento é duplicar o registro na NAST ou se pode ser que tenha algo errado no meu sistema(SAP_APPL 602 SP01) na hora da chamada da RSNAST00.

    parte 1
    Boa tarde pessoal,
    estava conversando com o Fernando nesta [Thread|; e resolvi abrir uma nova thread.
    Estava implementando a badi de impressão do danfe e notei um comportamento estranho.
    Após gerar uma NFe, é gerado um registro na NAST.
    Na sequencia, executo o FM J_1B_NFE_XML_IN para simular o aceite desta NFe, o que acarreta na chamada da badi de impressão e na minha badi tenho a chamada p/ o FM J_1BNFE_CALL_RSNAST00.
    Dentro deste FM, ele move alguns parâmetros de entrada para a NAST e chama o form einzelnachricht, que chama tnapr_lesen, optische_archivierung, programm_aufrufen, protocol_store e finalmente o nast_update.
    Neste ponto do programa, a chave que tenho no header da tabela NAST é diferente da que já consta na tabela do bd.
    No BD tenho este registro na NAST:
    MANDT     321
    KAPPL     NF
    OBJKY     0003347752
    KSCHL     ZNFE
    SPRAS     E
    PARNR                                                                               
    PARVW                                                                               
    ERDAT     06/24/2009
    ERUHR     14:38:41
    e no programa, no form nastupdate_, tenho o header da NAST assim:
    MANDT
    KAPPL     NF
    OBJKY     0003347752
    KSCHL     ZNFE
    SPRAS     
    PARNR     
    PARVW     
    ERDAT     00000000
    ERUHR     000000
    Sendo assim, quando ele dá o update nast. ele dá sy-subrc = 4, e na sequencia, o código trata if sy-subrc ne 0, insert nast. Com isso tenho 2 registros na NAST pra mesma NF, um com o status VSTAT = 1, mas com o SPRAS/ERDAT/ERUHR não preenchidos e o outro, o "original", com tudo preenchido porém com o status VSTAT = 0.
    Olhando o Spool na SP01 eu vejo a NFe "impressa" apenas uma vez, o que está correto. Mas o que me incomoda é que ele acaba gerando registros duplicados.
    continua
    Edited by: Jose Nunes on Jun 24, 2009 5:00 PM
    Edited by: Jose Nunes on Jun 24, 2009 5:01 PM

  • Processing log not getting updated for send immediatly

    Hi,
    I have a custom output type and a Custom function module for issueing the output for delivery, my prob is that it processing log is getting updated for the send in batch and other options but it is not getting updated for the SEND IMMEDIATLY, I am using the same FM for the Output issue I am checking if they have selected output type as 4 if yes, I am calling a FM in perform by saying
    PERFORM xxxxxxxx ON COMMIT
    and in the perform I am calling a FM
    CALL FUNCTION  xxxxxxxxx in BACKGROUND TASK  AS A SEPARATE TASK,
    the functioanlity of issueing the output is working but the Processing log is not getting updated.
    What might be the problem ? it is getting updated for  Send in batch but not for except 4.

    I am updating Log using this form
    at every step I am collecting the messages and passing them to this form.
    FORM update_nast_log  USING   p_msgid
                                  p_msgnr
                                  p_msgty
                                  p_msgv1
                                  p_msgv2
                                  p_msgv3
                                  p_msgv4.
    * Local data declaration
      DATA: lv_msgid LIKE sy-msgid,
            lv_msgnr LIKE sy-msgno,
            lv_msgty LIKE sy-msgty,
            lv_msgv1 LIKE sy-msgv1,
            lv_msgv2 LIKE sy-msgv2,
            lv_msgv3 LIKE sy-msgv3,
            lv_msgv4 LIKE sy-msgv4.
    * clear all the local variables
      CLEAR:lv_msgid,
            lv_msgnr,
            lv_msgty,
            lv_msgv1,
            lv_msgv2,
            lv_msgv3,
            lv_msgv4.
    * move message ID,number,msg type and the messsages
    *     to local variables
      MOVE: p_msgid TO lv_msgid,
            p_msgnr TO lv_msgnr,
            p_msgty TO lv_msgty,
            p_msgv1 TO lv_msgv1,
            p_msgv2 TO lv_msgv2,
            p_msgv3 TO lv_msgv3,
            p_msgv4 TO lv_msgv4.
    * Update nast table using nast protocol update
      CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
        EXPORTING
          msg_arbgb = lv_msgid
          msg_nr    = lv_msgnr
          msg_ty    = lv_msgty
          msg_v1    = lv_msgv1
          msg_v2    = lv_msgv2
          msg_v3    = lv_msgv3
          msg_v4    = lv_msgv4.
    ENDFORM.                    " UPDATE_NAST_LOG

  • IDOC number update in processing log

    Hi
    My problem is when I run VL02N, although it updates the NAST table with a record dynamically , it does not update NAST-CMFPNR field, hence I cannot find the updated idoc number in the processing log  acceding to NAST-OBJKY.It was showing previuos idoc number.
    Thanks

    Hello,
    Did you try to disable and then enabled CDC capture for the database? How about restart the SQL Server Agent?
    If the issue presists, please post the more information in the SQL Server error log file for further analysis.
    Regards,
    Fanny Liu

  • Follow-up action : please help - Inspection Lot related

    Hi,
    I am having the following trouble:
    Through MB02, a printout is generated to the local printer (LOCL).
    However, through QA11, when we save, we have a custom follow-up action attached that pops-up a
    dialog screen.
    The follow up action is triggered when a usage decision is changed for the inspection lot.
    The follow-up action (configured in IMG) calls a Function Module and a screen, which in turn populates
    a value into a custom DB table (based on the buttons, on the screen, sending either to LOCL or to a
    zebra printer).
    Now, what has to happen is that after inserting the value into a custom table, it should also open a sapscript and output.
    The Sapscript and print program are there, with the print program being created 3-4 years ago by someone
    else. However, even though we have code in the print program to update nast, in turn creating a message
    for output (1st the custom DB table is checked to see if the values match, MATNRCHARG), It does not update
    NAST. When we go through MB02, it does, but this should happen automatically after selecting one of the radio
    buttons on the original pop-up & selecting print.
    Please help. I don't know what to do and can't enable a debugger from the pop-up and if going though QA11,
    I can't get it to stop inside the print program (only inside the custom FM).
    Cheers,
    John

    hi
    kindly check whether this FM will work for you QFOA_OBJECT_STATUS_SET
    regards
    thyagarajan

  • How to configure default Printer Storage mode for specific user?

    Dear all,
    When we try to print something from the SAP, we can manually change the settings of the printing by clicking on the "Properties".
    Inside the "Properties", there is a "Ouput Options", extend it, and we can see a field called "Storage Mode". In my screen, by default it is always "Print Only".
    My question is, if the user A must to change the default to "Archive only", and this change only affect this user A, how can I do this ? O
    Thanks in advance.

    Eduardo,
    Could be a long shot, but in the interest of helping you ... maybe the following ...
    - get ABAPer to create a control table listing user
    - add code in RSNASTZZ that says if entry in control table, then update NAST-TDARMOD with '2'
    Let me know if this helps. If not please revert and will try again.
    Thanks,
    Jay

  • How to pop up error message when printing invoice / delivery note

    i have a problem that when I'm going to print the invoice (VF03), i have to check the field displayed e.g. port of loading, final destination should not be empty.If both are empty, when user is ready to print, then alert message is displayed (e.g. Please return to the invoice to fill in the port of loading / final destination) and is not allowed to print it out
    i'm using Zxxxxx program (including the subroutine)  and SAPScript form Zxxxxxx ,in the form, i use "PERFORM XXX IN PROGRAM ZXXXX" to call the parameter,so how can I do the alert message and stop the printing process and Do i write a checking subroutine in the program and perform that subroutine , so that when that required fields are empty, then show alert when printing?
    PLs advise

    Hi Sky,
    i wont suggest you to give a pop up as if you try and execute the invoice in background it would cause termination.
    Standard way of doing it is by updating nast entries. You can refer below mentioned pseudo code. You can also refer to any standard driver program & form attached to a output type for  more code.
    The below code would show your output condition in error status if your condition fails.
    **Do you validations in the print program and  check for return code.
      IF SY-SUBRC NE 0.
        PERFORM PROTOCOL_UPDATE.
        RETCODE = 1.
        EXIT.
      ENDIF.
          FORM PROTOCOL_UPDATE                                          *
          The messages are collected for the processing protocol.       *
    FORM PROTOCOL_UPDATE.
      CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
           EXPORTING
                MSG_ARBGB = SYST-MSGID
                MSG_NR    = SYST-MSGNO
                MSG_TY    = SYST-MSGTY
                MSG_V1    = SYST-MSGV1
                MSG_V2    = SYST-MSGV2
                MSG_V3    = SYST-MSGV3
                MSG_V4    = SYST-MSGV4
           EXCEPTIONS
                OTHERS    = 1.
    ENDFORM.
    Hope this Helps you.
    Sumit

  • VA21 quotation printing issue

    Hello!
    I have a little problem regarding transaction VA21. I'm using VA21 every day to create quotations. When I complete fulfilling all the data which is needed to complete a quotation I press the "SAVE" button. The quotation is saved.
    At the same time SAP sends an command to my printer to print the quotation. But sometimes I don't want to print these quotations. So I asked myself how to avoid printing the quotations immediately when I press the "SAVE" button?
    Thank you all for your help!

    Hi Fiosbb,
    you can achieve this by setting the return code in your form printing based on some validations to 999.
    if the return code is not zero the ouput condition ends in error and form is not printed. For user to know why it failed update the nast messages for this ou can refer any standard print programfor pseudo code..
    FORM entry USING return_code TYPE i
                     us_screen TYPE c.
    based on some validations set return code to 999.
    and then update nast messages.
    Endform

  • Send Scheduling Agreements as EDI to thirdparty

    Hello,
    We are trying to automate the process of sending the updated scheduling agreements if there are any differences in the validity range of the items. For this I need to trigger an EDI output from the program. I can directly call the routine RSNASTED routine after updating NAST entries but is there any standard way to trigger an EDI from the program ?
    Thanks in advance for your help.
    Regards,
    Pavan.

    Hi Jurgen,
    I have changed the Scheduling Agreement via BAPI_PO_CHANGE and it created another version for the scheduling agreement. Now we want to trigger an output type for this changed agreement which in turn generates the IDOC which needs to be sent for third party system.
    What do you mean by messages here ?

Maybe you are looking for

  • Problem with /etc/project in Solaris 10

    Bonjour, I need your help to understand and have project work correctly under Solaris 10. What seems to be prety straight forward on paper doesn't work at all for me and can't figure why so! Obviously I'm trying to make it work for an Oracle user. I

  • Does SAP create missing files TRACExx when starting up?

    Hi there, I'm working on a documentation regarding a system copy from a productive system to a consolidation system. We're using Sun Solaris 10/64Bit with Oracle 10g2 and Netweaver 7.00. In the directory /usr/sap/<SID>/DVEBMGS_xx/log there are severa

  • Backing up....syncing?

    I need some help, please. I'm returning a defective ipad and I will have to restore from a back up and I think I would prefer to back up from itunes because the last time I backed up from icloud it took more than 24 hours. I just synced to itunes at

  • Running Arch in Virtual Box --- Cannot expand resolution.

    I have ran the "xdpyinfo | grep dimensions" command on the virtual machine and got the output "dimensions 800x600 pixels (452x277 millimetres)" I then ran "xdpyinfo | grep "dots per inch" command inside the virtual machine and got the output "resolut

  • Linking music files from Windows Media Player to Itunes

    How do you link music between WMP (this is where I download my music) and ITunes without having to copy all the files so I don't need to use up hard drive space?