Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
7,116

Contents

1  BAdI List 2

  1. 1.1  BAdI: IDGTCN_BANK_DETAIL. 2
  2. 1.2  BAdI IDGTCN_CUST_ADDR. 2
  3. 1.3  IDGTCN_MATNR_SPEC. 2
  4. 1.4 IDGTCN_SELLER_ADDRESS. 3
  5. 1.5 IDGTCN_BILLING_CHECK. 3
  6. 1.6 IDGTCN_LINES. 3
  7. 1.7 IDGTCN_CHECK_COMBINE. 4
  8. 1.8 IDGTCN_VAT_LINES. 4
  9. 1.9  IDGTCN_MODIFY_FILE_CONTENT. 4
  10. 1.10 IDGTCN_WRITEBACK. 4

2 Implementation Example. 5

  1. 2.1  Change Material spec. 5
  2. 2.2  Pro Forma Invoice & Filter of Search Result 5
  3. 2.3  Discount 6
  4. 2.4  Different Business Area Can Not Combine. 7
  5. 2.5  Change ‘Note’ of VAT Invoices. 8
  6. 2.6  Merge Line Items According to the Material Type. 9
  7. 2.7  Merge Line Items According to the Material and Unit Price. 10
  8. 2.8  Extend Content of Outbound File. 10
  9. 2.9  Invoice number Write back to VBRK. 12
  10. 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.2  BAdI IDGTCN_CUST_ADDR

This BAdI contains 3 methods:

GET_CUSTOMER_ADDRESS

If the default payer's address is insufficient, you can use this method to set the payer's address based on customer number.

SET_CUSTOMER_TYPE

This method is created to set customer type based on customer number. The exporting field 'ES_IS_SMALL_TAX_PAYER' has two values:

'X' - Small Scale Tax Payer, invoices of this customer will be printed as 'Normal invoice'.

' ' - Ordinary VAT taxpayer,  invoices of this customer will be printed as 'Special invoice'.

GET_CUSTOMER_NAME

If the default payer's name is insufficient, you can use this method to set the payer's name 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.

GET_MATERIAL_DESC

If the default material description is insufficient, you can use this method to set new description.

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

In inbound application, you can use this BAdI to write VAT invoice information back to SAP documents.

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.2  Pro Forma Invoice & Filter of Search Result

Case3: You need to get Pro Forma invoices data in GTI and send them to Golden Tax System.

BAdI Name: IDGTCN_BILLING_CHECK

METHOD if_ex_billing_check~billing_check.
DATA: ls_tvfk TYPE tvfk.
CHECK is_vbrk-fkart IS NOT INITIAL.
SELECT SINGLE * INTO ls_tvfk
FROM tvfk
WHERE fkart = is_vbrk-fkart.
CHECK sy-subrc EQ 0.
IF ls_tvfk-vbtyp EQ 'U'     "SD document categ. -Pro forma invoice
AND ls_tvfk-trvog EQ '8'. "Transaction group  -Proforma invoices
cv_oper
= '1'.            "Billing
ENDIF.
ENDMETHOD.

Case4: Only billing documents with posting status ‘C’(Posting document has been created) could be displayed and sent.

METHOD if_ex_billing_check~billing_check.
IF is_vbrk-rfbsk NE 'C'.
cv_oper
= '3'.          "will not be displayed in output list
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
kschl
= 'ZD01'.
IF sy-subrc = 0.
READ TABLE lt_konv INTO ls_konv_tax WITH KEY knumv = ls_vbrk-knumv
kposn
= ls_item-vfpos
kschl
= 'MWST'.
"Discount Amount(w/o tax) = Discount amount(w/ tax) / ( 1 + tax rate )
ls_konv
-kbetr = abs( ls_konv-kbetr ).
ls_konv_tax
-kbetr = ( ls_konv_tax-kbetr + 1000 ) / 1000.
ls_item
-disc = ls_konv-kbetr / ls_konv_tax-kbetr.
" Discount tax = Total Discount amount - Discount Amount(w/o tax)
ls_item
-disctax = abs( ls_konv-kbetr ) - ls_item-disc.

IF ls_item-fkimg < 0.
ls_item
-disc = ls_item-disc * ( -1 ).
ls_item
-disctax = ls_item-disctax * ( -1 ).
ENDIF.

"Billing Net Value(before discount) = Billing Net Value(after discount) +
" Discount Amount(w/o tax)
ls_item
-netwr = ls_item-netwr + ls_item-disc.
"Billing Tax Amount(before discount) = Billing Tax Amount(after discount+
" Discount Tax
ls_item
-taxamt = ls_item-taxamt + ls_item-disctax.
MODIFY ct_item FROM ls_item TRANSPORTING disc disctax netwr taxamt.
ENDIF.

CLEAR:ls_item,ls_vbrk,ls_konv,ls_konv_tax.
ENDLOOP.

ENDMETHOD.

2.4  Different Business Area Can Not Combine

Case6: You need to combine with the same business area

BAdI Name: IDGTCN_CHECK_COMBINE

METHOD if_check_combine~check_combine.
DATA:ls_header LIKE LINE OF  it_header,
lt_vbrp  
TYPE TABLE OF vbrp,
ls_vbrp  
TYPE          vbrp,
lv_gsber 
TYPE          vbrp-gsber,
lv_gsber1
TYPE          vbrp-gsber,
lv_flag  
TYPE          char1,
ls_return
TYPE          bapiret2.
CHECK it_header IS NOT INITIAL.
SELECT *
FROM vbrp
INTO TABLE lt_vbrp
FOR ALL ENTRIES IN it_header
WHERE vbeln = it_header-vbeln.
SORT lt_vbrp ASCENDING.
LOOP AT it_header INTO ls_header.
READ TABLE lt_vbrp INTO ls_vbrp WITH KEY vbeln = ls_header-vbeln
BINARY SEARCH.
IF sy-subrc = 0.
lv_gsber
= ls_vbrp-gsber.
IF lv_gsber IS NOT INITIAL.
IF lv_gsber1 IS INITIAL.
lv_gsber1
= lv_gsber.
ELSEIF lv_gsber1 <> lv_gsber.
lv_flag
= 'X'.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
IF lv_flag = 'X'.
ls_return
-type = 'E'.
APPEND ls_return TO et_return.
ENDIF.

  1. ENDMETHOD.

2.5  Change ‘Note’ of VAT Invoices

Case7: You need to add customer purchase order number into the note field of VAT invoice.

BAdI Name: IDGTCN_VAT_LINES

METHOD if_ex_lines~change_output_lines.
DATA: ls_vat_header LIKE LINE OF ct_vat_header,
ls_item
LIKE LINE OF it_item.
DATA: BEGIN OF ls_so,
refvbeln
LIKE ls_vat_header-refvbeln,
aubel
LIKE ls_item-aubel,
bstnk
TYPE vbak-bstnk,
END OF ls_so.
DATA: lt_so LIKE STANDARD TABLE OF ls_so,
lv_bstnk
TYPE vbak-bstnk,
lv_tabix
LIKE sy-tabix.

CHECK ct_vat_header[] IS NOT INITIAL.
LOOP AT it_item INTO ls_item.
IF ls_item-aubel IS NOT INITIAL.
ls_so
-refvbeln ls_item-refvbeln.
ls_so
-aubel = ls_item-aubel.
APPEND ls_so TO lt_so.
ENDIF.
ENDLOOP.
LOOP AT ct_vat_item INTO ls_item.
IF ls_item-aubel IS NOT INITIAL.
ls_so
-refvbeln ls_item-refvbeln.
ls_so
-aubel = ls_item-aubel.
APPEND ls_so TO lt_so.
ENDIF.
ENDLOOP.
SORT lt_so ASCENDING BY refvbeln aubel.
DELETE ADJACENT DUPLICATES FROM lt_so COMPARING refvbeln aubel.
LOOP AT lt_so INTO ls_so.
AT NEW aubel.
SELECT SINGLE bstnk INTO lv_bstnk
FROM vbak
WHERE vbeln = ls_so-aubel.
IF sy-subrc NE 0.
CLEAR lv_bstnk.
ENDIF.
ENDAT.
ls_so
-bstnk = lv_bstnk.
MODIFY lt_so FROM ls_so TRANSPORTING bstnk.
ENDLOOP.

LOOP AT ct_vat_header INTO ls_vat_header.
READ TABLE lt_so TRANSPORTING NO FIELDS
WITH KEY refvbeln = ls_vat_header-refvbeln BINARY SEARCH.
IF sy-subrc EQ 0.
lv_tabix
= sy-tabix.
ELSE.
CONTINUE.
ENDIF.
LOOP AT lt_so INTO ls_so FROM lv_tabix.
IF ls_so-refvbeln NE ls_vat_header-refvbeln.
EXIT.
ENDIF.
IF sy-tabix = lv_tabix.
CONCATENATE ls_vat_header-note ' Purchase Order:'
ls_so
-bstnk INTO ls_vat_header-note.
ELSE.
CONCATENATE ls_vat_header-note '/' ls_so-bstnk INTO ls_vat_header-note.
ENDIF.
ENDLOOP.
MODIFY ct_vat_header FROM ls_vat_header TRANSPORTING note.
ENDLOOP.
ENDMETHOD.

2.6  Merge Line Items According to the Material Type

Case8: You need to merge line items according to the material type.

BAdI Name: IDGTCN_VAT_LINES

METHOD IF_EX_VAT_LINES~CHANGE_VAT_LINES.

  DATA: lt_mara TYPE TABLE OF mara,
ls_mara
TYPE          mara,
ls_item
LIKE LINE OF  it_item.

CHECK ct_vat_item IS NOT INITIAL.
SELECT *
FROM mara
INTO TABLE lt_mara
FOR ALL ENTRIES IN ct_vat_item
WHERE matnr = ct_vat_item-matnr.
SORT lt_mara ASCENDING.
LOOP AT ct_vat_item INTO ls_item.
READ TABLE lt_mara INTO ls_mara WITH KEY matnr = ls_item-matnr
BINARY SEARCH.
IF sy-subrc = 0.
ls_item
-customfield1 = ls_mara-mtart.
MODIFY ct_vat_item FROM ls_item TRANSPORTING customfield1.
ENDIF.
ENDLOOP.

  1. ENDMETHOD.

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.

2.8  Extend Content of Outbound File

Case10: You need to add new content into GTI outbound file. E.g. add ‘Tax Rate’ in outbound file

BAdI Name: IDGTCN_MODIFY_FILE_CONTENT

METHOD if_ex_lines~change_output_lines.
DATA: BEGIN OF ls_header,
refvbeln
TYPE c LENGTH 20, "GT document number
tlines
TYPE c LENGTH 4,    "Total lines
kname1
TYPE c LENGTH 100,  "Payer name
kstcd5
TYPE c LENGTH 15,   "Customer register number
kstras
TYPE c LENGTH 80,   "Payer address
kbanka
TYPE c LENGTH 80,   "Payer band account
note
TYPE c LENGTH 160,    "Note
vusnam
TYPE c LENGTH 8,    "Verified by
cusnam
TYPE c LENGTH 8,    "Collected by
goodslist
TYPE c LENGTH 60, "Goods list name(obsolete)
sentdate
TYPE c LENGTH 8,  "send date
vbanka
TYPE c LENGTH 80,   "Payee bank account
vstras
TYPE c LENGTH 80,   "Payee address
END OF ls_header.
DATA: BEGIN OF ls_item,
maktx
TYPE c LENGTH 60,  "goods discription
mseht
TYPE c LENGTH 16,  "UOM description
mspec
TYPE c LENGTH 30,  "Material Specification
invquan
TYPE string,     " Quantity
netvalue
TYPE string,    "Net value
taxrate
TYPE string,     "Tax rate
taxcod
TYPE c LENGTH 4,  "Tax code
discamt
TYPE string,     "Discount Amount
taxamt
TYPE string,      "Tax amount
disctax
TYPE string,     "Discount Tax
discrate
TYPE string,    "Discount Rate
unitpric
TYPE string,    "Unit Price
price_mode
TYPE c,       "Price Mode
END OF ls_item.
DATA: lt_item LIKE STANDARD TABLE OF ls_item,
ls_line
LIKE LINE OF ct_content,
lv_disc_rate
TYPE p DECIMALS 3,
lv_lines
TYPE i.

*Step1: Split string into fields
LOOP AT ct_content INTO ls_line.
IF sy-tabix EQ 1. "Header line in SJJK0101
SPLIT ls_line-line AT '~~' INTO ls_header-refvbeln ls_header-tlines
ls_header
-kname1 ls_header-kstcd5
ls_header
-kstras ls_header-kbanka
ls_header
-note   ls_header-vusnam
ls_header
-cusnam ls_header-goodslist
ls_header
-sentdate ls_header-vbanka
ls_header
-vstras.
ENDIF.
IF sy-tabix GT 1. "Item line in SJJK0101
SPLIT ls_line-line AT '~~' INTO ls_item-maktx   ls_item-mseht
ls_item
-mspec        ls_item-invquan
ls_item
-netvalue     ls_item-taxrate
ls_item
-taxcod       ls_item-discamt
ls_item
-taxamt       ls_item-disctax
ls_item
-discrate     ls_item-unitpric
ls_item
-price_mode.
APPEND ls_item TO lt_item.
CLEAR ls_item.
ENDIF.
ENDLOOP.

*Step2: Change header or item content
LOOP AT lt_item INTO ls_item.
lv_disc_rate
= ls_item-discamt / ls_item-netvalue.
ls_item
-discrate = lv_disc_rate.
MODIFY lt_item FROM ls_item TRANSPORTING discrate.
ENDLOOP.

*Step3: Re-generate file lines
DESCRIBE TABLE ct_content LINES lv_lines.
DELETE ct_content FROM 2 TO lv_lines.
CONCATENATE ls_header-refvbeln ls_header-tlines
ls_header
-kname1   ls_header-kstcd5
ls_header
-kstras   ls_header-kbanka
ls_header
-note     ls_header-vusnam
ls_header
-cusnam   ls_header-goodslist
ls_header
-sentdate ls_header-vbanka
ls_header
-vstras  INTO ls_line-line SEPARATED BY '~~'.
APPEND ls_line TO ct_content.
CLEAR ls_line.
LOOP AT lt_item INTO ls_item.
CONCATENATE ls_item-maktx        ls_item-mseht
ls_item
-mspec        ls_item-invquan
ls_item
-netvalue     ls_item-taxrate
ls_item
-taxcod       ls_item-discamt
ls_item
-taxamt       ls_item-disctax
ls_item
-discrate     ls_item-unitpric
ls_item
-price_mode INTO ls_line-line SEPARATED BY '~~'.
APPEND ls_line TO ct_content.
CLEAR ls_line.
ENDLOOP.

ENDMETHOD.

2.9  Invoice number Write back to VBRK

Case11: You need to writeback the invoice number to table VBRK.

BAdI Name: IDGTCN_WRITEBACK

METHOD if_ex_writeback~writeback.

DATA: lv_flag_db         TYPE xfeld,
ls_idgt_gtdm      
TYPE idgt_gtdm,
ls_vbrk           
TYPE vbrk,
ls_idgt_merge_info
TYPE idgt_merge_info,
ls_idgt_info      
TYPE idgt_info,
lv_redvbeln       
TYPE char10.

CALL METHOD cl_idgt_utility=>get_db_config
IMPORTING
ev_flag
= lv_flag_db.

* Assuming the same billing, there is only one business area.
* New DB
IF lv_flag_db = 'X'.
SELECT SINGLE *
FROM idgt_gtdm
INTO ls_idgt_gtdm
WHERE vbeln_gtd = p_idgt_info-refvbeln
AND posnr_gtd = p_idgt_info-posnr.

IF sy-subrc = 0 AND ls_idgt_gtdm-gtotype IS INITIAL.
SELECT SINGLE *
FROM vbrk
INTO ls_vbrk
WHERE vbeln = ls_idgt_gtdm-vbeln.
ls_vbrk
-xblnr = p_idgt_info-gtvbeln.
UPDATE vbrk FROM ls_vbrk.
ENDIF.
* Old DB
ELSE.
lv_redvbeln
= p_idgt_info-refvbeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input  = lv_redvbeln
IMPORTING
output = lv_redvbeln.

SELECT SINGLE *
FROM idgt_merge_info
INTO ls_idgt_merge_info
WHERE vbeln = lv_redvbeln
AND 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.
ls_vbrk
-xblnr = p_idgt_info-gtvbeln.
UPDATE vbrk FROM ls_vbrk.
ENDIF.
ENDIF.

ENDIF.

ENDMETHOD.

2.10  Default Item Merge by Material

Case12: The standard function does not merge different items into one item by default. If 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 TYPE sys_callst,
ls_cur_item 
TYPE idgt_s_item,
lv_flag_pos 
TYPE char1,
lv_flag_neg 
TYPE 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.
lv_flag_neg
= 'X'.
ENDIF.
ENDLOOP.
IF lv_flag_pos is initial or lv_flag_neg is initial.
cv_mrg_typ
= 'M'.
ENDIF.
EXIT.
ENDLOOP.
ENDIF.

1 Comment