Application Development 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: 

Reg:Payment reference update for GL accounts using BAPI_ACC_DOCUMENT_POST

0 Kudos

Hi Experts,

I need to update payment reference for GL accounts using  BAPI  'BAPI_ACC_DOCUMENT_POST',

but i didnt find a field KIDNO in ACCOUNTGL.

Kindly help.

Regards,

Sami

11 REPLIES 11

Former Member
0 Kudos

Hi

You can use the extensions (EXTENSION1 or EXTENSION2):

- ENTENSION1 has to be managed by BTE  RWBAPI01

- EXTENSION2 has to be managed by BADI ACC_DOCUMENT (method CHANGE)

Max

former_member249399
Active Participant
0 Kudos

PAYMT_REF is availabe in ACCOUNTRECEIVABLE, Please check.

0 Kudos

Hi,

For ACCOUNTRECEIVABLE,it is available but for ACCOUNTGL I need.

0 Kudos

Hi

If a field is not available in the BAPI structure you need to use the extension in order to transfer it by yourself

Max

0 Kudos

Hi,

In extension2 of BAPI_ACC_DOCUMENT_POST ,to which field I need to pass payment reference.

0 Kudos

Hi

You need to create a your own structure where you insert the link with items and the values of missing fields.

The link will be the item number:


DATA: BEGIN OF MY_STRUCT,

              ITEMNO_ACC TYPE POSNR_ACC,

              KIDNO              TYPE BSEG-KIDNO,

              ..........................................................

            END    OF MY_STRUCT.

but it should be better to define the structure in dictionary too

While you fill the data of GL item, you fill the extension2 too:


MY_STRUCT-ITEMNO_ACC = ACCOUNTGL-ITEMNO_ACC.

MY_STRUCT-KIDNO            = <kidno>.

EXTENSION2-STRUCTURE  = 'MY_STRUCT'.

EXTENSION2+30                    = MY_STRUCT.

APPEND EXTENSION2.

So you can get the data from your structure and move them in accounting document by BADI


METHOD CHANGE.

   DATA: L_EXTENSION2 TYPE BAPIPAREX.

   DATA: L_ACCIT              TYPE ACCIT.

   LOOP AT C_EXTENSION2 INTO L_EXTENSION2

       CASE L_EXTENSION2-STRUCTURE,

            WHEN 'MY_STRUCT'.

                MOVE L_EXTENSION2+30 TO MY_STRUCT.

               

               READ TABLE C_ACCIT INTO L_ACCIT WITH KEY POSNR = MY_STRUCT-ITEMNO_ACC.

               MOVE MY_STRUCT-KIDNO TO L_ACCIT-KIDNO.

               ..................................................................................

ENDMETHOD.

Max

0 Kudos

Please check the documentation of the BAPI which clearly explains how to use EXTENSION parameters

0 Kudos

Hi,

From your code..

Can you confirm 'C_ACCIT'  is of what type and its corresponding table name in BAPI ...

0 Kudos

If you use EXTENSIONI2, you need to implement the BADI ACC_DCOUMENT, method CHANGE

C_ACCIT is the a parameter of that method, here there are all items will posted in the document, the ACCIT has all fields of BSEG: you have to transfer the values of your additional fields from extension

I mean C_ACCIT have all items from:

ACCOUNTGL

ACCOUNTRECEIVABLE

ACCOUNTPAYABLE

ACCOUNTTAX

Max

0 Kudos

Hi,

Implemented the same...and its working tooo ....Thanks

0 Kudos

Dear Max,

I have the similar request but to populate field BSEG-QBSHB, which is not in the  ACCIT structure, so cannot be passed through exension1 or extension2. any idea to populated this field?

For detail, please refer to my recent question: http://scn.sap.com/message/16075074#16075074


Many thanks and best Rewards.

Yuansheng