‎2009 Oct 21 5:33 PM
Hi,
I am posting data using 'BAPI_COSTACTPLN_POSTKEYFIGURE'.
As this is a plan data I want to overwrite the previous fiscal years data.. How should I do that?
out fiscal year started in october .now it is 2010.but it is not overwriting 2008 or 9 values..
LOOP AT lt_itemp INTO wa_itemp.
CLEAR:coobject,totvalue,indexstructure.
v_count = v_count + 1.
***Total Value Structure***
MOVE '1' TO wa_totvalue-value_index .
MOVE wa_itemp-statkeyfig TO wa_totvalue-statkeyfig .
MOVE wa_itemp-stat_qty TO wa_totvalue-stat_qty .
MOVE wa_itemp-stat_qty TO wa_totvalue-stat_qty_max .
MOVE '2' TO wa_totvalue-dist_key_quan .
MOVE '2' TO wa_totvalue-dist_key_quan_max .
APPEND wa_totvalue TO totvalue.
***Index Structure**
MOVE '1' TO wa_indexstructure-object_index .
MOVE '1' TO wa_indexstructure-value_index .
APPEND wa_indexstructure TO indexstructure.
**CO object Structure**
MOVE '1' TO wa_coobject-object_index .
MOVE wa_itemp-rec_wbs_el TO wa_coobject-wbs_element .
APPEND wa_coobject TO coobject.
clear wa_headerinfo.
wa_headerinfo-co_area = '1000'.
wa_headerinfo-fisc_year = v_fiscalyear.
wa_headerinfo-period_from = '1'.
wa_headerinfo-period_to = '12'.
wa_headerinfo-version = '000'.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
* ENDIF.
CALL FUNCTION 'BAPI_COSTACTPLN_POSTKEYFIGURE'
EXPORTING
headerinfo = wa_headerinfo
* DELTA = ' '
TABLES
indexstructure = indexstructure
coobject = coobject
* PERVALUE = PERVALUE
totvalue = totvalue
return = return.
IF sy-subrc IS INITIAL.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDLOOP.
‎2009 Oct 21 6:10 PM
Resolved myself .
just passed same contents and fiscalyear-1 , -2 and made quantities 0..
rgds
vara