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

Clearing Plan data before posting using BAPI

Former Member
0 Likes
649

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.

1 REPLY 1
Read only

Former Member
0 Likes
477

Resolved myself .

just passed same contents and fiscalyear-1 , -2 and made quantities 0..

rgds

vara