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.

CurrancyItems.PNG

              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.

    Amount.PNG

                                     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’.

   

Debit_credit.PNG

                            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’.

   

AccountGL_hardcoded.PNG

                                Figure 4: Filling parameter 

Following are the account types which are present in SAP:

  1. A – Asset
  2. D – Customer
  3. K – Vendor
  4. M – Material
  5. S – General ledger


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.

    ACCOUNTTYPE.PNG

                              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_accitkunnr IS INITIAL AND
NOT gs_accithkont IS INITIAL.
gs_accit
koart = ‘S’.
gs_accit
taxit = ‘ ‘.
ELSE.
gs_accit
koart = ‘D’.
IF gs_bapi_accitactv_account = ‘2’.
PERFORM koart_v_active(saplfaci) IF FOUND
USING    gs_acchdawtyp
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_accitparameter
gs_bapi_accit
tabix:
‘CUSTOMER  ‘ gs_accitkunnr.
IF gs_accitshkzg = ‘H’ AND                        “note 1596139
gs_acchd
awtyp <> ‘LOANS’.                      “note 1596139

          gs_accitrebzg = ‘V’.
ENDIF.
ENDIF.

WHEN ‘ACCOUNTPAYABLE’.
IF gs_accitlifnr IS INITIAL AND
NOT gs_accithkont IS INITIAL.
gs_accit
koart = ‘S’.
gs_accit
taxit = ‘ ‘.
ELSE.
gs_accit
koart = ‘K’.
gs_accit
taxit = ‘ ‘.
gs_accit
xfilkd = ‘X’.
IF gs_acchdawtyp <> ‘BEBD’ AND
gs_acchd
awtyp <> ‘BERD’ AND
gs_acchd
awtyp <> ‘BERE’ AND
gs_acchd
awtyp <> ‘ENTD’.
PERFORM check_if_initial
USING gs_bapi_accitparameter
gs_bapi_accit
tabix:
‘VENDOR_NO ‘ gs_accitlifnr.
ENDIF.
IF gs_accitshkzg = ‘S’ AND                        “note 1596139
gs_acchd
awtyp <> ‘LOANS’.                      “note 1596139
gs_accit
rebzg = ‘V’.
ENDIF.
ENDIF.

WHEN ‘ACCOUNTGL’.
IF gs_accitkoart IS INITIAL.
gs_accit
koart = ‘S’.
ENDIF.
gs_accit
taxit = ‘ ‘.
IF gs_accitkstat IS INITIAL AND
gs_accit
koart = ‘S’.                “Note 1503626
PERFORM check_if_initial
USING gs_bapi_accitparameter
gs_bapi_accit
tabix:
‘GL_ACCOUNT’ gs_accithkont.
ENDIF.

WHEN ‘ACCOUNTTAX’.
PERFORM process_accit_tx
USING gs_bapi_accittabix.

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.

   

Posting_key.PNG

                                Figure 6: Fetching Posting Key (BSCHL)

Summary:

  • As there are no fields for passing the debit/credit indicator and posting key in IDOC ACC_DOCUMENT03 but this can be handled using the BAPI ‘BAPI_IDOC_INPUT1’, the only thing we need to take care of is ‘just pass the amount with negative sign if it should be credited’. Rest all things are handled by this standard BAPI as mentioned in above steps.

Hope this will help.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply