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: 

Adding new object type (field BKPF-AWKEY) for BAPI posting

Former Member
0 Kudos

Hi everyone,

I am posting to SAP GL using an input file to read the data and transfer it to BKPF and BSEG tables.

The problem is I have to use BAPI_ACC_DOCUMENT_POST, and it expects values for OBJ_KEY and OBJ_TYPE.. For now, OBJ_TYPE creates a problem, because if I use BKPF, it says it cannot post using this object type, as it is for SAP internal use only.

Does anyone know how to add a new object type for the customer namespace, which can be manually used for this kind of posting? I know that the new entry must be made in tables TTYP, TTYPT, and possibly TTYPV, for which the maintainence view exists: V_TTYPV.

How to add an entry here, or where can I find it in customizing?

All helpful answers will be awarded.

Thank you very much

Srdjan

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Use BKPFF not BKPF (look at OSS [Note 561175 - BAPI posting in accounting with FI as reference|https://service.sap.com/sap/support/notes/561175])

Regards

3 REPLIES 3

Former Member
0 Kudos

perform fill_internal_tables.

if check_l = 'X'.

call function 'BAPI_ACC_DOCUMENT_CHECK'

destination dest

exporting

documentheader = gd_documentheader

customercpd = gd_customercpd

contractheader = gd_fica_hd

tables

accountgl = it_accountgl

accountreceivable = it_accountreceivable

accountpayable = it_accountpayable

accounttax = it_accounttax

  • currencyamount = it_currencyamount

criteria = it_criteria

valuefield = it_valuefield

extension1 = it_ext

return = it_return

paymentcard = it_paymentcard

contractitem = it_fica_it.

  • extension2 = it_ext2

  • realestate = it_re.

.

write: / 'Result of check lines:'. "#EC NOTEXT

perform show_messages.

endif.

if check_a = 'X'.

call function 'BAPI_ACC_DOCUMENT_CHECK'

destination dest

exporting

documentheader = gd_documentheader

customercpd = gd_customercpd

contractheader = gd_fica_hd

tables

accountgl = it_accountgl

accountreceivable = it_accountreceivable

accountpayable = it_accountpayable

accounttax = it_accounttax

currencyamount = it_currencyamount

criteria = it_criteria

valuefield = it_valuefield

extension1 = it_ext

return = it_return

paymentcard = it_paymentcard

contractitem = it_fica_it.

  • extension2 = it_ext2

  • realestate = it_re.

write: / 'Result of check all:'. "#EC NOTEXT

perform show_messages.

endif.

if post = 'X'.

data: l_type like gd_documentheader-obj_type,

l_key like gd_documentheader-obj_key,

l_sys like gd_documentheader-obj_sys.

if dest = space or

dest = gd_documentheader-obj_sys.

  • post synchron

call function 'BAPI_ACC_DOCUMENT_POST'

exporting

documentheader = gd_documentheader

customercpd = gd_customercpd

contractheader = gd_fica_hd

importing

obj_type = l_type

obj_key = l_key

obj_sys = l_sys

tables

accountgl = it_accountgl

accountreceivable = it_accountreceivable

accountpayable = it_accountpayable

accounttax = it_accounttax

currencyamount = it_currencyamount

criteria = it_criteria

valuefield = it_valuefield

extension1 = it_ext

return = it_return

paymentcard = it_paymentcard

contractitem = it_fica_it.

  • extension2 = it_ext2

  • realestate = it_re.

write: / 'Result of post:'. "#EC NOTEXT

perform show_messages.

else.

  • create Idoc

it_receivers-logsys = dest.

append it_receivers.

call function 'ALE_ACC_DOCUMENT_POST'

exporting

documentheader = gd_documentheader

customercpd = gd_customercpd

contractheader = gd_fica_hd

tables

accountgl = it_accountgl

accountreceivable = it_accountreceivable

accountpayable = it_accountpayable

accounttax = it_accounttax

currencyamount = it_currencyamount

criteria = it_criteria

valuefield = it_valuefield

extension1 = it_ext

paymentcard = it_paymentcard

contractitem = it_fica_it

  • extension2 = it_ext2

  • realestate = it_re

receivers = it_receivers

  • COMMUNICATION_DOCUMENTS =

  • APPLICATION_OBJECTS =

exceptions

error_creating_idocs = 1

others = 2 .

if sy-subrc = 0.

write: / 'IDoc created'. "#EC NOTEXT

else.

write: sy-msgid.

endif.

endif.

endif.

if rev_p = 'X' or rev_c = 'X'.

data: rev like bapiacrev,

rev_key like ref_key.

rev_key = ref_key.

rev_key(1) = 'R'.

rev-obj_type = gd_documentheader-obj_type.

rev-obj_key = rev_key.

rev-obj_sys = gd_documentheader-obj_sys.

rev-obj_key_r = ref_key.

if rev_c is initial.

if dest = space or

dest = gd_documentheader-obj_sys.

call function 'BAPI_ACC_DOCUMENT_REV_POST'

exporting

reversal = rev

bus_act = gd_documentheader-bus_act

tables

return = it_return.

else.

it_receivers-logsys = dest.

append it_receivers.

call function 'ALE_ACC_DOCUMENT_REV_POST'

exporting

reversal = rev

busact = gd_documentheader-bus_act

  • OBJ_TYPE = 'BUS6035'

  • SERIAL_ID = '0'

tables

receivers = it_receivers

  • COMMUNICATION_DOCUMENTS =

  • APPLICATION_OBJECTS =

exceptions

error_creating_idocs = 1

others = 2

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

write: / 'IDoc created'. "#EC NOTEXT

endif.

endif.

else.

call function 'BAPI_ACC_DOCUMENT_REV_CHECK'

exporting

reversal = rev

bus_act = gd_documentheader-bus_act

tables

return = it_return.

endif.

write: / 'Result of Reversal Posting:'. "#EC NOTEXT

perform show_messages.

endif.

commit work.

chk this

Give points if useful

raymond_giuseppi
Active Contributor
0 Kudos

Use BKPFF not BKPF (look at OSS [Note 561175 - BAPI posting in accounting with FI as reference|https://service.sap.com/sap/support/notes/561175])

Regards

0 Kudos

Thanks for your replies guys.

1. I didn't ask for the procedure on how to use the BAPI. I know how to do that, but thanks anyways.

2. BKPFF also didn't work, but I found how to create a new type. It is done through SM30, using the view that utilizes the table TTYP, along with it's text table TTYPT. The view is called V_TTYPV, and through SM30 it is allowed to make a new entry there - I used the correct naming conventions (Y* or Z*) and it solved my problem!

Regards,

SD.