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

How to test BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
3,533

In FM BAPI_ACC_DOCUMENT_POST, one parameter is mandatory which is DOCUMENTHEADER having fields 6-7 mandatory fields out of which

OBJ_TYPE (Reference procedure)

OBJ_SYS (logical system)

OBJ_KEY

for these fields what will be valid field values?

I don't have valid values for these fields.

I intend to update BKPF table using this BAPI.

Any help will be highly appreciated.

Thanks

Prasad

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
1,417

Hi prasad,

chk this sample.

  • IF GL ACCOUNT

  • Accountgl / Compte générale

ws_accountgl-itemno_acc = w_compt.

ws_accountgl-comp_code = p_bukrs.

ws_accountgl-pstng_date = ws_reformat-datecpt.

ws_accountgl-fisc_year = ws_reformat-datecpt(4).

ws_accountgl-fis_period = ws_reformat-datecpt+4(2).

ws_accountgl-doc_type = p_blart.

ws_accountgl-item_text = ws_reformat-libel.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-cptclf

IMPORTING

output = ws_accountgl-gl_account.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-kostl

IMPORTING

output = ws_accountgl-costcenter.

ELSE. " ACC. PAYABLE

  • Account Payable / Compte fournisseur

ws_accountpayable-itemno_acc = w_compt.

ws_accountpayable-comp_code = p_bukrs.

ws_accountpayable-item_text = ws_reformat-libel.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-cptclf

IMPORTING

output = ws_accountpayable-vendor_no.

APPEND ws_accountpayable TO accountpayable.

ENDIF.

  • Currencyamount Struct.

ws_currencyamount-itemno_acc = w_compt.

ws_currencyamount-currency = 'EUR'.

  • ws_currencyamount-curr_type = '00'.

IF ws_reformat-sign EQ 'C'.

ws_reformat-wrbtr_c = ws_reformat-wrbtr_c * ( - 1 ).

ENDIF.

ws_currencyamount-amt_doccur = ws_reformat-wrbtr_c.

APPEND ws_currencyamount TO currencyamount.

  • BAPI

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = documentheader

TABLES

accountgl = accountgl

accountpayable = accountpayable

currencyamount = currencyamount

return = t_return.

IF sy-subrc <> 0.

MESSAGE e999(re) WITH 'Problem occured'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

rgds

anver

<b>if hlpful pls mark points</b>

Read only

0 Likes
1,417

Actually I wanted valid field values for fields

OBJ_SYS

OBJ_TYPE

OBJ_KEY.

Kindly reply if u have.

Thanks

Prasad

Read only

0 Likes
1,417

Hi,

did you got the solution or not??

iam also facing same problem.. what are the valid data for those parameters:

obj_type

obj_key

Naveen

Read only

Former Member
0 Likes
1,417

Hi,

Additional information.

Before ussing function module to post accoutning document.

Use this.

Pass same values here and you will come to know that information is proper and proper document will be generated or not. !!!!

BAPI_ACC_DOCUMENT_CHECK

If result is OK then go for BAPI_ACC_DOCUMENT_POST

  • Mark all helpful answers