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: 

Use of BAPI_ACC_MANUAL_ALLOC_POST

Former Member
0 Kudos

HI Experts

I am using a text file to upload records and then loop through these records and use BAPI_ACC_MANUAL_ALLOC_POST

to post the entries to KB15N my bapi works fine and post correctly but my problem is that there has a modification to

COEP we have added a custom ZField which appears also

on the KB15N and using this BAPI i dont know how to populate

these fields reading the documentation of the Bapi it says to use the custom fields structure to populate custom fields i have tried that with out any success if any one could please advise me how to use this customs fields and how to populate it so i could populate my z line item fields,

thanks you

3 REPLIES 3

former_member1167366
Participant
0 Kudos

hi zakaria,

i see that you have registred your problem with BAPI_ACC_MANUAL_ALLOC_POST at 12/6/07 (it means last year), i have the same problem as you, if you have resolved this pb, and if you still having it, can you send me your program that used this bapi, i will be very rewarding,

have a nice day,

thanks

0 Kudos

Hi

i did find the solution here is the code below, u need to put all ur zfileds in the customs fields as below underlined

doc_header-co_area = 'INJ'.

doc_header-variant = '03SAP'.

doc_header-doc_hdr_tx = 'INVOICE'.

doc_header-username = sy-uname.

doc_header-trans_curr = 'ZAR'.

append doc_header.

  • customer_fields-field1 = '0000'.

doc_items-itemno_acc = '0000000000'.

data: l_field(20).

loop at upload.

  • if upload-skostl co ' 123456789'.

shift upload-skostl right deleting trailing space.

overlay upload-skostl with '0000000000'.

shift upload-kstar right deleting trailing space.

overlay upload-kstar with '0000000000'.

modify upload.

doc_items-rec_order = upload-aufnr.

doc_items-send_cctr = upload-skostl.

doc_items-cost_elem = upload-kstar.

doc_items-value_tcur = upload-wtgbtr.

doc_items-quantity = upload-mbgbtr.

doc_items-postquun = 'H'.

doc_items-itemno_acc = doc_items-itemno_acc + 1.

  • doc_items-person_no = '00000000'.

doc_items-seg_text = upload-sgtxt.

append doc_items.

  • CLEAR doc_items.

count = count + 1.

clear: wtgbtr, mbgbtr.

  • For customs fields

concatenate docitems-itemno_acc upload-zpgrp into l_field._

shift customerfields-field1 left deleting leading space._

customerfields-field1 = l_field._

  • customer_fields-field3 = upload-zpgrp.

append customer_fields.

clear customer_fields.

clear l_field.

*Move 1 to quantity if it is blank

move upload-wtgbtr to wtgbtr.

if upload-mbgbtr = ''.

mbgbtr = 1.

else.

move upload-mbgbtr to mbgbtr.

endif.

endloop.

call function 'BAPI_ACC_MANUAL_ALLOC_POST'

exporting

doc_header = doc_header

importing

doc_no = doc_no

tables

doc_items = doc_items

return = return

customer_fields = customer_fields.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

if sy-subrc = 0.

if doc_no ne ' '.

message i000 with 'Standard Document Created' doc_no.

set parameter id 'BLN' field doc_no.

call transaction 'KB16N'

and skip first screen.

else.

message i000 with 'Document Could not Be Created' return-message.

endif.

endif.

0 Kudos

Hello Not Active Contributor

your solution works fine with one customer field in COEP. But now we want to add a second field to COEP and I'M trying to fill the new field on the same way. But it doesn't work until now.

Can you please give me a hint how to fill the second customer field in COEP using bapi 'BAPI_ACC_MANUAL_ALLOC_POST'?

Thank you

ingo