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

Error occuring while using BAPI BAPI_ACC_DOCUMENT_POST For F-02

Former Member
0 Likes
711

Hi all,

Please look at the below coding :

LOOP AT record INTO wa_record.

IF wa_record-newbs_010 NE '31'.

it_accountgl-itemno_acc = ser .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_record-newko_011

IMPORTING

output = wa_record-newko_011.

it_accountgl-gl_account = wa_record-newko_011.

CONDENSE it_accountgl-gl_account.

it_accountgl-item_text = wa_record-sgtxt_021.

CONDENSE it_accountgl-item_text.

  • it_accountgl-tax_code = 'V0'.

it_accountgl-bus_area = wa_record-gsber.

it_accountgl-comp_code = bukrs.

APPEND it_accountgl TO it_accountgl.

CLEAR it_accountgl.

ENDIF.

IF wa_record-newbs_010 EQ '31'.

it_cust-itemno_acc = ser.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = wa_record-newko_011

IMPORTING

output = wa_record-newko_011.

it_cust-customer = wa_record-newko_011.

CONDENSE it_cust-customer.

it_cust-comp_code = bukrs. (user input given as 9000)

it_cust-bus_area = wa_record-gsber.

it_cust-pmnttrms = wa_record-zterm_016.

it_cust-bline_date = wa_record-zfbdt_017.

it_cust-pymt_meth = wa_record-zlsch_019.

it_cust-businessplace = bukrs. (user input given as 9000)

it_cust-item_text = wa_record-sgtxt_021.

CONDENSE it_cust-item_text.

APPEND it_cust TO it_cust.

CLEAR it_cust.

ENDIF.

amount = wa_record-wrbtr_013.

it_currencyamount-itemno_acc = ser .

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'INR'.

it_currencyamount-amt_doccur = amount.

APPEND it_currencyamount TO it_currencyamount.

CLEAR it_currencyamount.

ser = ser + 1.

CLEAR it_accountgl.

CLEAR it_currencyamount.

CLEAR it_cust.

CLEAR amount.

ENDLOOP.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = gd_documentheader

TABLES

accountgl = it_accountgl

accountreceivable = it_cust

currencyamount = it_currencyamount

return = it_return.

structure of flat file :

DATA: BEGIN OF record OCCURS 20,

counter(5),

xblnr_007(016),

bktxt_008(025),

newbs_010(002),

newko_011(010),

newum_012(001),

wrbtr_013(016),

gsber(004), " Business Area

kostl(010),

prctr(010),

zterm_016(004),

zfbdt_017(010),

zlspr_018(001), "Payment Block Key

zlsch_019(001), "Payment Method

hbkid(005), "House Bank

sgtxt_021(050),

END OF record.

Flat File content : ( Just one sample record of customer)

1 Sal-NOV2006AAAA Salary forNOV of XXXX 31 111222 1000 9002 T086 30112008 J Sal for NOV2006SAMPLETEXT

*Error thrown :

*Customer 111222 is not defined in company code AAAA.

But while checking for vendor 111222 for plant AAAA using tcode XK03 , data exists.

What could be problem ?

Regards

Nagarajan

4 REPLIES 4
Read only

rob_postema
Participant
0 Likes
616

Ignore.

sorry, replied, but my answer did not make any sense.

so I removed the comment.

Edited by: Rob Postema on Feb 5, 2009 1:00 PM

Read only

former_member404244
Active Contributor
0 Likes
616

Hi,

U have checked for plant not for company code..check for company code and see..

Regards,

Nagaraj

Read only

former_member194797
Active Contributor
0 Likes
616

You are checking for a vendor but you are filling it_cust and the message is about customer ("Customer 111222 is not defined in company code AA").

Read only

Former Member
0 Likes
616

I have found that if valid data for a field in FI can be numeric or alphanumeric, then the fields in the BAPI's parameters must take this into acccount. I have found this impacts how data is validated.

For example, the BAPI's parameter table CRITERIA has field CRITERIA-CHARACTER which is CHAR18. The field being updated in COPA is 10 characters long, although valid values are only 5 characters. If the data to be passed is all numeric (eg. 12345), then I must put in 5 leading zeros and then the value (eg. 0000012345). If the data to be passed in alphanumeric (eg. C23X5), then the data is left justified (eg. C23X5_____).

Hope this helps.