SD--关于SD帐码对应的记账码(Posting Keys)

最近在SDN的论坛中有个SD的记账码的提问:SD的帐码对应的记账码在哪配置(其他模块对应帐码都有对应的配置)?

其实SD的记账码(Posting Keys)是固定的,是由ABAP代码决定。

从程序LV60BF00摘抄相关代码如下:

FORM accounting_head_line.

* fill customer line item
posnr = posnr + 1.

CLEAR xaccit.
CLEAR xacccr.
MOVE-CORRESPONDING vbrk TO xaccit.
MOVE-CORRESPONDING xaccit_deb TO xaccit.
CLEAR xaccit-gjahr.
xaccit-awtyp = con_awtyp_vbrk.
xaccit-awref = vbrk-vbeln.
xaccit-belnr = vbrk-vbeln.
xaccit-zuonr = vbrk-zuonr.
xaccit-mwskz = xaccit_deb-mwsk1.
IF vbrk-fktyp = con_fktyp_p.
xaccit-zumsk = con_zumsk_a.
xaccit-umskz = con_umskz_f.
xaccit-bstat = con_bstat_s.
ENDIF.
MOVE-CORRESPONDING xkomk1 TO xaccit.

xacccr-mandt = vbrk-mandt.
xacccr-awtyp = con_awtyp_vbrk.
xacccr-awref = vbrk-vbeln.
xacccr-aworg = space.

* cancellation
xaccit-awref_rev = vbrk-sfakn.
IF vbrk-vbtyp CA 'N'.
xaccit-rebzg(1) = 'V'.
ENDIF.

IF xaccit_deb-cash = space.
* customer line item
IF vbrk-vbtyp NA vbtyp_reli.
xacccr-wrbtr = pos_brutto.
ELSE.
xacccr-wrbtr = warenwert + tax.
ENDIF.
xacccr-skfbt = cashdiscount.
xaccit-absbt = securevalue.
* convert secure value to credit currency
IF vbrk-waerk NE vbrk-cmwae AND NOT vbrk-cmwae IS INITIAL.
PERFORM currency_conversion.
ENDIF.
IF vbrk-vbtyp CA 'NO46'.
xacccr-wrbtr = xacccr-wrbtr * -1.
xacccr-skfbt = xacccr-skfbt * -1.
pos_netto = pos_netto * -1.
tax = tax * -1.
ENDIF.
CLEAR xaccit-shkzg. " determined by FI
IF xacccr-wrbtr LT 0.
IF vbrk-fktyp = con_fktyp_p.
xaccit-bschl = con_bschl_19.
ELSE.
xaccit-bschl = con_bschl_11.
ENDIF.
IF xacccr-skfbt GT 0.
xacccr-skfbt = 0.
ENDIF.
ELSE.
IF vbrk-fktyp = con_fktyp_p.
xaccit-bschl = con_bschl_09.
ELSE.
xaccit-bschl = con_bschl_01.
ENDIF.
IF xacccr-skfbt LT 0.
xacccr-skfbt = 0.
ENDIF.
ENDIF.
.....

endform.

FORM accounting_item_line.
.......

CLEAR xaccit-shkzg.
IF xacccr-wrbtr LT 0.
IF mode = 'A'.
xaccit-bschl = con_bschl_40.
xacccr-wrbtr = xacccr-wrbtr * -1.
ELSE.
xaccit-bschl = con_bschl_50.
ENDIF.
ELSE.
IF mode = 'A'.
xaccit-bschl = con_bschl_50.
xacccr-wrbtr = xacccr-wrbtr * -1.
ELSE.
xaccit-bschl = con_bschl_40.
ENDIF.
ENDIF.
.....

endform.

FORM accounting_tax_line.

......

* posting key is set according to the sign of the tax amount
* the tax base is not taken into account ( note 437983 )
IF external IS INITIAL.
IF vbrk-vbtyp CA 'NO46'.
xaccit-bschl = con_bschl_50.
IF xacccr-wrbtr GE 0.
xaccit-bschl = con_bschl_40.
ENDIF.
ELSE.
xaccit-bschl = con_bschl_40.
IF xacccr-wrbtr LE 0.
xaccit-bschl = con_bschl_50.
ENDIF.
ENDIF.
ELSE.
IF vbrk-vbtyp CA 'NO46'.
xaccit-bschl = con_bschl_50.
IF xacccr-wrbtr GE 0 AND xacccr-fwbas GE 0.
xaccit-bschl = con_bschl_40.
ENDIF.
ELSE.
xaccit-bschl = con_bschl_40.
IF xacccr-wrbtr LE 0 AND xacccr-fwbas LE 0.
xaccit-bschl = con_bschl_50.
ENDIF.
ENDIF.
ENDIF.

.....

ENDFORM.

配置

SD的帐码配置

TCODE:OV34

PATH:Sales and Distribution->Basic Functions->Account Assignment/Costing->Revenue Account Determination->Define And Assign Account Keys

记账码的配置(Posting Keys)

TCODE:OB41

PATH:Financial Accounting->Financial Accounting Global Settings->Document->Line item->Controls->Define posting Keys

你可能感兴趣的:(F#)