11-12-2008 10:19 AM
When we create an internal order via KO01 the fields "Investment profile" and "Investment reason" on the Investments tab are mandatory fields. This leads to the following warning message:
"New order: System status requires an AuC"
and the system automatically opens the "Create asset: initial screen" screen.
We are now trying to do the same in a program, but how can I create an asset that is linked to this internal order? I already tried BAPI_FIXEDASSET_CREATE and INVEST_ASSET_MAINTENANCE but this does not seem to work.
Anybody who knows how to do this?
Kind regards,
Lieselot
11-12-2008 1:21 PM
I am now using:
KAUF_ORDER_CREATE
ASSET_MASTERRECORD_MAINTENANCE
KAUF_ORDER_STORE
KAUF_ORDER_SAVE
But only the first two functions end without errors, when I want to store the internal order the function KAUF_ORDER_STORE always gives an error.
Edited by: Lieselot Ver Eecke on Nov 12, 2008 4:03 PM
11-12-2008 1:21 PM
I am now using:
KAUF_ORDER_CREATE
ASSET_MASTERRECORD_MAINTENANCE
KAUF_ORDER_STORE
KAUF_ORDER_SAVE
But only the first two functions end without errors, when I want to store the internal order the function KAUF_ORDER_STORE always gives an error.
Edited by: Lieselot Ver Eecke on Nov 12, 2008 4:03 PM
11-12-2008 4:21 PM
I do not get an error message anymore, but after I executed all the functions the internal order nor the asset is saved.
What parameters do I need in KAUF_ORDER_SAVE and/or KAUF_ORDER_STORE to actually save the internal order and asset (and the link between both of them).
Kind regards,
Lieselot
11-14-2008 7:50 AM
We have found the solution ourselves:
CALL FUNCTION 'KAUF_ORDER_CREATE'
EXPORTING
i_auart = gv_auart
i_aufnr = p_aufnr2
* I_AUTYP_ERL = ' '
* I_DIALOG = ' '
* I_MATNR = ' '
* I_OREXT =
* I_REFNR = ' '
* I_SAVE_FLAG = ' '
* I_WERKS = ' '
* I_NEGLECT_FIELDSELECTION = ' '
IMPORTING
* E_AFKO =
* E_AFPO =
e_coas = wa_coas
e_kauf = wa_kauf
e_index = gv_index
EXCEPTIONS
foreign_lock = 1
order_type_not_valid = 2
reference_not_valid = 3
wrong_input = 4
no_number_range = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'INVEST_ASSET_MAINTENANCE'
EXPORTING
i_bukrs = p_bukrs
I_DATEN = wa_daten
I_DYNNR = '9001'
i_ivpro = scr_aufk-ivpro
i_objnr = wa_coas-objnr
* I_REPID = SYST-CPROG
i_trtyp = 'H'
* I_ASTKZ = ' '
i_modus = '4'
IMPORTING
E_PARM_FLAG = gv_parm_flag
E_FLG_CANCEL = gv_flg_cancel
EXCEPTIONS
BUKRS_FEHLT = 1
RW_OBJECT_FEHLT = 2
TRTYP_FALSCH = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'KAUF_ORDER_STORE'
EXPORTING
* I_AFKO = ' '
* I_AFPO = ' '
i_check = 'A'
i_coas = wa_coas
i_dialog = 'X'
i_kauf = wa_kauf
i_save_flag = 'X'
EXCEPTIONS
illegal_change = 1
order_not_in_buffer = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'KAUF_ORDER_SAVE'
EXPORTING
* I_DIALOG = ' '
i_index = gv_index
i_check = ' '
* I_TESTRUN = ' '
IMPORTING
* E_AUFNR =
e_coas = wa_coas
e_kauf = wa_kauf.
* E_AFKO =
* E_AFPO =
* E_COAS_OLD =
* E_SUBRC =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
.
04-16-2013 3:44 PM
Hi,
When I tried the above logic, error " Asset is not maintained for Capital investment" is returned for function module INVEST_ASSET_MAINTAINANCE.
Could you please tell why the error is coming and how to rectify?
Regards
Supriya