Beruflich Dokumente
Kultur Dokumente
Contents
1 BAdI List ....................................................................................................................................... 2
1.1 BAdI: IDGTCN_BANK_DETAIL ............................................................................................... 2
1.2 BAdI IDGTCN_CUST_ADDR ................................................................................................... 2
1.3 IDGTCN_MATNR_SPEC ......................................................................................................... 2
1.4 IDGTCN_SELLER_ADDRESS .................................................................................................... 3
1.5 IDGTCN_BILLING_CHECK ....................................................................................................... 3
1.6 IDGTCN_LINES ....................................................................................................................... 3
1.7 IDGTCN_CHECK_COMBINE .................................................................................................... 4
1.8 IDGTCN_VAT_LINES ............................................................................................................... 4
1.9 IDGTCN_MODIFY_FILE_CONTENT ........................................................................................ 4
1.10 IDGTCN_WRITEBACK ........................................................................................................... 4
2 Implementation Example ............................................................................................................. 5
2.1 Change Material spec ........................................................................................................... 5
2.2 Pro Forma Invoice & Filter of Search Result ......................................................................... 5
2.3 Discount ................................................................................................................................ 6
2.4 Different Business Area Can Not Combine ........................................................................... 7
2.5 Change Note of VAT Invoices ............................................................................................. 8
2.6 Merge Line Items According to the Material Type ............................................................... 9
2.7 Merge Line Items According to the Material and Unit Price .............................................. 10
2.8 Extend Content of Outbound File ....................................................................................... 10
2.9 Invoice number Write back to VBRK .................................................................................. 12
2.10 Default Combine by Material ........................................................................................... 14
Copyright ....................................................................................................................................... 16
1 BAdI List
1.1 BAdI: IDGTCN_BANK_DETAIL
This BAdI contains 2 methods
GET_SELLER_BANK_DETAIL
This method could be used to set the payee's bank account.
GET_BUYER_BANK_DETAIL
If the default payer's bank account is insufficient, you can use this method to set the payer's
bank account based on customer number.
1.3 IDGTCN_MATNR_SPEC
This BAdI contains 2 methods:
GET_MATERIAL_SPEC
If the default material specification is insufficient, you can use this method to set new
specification.
1.4 IDGTCN_SELLER_ADDRESS
This BAdI contains 1 method:
GET_SELLER_ADDRESS
This method could be used to set the Payee's address
1.5 IDGTCN_BILLING_CHECK
This BAdI contains 1 method:
BILLING_CHECK
By using this BAdI, you can define your own logic to check whether a document should be
displayed in outbound search result. E.g.:
1. If VAT invoice has already been printed from sales order, the following billing document
should not be sent to GT again. In this case you can use this BAdI to filter this billing
document.
2. In some specific business cases, you need to send data to Golden Tax System from other
billing categories. E.g. Pro Forma invoices. You can use this BAdI to add these documents into
the search result of outbound application.
1.6 IDGTCN_LINES
This BAdI contains 1 method:
CHANGE_OUTPUT_LINES
You can use this BAdI to include discount data in the outbound file for the Golden Tax
Interface. In addition, this BAdI enables you to remove a line item from the output ALV list
and subsequently the outbound file.
You can also use this BAdI to make necessary changes of contents which are selected from
source documents. Please be noticed that abuse of this BAdI will cause data inconsistency
between SAP and Golden Tax System
1.7 IDGTCN_CHECK_COMBINE
This method contains 1 method:
CHECK_COMBINE
You can use this BAdI to create additional check rule for combination. It will be called after
you select several documents and click 'Combine' button.
If selected documents should not be combined, you can append message with type 'E' into
the return table 'ET_RETURN'. Then the combine event will be terminated and message will
be displayed on your screen.
If selected documents can be combined, you do not need to change anything in your BAdI
implementation.
1.8 IDGTCN_VAT_LINES
This method contains 1 method:
CHANGE_VAT_LINES
This method could be used to change fields of VAT invoice after GTI generate VAT data. E.g.
you can implement this BAdI to replace 'Note' field. Please be noticed that abuse of this
method will cause data inconsistency between SAP and Golden Tax System
1.9 IDGTCN_MODIFY_FILE_CONTENT
This BAdI contains 1 method:
MODIFY_FILE_CONTENT
This method could be used to make necessary changes on the header and Items of outbound
file before downloaded. E.g. payer name/payer address/Unit price/ discount rate etc.
Please be noticed that abuse of this method will cause data inconsistency between SAP and
Golden Tax System
1.10 IDGTCN_WRITEBACK
This method contains 1 method:
WRITEBACK
4
2 Implementation Example
2.1 Change Material spec
Case1: You need to change the default material specification to the new specification .
BAdI Name: IDGTCN_MATNR_SPEC
METHOD IF_EX_MATNR_SPEC~GET_MATERIAL_SPEC.
IF IS_MATNR_PARAMS = 'GTS_RAW_MM01'.
ES_MATNR_SPEC = 'GTS_RAW_MM01_SPEC'.
ENDIF.
ENDMETHOD.
Case2: You need to change the default material description to the new description .
BAdI Name: IDGTCN_MATNR_SPEC
METHOD IF_EX_MATNR_SPEC~GET_MATERIAL_DESC.
IF IS_MATNR_PARAMS = 'GTS_RAW_MM01'.
ES_MATNR_DESC = 'GTS_RAW_MM01_DESC'.
ENDIF.
ENDMETHOD.
2.3 Discount
Case5: If discount with tax is used in your billing condition. You need to add discount info into
data selected.
BAdI Name: IDGTCN_LINES
METHOD if_ex_lines~change_output_lines.
DATA:ls_item TYPE idgt_s_item,
ls_konv TYPE konv,
ls_konv_tax TYPE konv,
ls_vbrk TYPE vbrk.
DATA:lt_vbrk TYPE SORTED TABLE OF vbrk WITH NON-UNIQUE KEY vbeln,
lt_konv TYPE SORTED TABLE OF konv WITH NON-UNIQUE KEY knumv kposn.
CHECK ct_header IS NOT INITIAL AND ct_item IS NOT INITIAL.
SELECT vbeln knumv fkart vtweg
FROM vbrk
INTO CORRESPONDING FIELDS OF TABLE lt_vbrk
FOR ALL ENTRIES IN ct_header
WHERE vbeln = ct_header-vbeln.
CHECK sy-subrc EQ 0.
CLEAR:lt_konv.
SELECT knumv kposn kschl kbetr kwert mwsk1 kawrt
FROM konv
INTO CORRESPONDING FIELDS OF TABLE lt_konv
FOR ALL ENTRIES IN lt_vbrk
WHERE knumv = lt_vbrk-knumv
AND
kschl = 'ZD01'. "Discount Condition type
SELECT knumv kposn kschl kbetr kwert mwsk1 kawrt
FROM konv
APPENDING CORRESPONDING FIELDS OF TABLE lt_konv
FOR ALL ENTRIES IN lt_vbrk
WHERE knumv = lt_vbrk-knumv
AND
kschl = 'MWST'. "VAT Condition type
LOOP AT ct_item INTO ls_item.
READ TABLE lt_vbrk INTO ls_vbrk WITH KEY vbeln = ls_item-vbeln.
READ TABLE lt_konv INTO ls_konv WITH KEY knumv = ls_vbrk-knumv
kposn = ls_item-vfpos
2.7 Merge Line Items According to the Material and Unit Price
Case9: You need to merge line items according to the material and unit price.
BAdI Name: IDGTCN_LINES
METHOD if_ex_lines~change_output_lines.
* Local Work Area Definition
DATA: ls_item TYPE idgt_s_item.
* Local Variant Definition
DATA: lv_unit_price TYPE string.
* Below we need to change customer field2 of line item
LOOP AT ct_item INTO ls_item.
lv_unit_price = ls_item-unitpe.
ls_item-customfield2+0(12) = ls_item-matnr.
ls_item-customfield2+12(8) = lv_unit_price.
MODIFY ct_item FROM ls_item.
ENDLOOP.
ENDMETHOD.
10
11
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
xfeld,
idgt_gtdm,
vbrk,
idgt_merge_info,
idgt_info,
char10.
12
SINGLE *
idgt_merge_info
ls_idgt_merge_info
vbeln = lv_redvbeln
vfpos = p_idgt_info-posnr.
IF sy-subrc = 0.
SELECT SINGLE *
FROM vbrk
INTO ls_vbrk
WHERE vbeln = ls_idgt_merge_info-vbeln.
ls_vbrk-xblnr = p_idgt_info-gtvbeln.
UPDATE vbrk FROM ls_vbrk.
ELSE.
SELECT SINGLE *
FROM idgt_info
INTO ls_idgt_info
WHERE vbeln = lv_redvbeln.
IF sy-subrc = 0.
SELECT SINGLE *
FROM vbrk
INTO ls_vbrk
WHERE vbeln = ls_idgt_info-vbeln.
13
you want to merge items by material automatically, you could implement the
implicit enhancement at the beginning of the method BUILD_VAT_DATA of Class
CL_IDGT_OUTBOUND.
For example, there are three items of a billing document which contains two materials. The
standard function will generate three items as a default result. User can push the "Merge by
material" to generate two items as a result. After the enhancment, the result will be two items
(two materials) by default.
Class: CL_IDGT_OUTBOUND
METHOD: BUILD_VAT_DATA
Example:
DATA: lt_callstack
ls_cur_item
lv_flag_pos
lv_flag_neg
TYPE
TYPE
TYPE
TYPE
sys_callst,
idgt_s_item,
char1,
char1.
IF cv_mrg_typ IS INITIAL.
CALL FUNCTION 'SYSTEM_CALLSTACK'
EXPORTING
max_level
= 0
IMPORTING
et_callstack
= lt_callstack.
LOOP AT lt_callstack TRANSPORTING NO FIELDS
WHERE progname = 'CL_IDGT_OUTBOUND==============CP'
AND ( eventname = 'COMBINE_DOCUMENTS' OR eventname = 'SEND_TO_GT'
).
CLEAR: lv_flag_pos,
lv_flag_neg.
LOOP AT mt_cur_item into ls_cur_item.
IF ls_cur_item-netwr > 0.
lv_flag_pos = 'X'.
ELSEIF ls_cur_item-netwr < 0.
14
15
Copyright
2013 SAP AG or an SAP affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP AG. The information contained herein may be changed
without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary
software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP AG and its affiliated companies ("SAP Group") for
informational purposes only, without representation or warranty of any kind, and SAP Group
shall not be liable for errors or omissions with respect to the materials. The only warranties for
SAP Group products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as
constituting an additional warranty.
SAP and other SAP products and services mentioned herein as well as their respective logos
are trademarks or registered trademarks of SAP AG in Germany and other countries.
16