Skip to Content
0

Error Changing Sales Order's NF Metal Data with BAPI_SALESORDER_CHANGE.

Jan 26, 2017 at 03:42 PM

60

avatar image

Hi, I want to change Sales Order NF Metal data with BAPI_SALESORDER_CHANGE. Some times program working good but some times giving an error.

Returning Error is "NF raw material charging in item & is errored, not possible to save". I want to change only 080 item but bapi looking all items and giving error on 050 item. I am giving my code. Please help solving problem.

SELECT * FROM /nfm/torderpos
            WHERE belnr EQ p_vbeln
              AND posnr EQ p_posnr.

    ls_nfm-doc_number   = p_vbeln.
    ls_nfm-itm_number   = p_posnr.
    ls_nfm-nfmkey       = /nfm/torderpos-nes. 
    l_nfm-compcode     = /nfm/torderpos-bukrs.
    ls_nfm-updtype      = 'U'.
    IF /nfm/torderpos-nfs IS INITIAL.
      ls_nfm-ratedetkey = p_fba.
    ELSE.
      ls_nfm-ratedetkey   = /nfm/torderpos-nfs.
    ENDIF.

    IF /nfm/torderpos-neb IS INITIAL.
      s_nfm-basekey = p_pbirim.
    ELSE.
      ls_nfm-basekey      = /nfm/torderpos-neb.
    ENDIF.

    IF /nfm/torderpos-bsl IS INITIAL.
      ls_nfm-exchangekey = p_borsa.
    ELSE.
      ls_nfm-exchangekey = /nfm/torderpos-bsl.
    ENDIF.
    ls_nfm-exchangekey  = /nfm/torderpos-bsl.
    ls_nfm-zztarih1     = p_tarih1.
    ls_nfm-zztarih2     = p_tarih2.
    APPEND ls_nfm TO lt_nfm.
  ENDSELECT.

  MOVE p_vbeln TO salesdocument.
  order_header_inx-updateflag = 'U'.
  APPEND order_header_inx.
 CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument               = salesdocument
      order_header_inx            = order_header_inx
    TABLES
      return                      = lt_return
      nfmetallitms                = lt_nfm.

  LOOP AT lt_return WHERE type EQ 'E' OR type EQ 'A'.
    lv_error = "Error".
    EXIT.
  ENDLOOP.
  IF sy-subrc NE 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait          = 'X'.
  ENDIF.

Thanks,

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

G Lakshmipathi
Jan 27, 2017 at 11:13 AM
0

You need to carry out coding corrections as recommended in OSS note 1592970

Share
10 |10000 characters needed characters left characters exceeded
wizz 007 Jan 27, 2017 at 12:38 PM
0

Hi Our software companent is not compatible.


companent.png (1.9 kB)
Share
10 |10000 characters needed characters left characters exceeded