09-25-2008 6:58 AM
Hi all,
I need to prepare a BDC of transaction F-02 where the screens changed depending upon Gl accounts. As GL accounts are not fixed thus I am not able to record one. I have tried BAPIs also but they don't have posting key field, thus no success. Does any one have aly idea how can I transfer data using F-02 transaction screen?
Note : Special GL indicator is not used as it is not an advance payment. Some GL accounts require tax code also.
09-25-2008 9:54 AM
Hey,
Actually it is possible to specify posting key using BAPIs.
BAPI_ACC_GL_POSTING_POST uses User Exit thus giving the possibility to alter more fields than only those specified as parameters.
Use CMOD, prepare project for extension ACBAPI01 go to components you should have a function exit there(EXIT_SAPLACC4_001), activate it, dbl click on its name.
Inside you'll have information about tables passed to user exit(t_accit - posting data, extension - the table you fill inside your code) and 'INCLUDE ZXACCU15' piece of text.
Edit/create include ZXACCU15. It's the place where you put your own code handling posting details before they are actually posted.
data:
extension1 LIKE bapiextc
OCCURS 0 WITH HEADER LINE,
MOVE '1' TO extension1-field1. " this is row index
MOVE '50' TO extension1-field2. " this is posting key
APPEND extension1.
Inside ZXACCU15 use:
LOOP AT extension.
READ TABLE t_accit INDEX extension-field1. " read specified row
MOVE extension-field2 TO t_accit-bschl. " update posting key
MODIFY t_accit TRANSPORTING bschl.
ENDLOOP.
As User Exit might be called not only by your program, it is advisable to somehow mark the extension(eg. extension1-field3='BLAH') and check for 'BLAH' in UserExit so your code will only work with your program and leave other extensions alone.
Hope it helps a bit.
09-25-2008 9:54 AM
Hey,
Actually it is possible to specify posting key using BAPIs.
BAPI_ACC_GL_POSTING_POST uses User Exit thus giving the possibility to alter more fields than only those specified as parameters.
Use CMOD, prepare project for extension ACBAPI01 go to components you should have a function exit there(EXIT_SAPLACC4_001), activate it, dbl click on its name.
Inside you'll have information about tables passed to user exit(t_accit - posting data, extension - the table you fill inside your code) and 'INCLUDE ZXACCU15' piece of text.
Edit/create include ZXACCU15. It's the place where you put your own code handling posting details before they are actually posted.
data:
extension1 LIKE bapiextc
OCCURS 0 WITH HEADER LINE,
MOVE '1' TO extension1-field1. " this is row index
MOVE '50' TO extension1-field2. " this is posting key
APPEND extension1.
Inside ZXACCU15 use:
LOOP AT extension.
READ TABLE t_accit INDEX extension-field1. " read specified row
MOVE extension-field2 TO t_accit-bschl. " update posting key
MODIFY t_accit TRANSPORTING bschl.
ENDLOOP.
As User Exit might be called not only by your program, it is advisable to somehow mark the extension(eg. extension1-field3='BLAH') and check for 'BLAH' in UserExit so your code will only work with your program and leave other extensions alone.
Hope it helps a bit.
09-25-2008 10:04 AM
Hi,
Go with BDC you might have held with any mistake in your code.
Post the code so that if any mistake we will try to resolve.
Cheers!!
09-29-2008 12:19 PM
Hi BDC will not work for F-02
go with BAPI
I have used the following code for it
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = w_head
TABLES
accountgl = t_gl
currencyamount = t_cr
return = p_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
this has worked for me...
good luck