We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-dev] f-22 write off BAPI

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Posted by sapwes (Jack)
on Dec 30 at 2:14 PM
First a disclaimer, I'm not usually involved with FI, I have merely found a reference to this BAPI in our codebase that I know is functioning code.
ref doc is probably not important to your case.
I think you'll need to debug to see where the company code is being over-written or ignored.
wes

---------------Original Message---------------
From: dboyd
Sent: Thursday, December 30, 2010 10:04 AM
Subject: f-22 write off BAPI

Hello again.
I am converting a BDC for transaction F-22 write off by trying to use BAPI_ACC_DOCUMENT_POST. I am getting an error 'Cost center 1000/908800 does not exist on 12/30/2010'. I assume that 1000 is the company even though I explicitly am sending company code 2000 in the Bapi. 908800 is the cost center.
Attached is my test program that is erroring. Do you see something amiss?
Thank you again.
Debbie
REPORT Z_TEST_BAPI_ACC_DOCUMENT_POST2.
data:
l_type like bapiache09-obj_type,
l_key like bapiache09-obj_key,
l_sys like bapiache09-obj_sys,
obj_type like bapiache09-obj_type,
obj_key like bapiache09-obj_key,
obj_sys like bapiache09-obj_sys,
documentheader like bapiache09,
accountgl like bapiacgl09 occurs 0 with header line,
accountpayable like bapiacar09 occurs 0 with header line,
accountreceivable like bapiacar09 occurs 0 with header line,
currencyamount like bapiaccr09 occurs 0 with header line,
return like bapiret2 occurs 0 with header line,
extension1 like bapiextc occurs 0 with header line,
t_edidd like edidd occurs 0 with header line,
bapi_retn_info like bapiret2 occurs 0 with header line.
data: error_flag.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test BAPI CC number'.
documentheader-comp_code = '2000'.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = sy-datum.
documentheader-doc_type = 'DW'.
accountgl-itemno_acc = '2'.
accountgl-gl_account = 'C607060'.
accountgl-costcenter = '908800'.
append accountgl.
accountreceivable-itemno_acc = '1'.
accountreceivable-customer = '0006008665'.
append accountreceivable.
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '-75.00'.
append currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'USD'.
currencyamount-amt_doccur = '75.00'.
append currencyamount.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = documentheader
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
OBJ_TYPE = l_type
OBJ_KEY = l_key
OBJ_SYS = l_sys
tables
ACCOUNTGL = accountgl
ACCOUNTRECEIVABLE = accountreceivable
* ACCOUNTPAYABLE = accountpayable
* ACCOUNTTAX =
currencyamount = currencyamount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = return
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* ACCOUNTWT =
.
if sy-subrc <> 0.
write 'Problem occured'.
else.
loop at return.
if not return is initial.
clear bapi_retn_info.
move-corresponding return to bapi_retn_info.
if return-type = 'A' or return-type = 'E'.
error_flag = 'X'.
endif.
append bapi_retn_info.
endif.
endloop.
if error_flag = 'X'.
write 'Problem occured'.
rollback work.
else.
commit work.
endif.
endif.
.

__.____._
Copyright © 2010 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Mark as helpful
View this online
  
sapwes
SAP Development Helper

Posted helpful replies on 5 threads in a group to earn a Bronze Achievement
Most Popular White Papers

In the Spotlight
Toolbox.com Groups Discussions Now Support BBCode. Share Code Snippets with Peers
_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language