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

update accounting record

Former Member
0 Likes
986

Hi !

can you helpe me to to solve this probleme , i want to modified assignment area and reference area

like that : MOVE ws_bseg-xref1 TO ws_accountgl-alloc_nmbr.

MOVE ws_bseg-xref1 TO ws_documentheader-ref_doc_no.

i use badi IF_EX_RERA_INVOICE~AFTER_STORE and bapi for update BAPI_ACC_GL_POSTING_POST can you tell me what bapi i can use.


LOOP AT it_invoice_item INTO ws_it_invoice_item .

    SELECT SINGLE * FROM  bkpf INTO   ws_bkpf WHERE
           bukrs = is_invoice-bukrs     AND
           belnr = ws_it_invoice_item-refdocid AND
           gjahr = is_invoice-fisc_year.

    IF sy-subrc = 0.

      REFRESH wt_bseg .

      SELECT * FROM bseg INTO ws_bseg
             WHERE bukrs = is_invoice-bukrs AND
                   belnr = ws_it_invoice_item-refdocid AND
                   gjahr = is_invoice-fisc_year  AND
                   buzei = ws_it_invoice_item-refitemno.

        IF sy-subrc = 0.

          MOVE ws_bseg-xref1 TO ws_accountgl-alloc_nmbr.
          MOVE ws_bseg-xref1 TO ws_documentheader-ref_doc_no.
          APPEND ws_bseg TO wt_bseg.
*        APPEND ws_accountgl TO wt_accountgl.

          CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
       EXPORTING
            documentheader = ws_documentheader
*     importing
*          obj_type       = obj_type
*          obj_key        = obj_key
*          obj_sys        = obj_sys
       TABLES
            accountgl      = wt_accountgl
*          currencyamount = currencyamount
            return         = wt_return.
*            extension1     = extension1
*       EXCEPTIONS
*            OTHERS         = 1.
*          IF sy-subrc <> 0.
          REFRESH: wt_accountgl, wt_return.

thanks.

Code Formatted by: Alvaro Tejada Galindo on Dec 23, 2008 10:27 AM

Hi !

can you helpe me to to solve this probleme , i want to modified assignment area and reference area

like that : MOVE ws_bseg-xref1 TO ws_accountgl-alloc_nmbr.

MOVE ws_bseg-xref1 TO ws_documentheader-ref_doc_no.

i use badi IF_EX_RERA_INVOICE~AFTER_STORE and bapi for update BAPI_ACC_GL_POSTING_POST can you tell me what bapi i can use.


LOOP AT it_invoice_item INTO ws_it_invoice_item .

    SELECT SINGLE * FROM  bkpf INTO   ws_bkpf WHERE
           bukrs = is_invoice-bukrs     AND
           belnr = ws_it_invoice_item-refdocid AND
           gjahr = is_invoice-fisc_year.

    IF sy-subrc = 0.

      REFRESH wt_bseg .

      SELECT * FROM bseg INTO ws_bseg
             WHERE bukrs = is_invoice-bukrs AND
                   belnr = ws_it_invoice_item-refdocid AND
                   gjahr = is_invoice-fisc_year  AND
                   buzei = ws_it_invoice_item-refitemno.

        IF sy-subrc = 0.

          MOVE ws_bseg-xref1 TO ws_accountgl-alloc_nmbr.
          MOVE ws_bseg-xref1 TO ws_documentheader-ref_doc_no.
          APPEND ws_bseg TO wt_bseg.
*        APPEND ws_accountgl TO wt_accountgl.

          CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
       EXPORTING
            documentheader = ws_documentheader
*     importing
*          obj_type       = obj_type
*          obj_key        = obj_key
*          obj_sys        = obj_sys
       TABLES
            accountgl      = wt_accountgl
*          currencyamount = currencyamount
            return         = wt_return.
*            extension1     = extension1
*       EXCEPTIONS
*            OTHERS         = 1.
*          IF sy-subrc <> 0.
          REFRESH: wt_accountgl, wt_return.

thanks.

Code Formatted by: Alvaro Tejada Galindo on Dec 23, 2008 10:27 AM

4 REPLIES 4
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
785

You're not supposed to modify the accounting documents like that... It might even be illegal.

If you need to transfer some data from SD Billing to Accounting, it has to be done in the corresponding user exits, not by modifying already created documents.

You can use transaction BAPI to search for BAPIs, but there is a reason you won't find any for changing the accounting documents.

Read only

0 Likes
785

Hi!

CAN YOU TO SOLVE THIS PROBLEM I USE BAPI_ACC_DOCUMENT_POST for update that does not function.I want that the three zones is identical for the accounting record zuonr = bkpf-xblnr =xref1

if possible to look at my program

  • wt_accountpayable TYPE TABLE OF bapiacap09,

  • wt_paymentcard TYPE TABLE OF bapiacpc09,

    • wt_currency TYPE TABLE OF bapiaccr09,

  • l_type TYPE bapiache09-obj_type,

  • l_key TYPE bapiache09-obj_key,

  • l_sys TYPE bapiache09-obj_sys.

DATA:

obj_type TYPE bapiache02-obj_type,

obj_key TYPE bapiache02-obj_key,

obj_sys TYPE bapiache02-obj_sys,

ws_documentheader TYPE bapiache08,

t_bapiache08 TYPE bapiache08,

wt_accountgl TYPE TABLE OF bapiacgl08,

ws_accountgl TYPE bapiacgl08,

wt_currencyamount TYPE TABLE OF bapiaccr08,

wt_return TYPE TABLE OF bapiret2,

extension1 TYPE bapiextc,

ws_it_invoice_item TYPE LINE OF re_t_invoice_item,

ws_bkpf TYPE bkpf,

ws_bseg TYPE bseg,

wt_bseg TYPE TABLE OF bseg,

l_type TYPE bapiache08-obj_type,

l_key TYPE bapiache08-obj_key,

l_sys TYPE bapiache08-obj_sys.

ws_documentheader-obj_type ='bkpff'.

ws_documentheader-obj_key = 'EUR '.

  • ws_documentheader-bus_act = 'RFBU'.

  • ws_documentheader-obj_sys = 'RD1CLNT200'.

ws_documentheader-pstng_date = sy-datum.

  • ws_documentheader-gl_account = '0000680106' .

ws_documentheader-doc_type = ''.

  • ws_documentheader-gl_account = '2008'.

ws_documentheader-fisc_year = '2008'.

ws_documentheader-username = sy-uname.

ws_documentheader-header_txt = 'Test using BAPI'.

ws_documentheader-comp_code = '1000'.

*accountgl-itemno_acc = '1'.

ws_accountgl-gl_account = '0000160100'.

ws_accountgl-comp_code = '1000'.

ws_accountgl-pstng_date = sy-datum.

ws_accountgl-doc_type = 'SA'.

ws_accountgl-profit_ctr = '0000010000'.

*append ws_accountgl.

  • BREAK-POINT.

  • pour chaque ligne facture l'on va chercher la piece comptable

LOOP AT it_invoice_item INTO ws_it_invoice_item .

SELECT SINGLE * FROM bkpf INTO ws_bkpf WHERE

bukrs = is_invoice-bukrs AND

belnr = ws_it_invoice_item-refdocid AND

waers = ws_it_invoice_item-CURRENCY and

gjahr = is_invoice-fisc_year.

IF sy-subrc = 0.

REFRESH wt_bseg .

SELECT SINGLE * FROM bseg INTO ws_bseg

WHERE bukrs = is_invoice-bukrs AND

  • hkont = IS_INVOICE-HKONT and

BELNR = ws_it_invoice_item-refdocid AND

  • WRBTR = ws_it_invoice_item-CURRENCY and

gjahr = is_invoice-fisc_year AND

buzei = ws_it_invoice_item-refitemno.

IF sy-subrc = 0.

MOVE ws_bseg-xref1 TO ws_accountgl-alloc_nmbr.

MOVE ws_bseg-xref1 TO ws_documentheader-ref_doc_no.

APPEND ws_bseg TO wt_bseg.

APPEND ws_accountgl TO wt_accountgl.

CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'

EXPORTING

documentheader = ws_documentheader

IMPORTING

obj_type = l_type

obj_key = l_key

obj_sys = l_sys

TABLES

accountgl = wt_accountgl

currencyamount = wt_currencyamount

return = wt_return

  • extension1 = extension1

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

ENDIF.

REFRESH: wt_accountgl, wt_return.

  • CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

  • EXPORTING

  • documentheader = ws_documentheader

*" CUSTOMERCPD =

*" CONTRACTHEADER =

    • IMPORTING

    • obj_type = l_type

    • obj_key = l_key

    • obj_sys = l_sys

  • TABLES

  • accountgl = wt_accountgl

  • accountreceivable = wt_accountreceivable

  • accountpayable = wt_accountpayable

**" ACCOUNTTAX =wt_accountax

  • currencyamount = wt_currency

**" CRITERIA =

**" VALUEFIELD =

**" EXTENSION1 =

  • return = wt_return.

**" PAYMENTCARD =

**" CONTRACTITEM =

**" EXTENSION2 =

**" REALESTATE =

**" ACCOUNTWT =

COMMIT WORK.

ENDIF.

  • ENDIF.

  • ENDSELECT.

ENDIF.

ENDLOOP.

*READ TABLE IT_bkpf WITH KEY belnr = IT_bkpf-belnr

*xblenr = IT_bkpf-belnr

*zuonr = IT_bkbf-belnr

*IF SY-SUBRC EQ 0.

*

*ENDIF.

ENDMETHOD.

Read only

Former Member
0 Likes
785

Hi!

I seek a bapi to update my zones :

bseg-xref1

bseg-zuonr

bkpf-xblnr

i use transaction fb03 and reraiv

thanks

Read only

0 Likes
785

As I've been trying to explain to you, the fields have to be populated during the creation of the accounting document, not after that.

You might want to try writing a BDC program to change the documents, but even in FB02 transaction the field BKPF-XBLNR usually can't be modified.