Description:
When using the basic type ACC_DOCUMENT03, in order to pass the values of posting key and credit/debit indicator the respective fields are not available. This blog determines how these are being determined automatically and the steps to check those required fields.
Solution:
This can be handled even though we do not pass the credit debit indicator or posting key. The BAPI which we are using for the posting the FI document itself does this.
BAPI_IDOC_INPUT1 is the BAPI used for individual posting.
1. In segment E1BPACCR09 (Currency Item):
We need to pass the amount in AMT_DOCCUR field.
Figure 1: Segment E1BPACCR09 (Currency Item)
In the above segment pass the amount in field AMT_DOCCUR with ‘-’ negative sign for credit and for debit there is no need to attach ‘+’ sign.
Example
In the below snapshot the amount ‘349.9000-’ indicate that amount should be credited and the amount ‘284.4500’ indicate that amount should be debited.
Figure 2: Amount in Segment E1BPACCR09
2. Depending on amount the debit/credit indicator is fetched. The code for the same is written in FORM ‘PROCESS_ACCCR’.
As we know for debit/credit indicator there are two values which are fixed i.e. ’S’ and ‘H’.
S – Debit.
H - Credit.
If amount is greater than ‘0’ then field SHKZG (debit/credit indicator) will hold the ‘S’ Value which indicate debit and if amount is less than zero then field SHKZG (debit/credit indicator) will hold the ‘H’ Value which indicate Credit.
Below snapshot shows the code written in the form routine ‘PROCESS_ACCCR’.
Figure 3: Fetching Debit/Credit Indictor (SHKZG)
3. Once the debit/credit indicator is fetched, the account type should be fetched. Account type is fetched on the basis of parameter field in it_bapi_accit. The IDOC data it is split-ed into 4 internal tables as account_receivable, account_payable, account_gl and Account_tax. These internal tables are checked and then if the data is present in their respective fields then the parameter field is hard-coded with ACCOUNTRECEIVABLE, ACCOUNTPAYABLE, ACCOUNTGL, and ACCOUNTTAX respectively.
Below Snippet shows how the values are getting populated in field parameter. This code is written in form routine ‘FILL_BAPI_ACCIT’.
Figure 4: Filling parameter
Following are the account types which are present in SAP:
Depending on the values in gs_bapi_accit-parameter the account type is chosen.If gs_bapi_accit-parameter is holding value as ‘ACCOUNTGL’ then ‘S’ account type will be hard-coded.
Figure 5: Fetching Account type (KOART)
And for remaining parameters please check the below code which is written in form routine ‘FILL_ACCOUNTTYPE’.
Code:
CASE gs_bapi_accit-parameter.
WHEN 'ACCOUNTRECEIVABLE'.
IF gs_accit-kunnr IS INITIAL AND
NOT gs_accit-hkont IS INITIAL.
gs_accit-koart = 'S'.
gs_accit-taxit = ' '.
ELSE.
gs_accit-koart = 'D'.
IF gs_bapi_accit-actv_account = '2'.
PERFORM koart_v_active(saplfaci) IF FOUND
USING gs_acchd-awtyp
CHANGING l_koart.
IF NOT l_koart IS INITIAL.
gs_accit-koart = l_koart.
ENDIF.
ENDIF.
gs_accit-taxit = ' '.
gs_accit-xfilkd = 'X'.
PERFORM check_if_initial
USING gs_bapi_accit-parameter
gs_bapi_accit-tabix:
'CUSTOMER ' gs_accit-kunnr.
IF gs_accit-shkzg = 'H' AND "note 1596139
gs_acchd-awtyp <> 'LOANS'. "note 1596139
gs_accit-rebzg = 'V'.
ENDIF.
ENDIF.
WHEN 'ACCOUNTPAYABLE'.
IF gs_accit-lifnr IS INITIAL AND
NOT gs_accit-hkont IS INITIAL.
gs_accit-koart = 'S'.
gs_accit-taxit = ' '.
ELSE.
gs_accit-koart = 'K'.
gs_accit-taxit = ' '.
gs_accit-xfilkd = 'X'.
IF gs_acchd-awtyp <> 'BEBD' AND
gs_acchd-awtyp <> 'BERD' AND
gs_acchd-awtyp <> 'BERE' AND
gs_acchd-awtyp <> 'ENTD'.
PERFORM check_if_initial
USING gs_bapi_accit-parameter
gs_bapi_accit-tabix:
'VENDOR_NO ' gs_accit-lifnr.
ENDIF.
IF gs_accit-shkzg = 'S' AND "note 1596139
gs_acchd-awtyp <> 'LOANS'. "note 1596139
gs_accit-rebzg = 'V'.
ENDIF.
ENDIF.
WHEN 'ACCOUNTGL'.
IF gs_accit-koart IS INITIAL.
gs_accit-koart = 'S'.
ENDIF.
gs_accit-taxit = ' '.
IF gs_accit-kstat IS INITIAL AND
gs_accit-koart = 'S'. "Note 1503626
PERFORM check_if_initial
USING gs_bapi_accit-parameter
gs_bapi_accit-tabix:
'GL_ACCOUNT' gs_accit-hkont.
ENDIF.
WHEN 'ACCOUNTTAX'.
PERFORM process_accit_tx
USING gs_bapi_accit-tabix.
WHEN OTHERS.
RAISE wrong_linetyp.
ENDCASE.
4. Based on the debit/credit indicator and account type the posting key is fetched.
Now in this case for account type i.e. KOART we are having value as ‘S’. i.e. GL. And in debit/credit indicator i.e. SHKZG. we are having value as ‘S’ then the posting key is fetched as 40 i.e. Debit.
Figure 6: Fetching Posting Key (BSCHL)
Summary:
Hope this will help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |