‎2008 Dec 16 9:05 AM
Hi,
I am uploading data from a flat file using BAPI to upload customer gl accounts.
The Posting Key ( BSCHL ) mentioned in the flat file is 01 ( for invoice ) , but when it is posted , in FB02 i am seeing it as 11 ( credit memo ).
i checked all the data passed on to the BAPI. it is "01" .
What could be the reason for this ?
Can any one help me in this?
Vikki.
‎2008 Dec 16 9:21 AM
hi
you can check these bapi's
BAPI_ACC_DOCUMENT_POST
BAPI_ACC_GL_POSTING_POST.
Also check for this fm FI_ITEMS_MASS_CHANGE
hope this helps
regards
Aakash Banga
‎2008 Dec 16 9:25 AM
hi ,
I am using the BAPI_ACC_DOCUMENT_POST to post the customer gl accounts.
I want to know why just the POSTING KEY is changing .
Vikki.
‎2008 Dec 16 9:24 AM
check with your functional people, based on the document type , company code and Account or Matchcode for the Next Line Item the posting key will be changed in FB02.....
‎2008 Dec 16 1:09 PM
Hi ,
I solved this problem. it was happening because of the negative sign i gave for Customer.
Thank you all for the reply.
And i have another doubt.
By passing MWSKZ ( Posting key ) to the EXTENSION1 or EXTENSION2 , can we get the -1 negative or positive signs for the amounts in the document.
Is it possible to do it.
this is my code for populating the EXTENSION1 and 2.
DATA : IT_TES TYPE STANDARD TABLE OF ACCIT WITH HEADER LINE.
IT_TES-POSNR = V_ITEM.
IT_TES-MWSKZ = IT_ITEM-MWSKZ.
MOVE IT_TES-POSNR TO IT_EXTENSION2-VALUEPART1(10). "#EC ENHOK
MOVE IT_TES-MWSKZ TO IT_EXTENSION2-VALUEPART1+10(2). "#EC ENHOK
APPEND IT_EXTENSION2.
IT_EXTENSION1-FIELD1(10) = V_ITEM.
IT_EXTENSION1-FIELD1+10(2) = IT_ITEM-MWSKZ.
APPEND IT_EXTENSION1.
But this doesnt work .
Unless i give the negative sign or positive sign for the AMOUNT fields for calculation, it throws error.
Has anyone used this EXTENSION1 and EXTENSION2 to pass the Posting key , to get the negative / postive signs automatically?
Vikki.
‎2008 Dec 16 1:16 PM
Hi
MWSKZ is not a posting key, but it's a condition (for the tax).
The BAPI decides automatically the posting key to be assigned to an item in order to:
- the sign of the amount,
- the kind of the item (vendor, customer or g/l account)
U can check how the BAPI decided which posting key has to be used in include LACC9F20, form fill_acct_key.
Max
‎2008 Dec 16 2:33 PM
Hi Max,
I debugged the BAPI. and went thro the subroutine FILL_ACC_TYPE.
in this subroutine, it is assigning the BSCHL.
I am not able to find out where in the BAPI it decides the SIGN of the AMOUNT.
Can you guide me .
My requirement is to pass on the POSTING KEY to the BAPI EXTENSION and get the SIGN of the amount automatically.
DATA: ld_bschh LIKE accit-bschl,
ld_bschs LIKE accit-bschl,
ld_umskz LIKE accit-umskz.
IF NOT gs_accit-ktosl IS INITIAL AND
gs_accit-kstat IS INITIAL.
CALL FUNCTION 'FI_GET_POSTING_KEY'
EXPORTING
i_ktosl = gs_accit-ktosl
IMPORTING
e_bschs = ld_bschs
e_bschh = ld_bschh
e_umskz = ld_umskz
EXCEPTIONS
error_message = 1.
IF sy-subrc IS INITIAL.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = ld_bschs.
ELSE.
gs_accit-bschl = ld_bschh.
ENDIF.
** SHB-Vorgänge HR-Travel mit Ktosl 'HRV'
* IF NOT ld_umskz IS INITIAL.
* gs_accit-umskz = ld_umskz.
** keine Ableitung Zahlungsbedingung für SHB-Vorgänge
* CLEAR gs_accit-zterm.
* ENDIF.
ELSE.
PERFORM error_from_system
USING gs_bapi_accit-parameter
gs_bapi_accit-tabix
'ACCT_KEY'.
ENDIF.
ENDIF.
IF gs_accit-bschl IS INITIAL.
CASE gs_accit-koart.
WHEN 'D' OR 'V'.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = '01'.
ELSE.
gs_accit-bschl = '11'.
ENDIF.
WHEN 'K'.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = '21'.
ELSE.
gs_accit-bschl = '31'.
ENDIF.
WHEN 'S'.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = '40'.
ELSE.
gs_accit-bschl = '50'.
ENDIF.
WHEN 'A'.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = '70'.
ELSE.
gs_accit-bschl = '75'.
ENDIF.
WHEN 'M'.
IF gs_accit-shkzg = 'S'.
gs_accit-bschl = '40'.
ELSE.
gs_accit-bschl = '50'.
ENDIF.
ENDCASE.
ENDIF.
IF NOT gs_accit-umskz IS INITIAL.
IF gs_accit-bschl+1 = '1'.
gs_accit-bschl+1 = '9'.
ENDIF.
ENDIF.
Waiting for your reply.
Vikki.
‎2008 Dec 16 2:39 PM
Hello Vikki,
Why do you need sign for the amounts? Have you tried posting the FI docs manually using FB01 trxn.
When you give Posting Keys (40, 50 for ex.) you just have to input the amount fields. No need to give any signs !!!
Depending on your Debit/Credit you input the Posting Keys.
E.g.: 40--> Debit Entry & 50 --> Credit Entry.
Ideally to post a FI doc the Debit & CRedit entries must balance.
In case of any queries do let me know.
BR,
Suhas
‎2008 Dec 16 2:46 PM
Hi Suhas,
when using BAPI, if i dont give ( * -1) for Vendor accounts , it gives me an error
" BALANCE IN TRANSACTION CURRECNY ".
thats the reason i am giving * -1 for vendor accounts.
But as per the requirement , i need to achieve this by just passing the POSTING KEY.
I should not be hardcoding this ( * -1 ).
As you said when i post it manually , the negative and postive sign is coming in properly.
I am cluless how to get it through BAPI.
Using BTE will help????
see this link http://delaynomore.spaces.live.com/blog/cns!D2BFFB84EDFE4189!528.entry
Vikki.
‎2008 Dec 16 2:49 PM
First Fetch the Debit/ Credit indicator for the posting key using the below code.
*...Fetch Debit/Credit indicator and Posting Key from TBSL.
DATA: l_tbsl TYPE tbsl.
TRANSLATE wa_exceldata-value TO UPPER CASE.
wa_filedata-bschl = wa_exceldata-value.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_filedata-bschl
IMPORTING
output = wa_filedata-bschl.
SELECT SINGLE * FROM tbsl INTO l_tbsl WHERE bschl EQ wa_filedata-bschl.
wa_filedata-shkzg = l_tbsl-shkzg.
wa_filedata-koart = l_tbsl-koart.
..........If ur Posting key is 'H', then multiply ur amount with -1.
wa_bapiaccr09-amt_doccur = wa_filedata-wrbtr * -1.
Hope this solves ur problem
‎2008 Dec 16 4:09 PM
Hi
The BAPI doesn't decide the sign, u decide the sign when u transfer the item amount to CURRENCYAMOUNT.
The BAPI sets the Debit/Credit indicatot (field SHKZG) shkzg:
If the amount is negative SHKZG = H else = S
If you want to pass a certain posting key u should customized the table T030B, this table is called by fm FI_GET_POSTING_KEY
Max
‎2008 Dec 16 9:25 AM
hi
refer
help.sap.com/printdocu/core/Print46c/EN/data/pdf/CAGTFADM/CAGTFADM-FI.pdf
‎2008 Dec 16 4:13 PM
hi Max,
Thanks for your reply.
and i saw one of your replies related to EXTENSION in BAPI.
it was also helpfu.
Thanks.
Vikki.