ZXMCVU02

<< Click to Display Table of Contents >>

Navigation:  All About ABAP Technique > English > ABAP Tutorial > ABAP Workbench Tools > Enhancement > Customer Exits > Customer Exits Examples > Project ZSDWS001  > Funtions Exits  > EXIT_SAPLMCS1_002  >

ZXMCVU02

*&---------------------------------------------------------------------*
*&  Include           ZXMCVU02                                         *
*&---------------------------------------------------------------------*
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_XMCVBAK) LIKE  MCVBAKB STRUCTURE  MCVBAKB
*"             VALUE(I_XMCVBUK) LIKE  MCVBUKB STRUCTURE  MCVBUKB
*"             VALUE(I_XMCVBAP) LIKE  MCVBAPB STRUCTURE  MCVBAPB
*"             VALUE(I_XMCVBUP) LIKE  MCVBUPB STRUCTURE  MCVBUPB
*"             VALUE(I_XMCVBKD) LIKE  MCVBKDB STRUCTURE  MCVBKDB
*"             VALUE(I_CONTROL) LIKE  MCCONTROL STRUCTURE  MCCONTROL
*"       EXPORTING
*"             VALUE(E_XMCVBAPUSR) LIKE  MCVBAPUSR
*"                             STRUCTURE  MCVBAPUSR
*"----------------------------------------------------------------------
** Purpose: to fill the following fields based on CO derivation rules:
***** ZZRKEG_WW002   ASM
***** ZZRKEG_WW001   RSM
** CO derivation rule tables:
****  K9RWDV1000006 : derivation rule SalesGroup to ASM
****  K9RWDV1000005 : derivation rule ASM to RSM
 
Tables: K9RWDV1000006, K9RWDV1000005, kna1.
 
**>> Determine ASM
select single * from K9RWDV1000006
    where SOUR1_FROM le I_XMCVBAK-VKGRP
      and SOUR1_TO   ge I_XMCVBAK-VKGRP
      and SOUR2_FROM le I_XMCVBAK-VKBUR
      and SOUR2_TO   ge I_XMCVBAK-VKBUR
      and SOUR3_FROM le I_XMCVBAP-SPART
      and SOUR3_TO   ge I_XMCVBAP-SPART
      and DELETE_FLG = space.
if sy-subrc = 0.
    E_XMCVBAPUSR-ZZWW001 = K9RWDV1000006-TARGET1.
endif.
 
**>> Determine RSM
select single * from K9RWDV1000005
    where SOUR1_FROM le E_XMCVBAPUSR-ZZWW001
      and SOUR1_TO   ge E_XMCVBAPUSR-ZZWW001
      and DELETE_FLG = space.
if sy-subrc = 0.
    E_XMCVBAPUSR-ZZWW002 = K9RWDV1000005-TARGET1.
endif.
 
**>> Determine Customer Class and Industry Code
select single * from kna1 where kunnr = I_XMCVBAK-KUNNR.
if sy-subrc = 0.
  E_XMCVBAPUSR-ZZKUKLA = KNA1-KUKLA.
  E_XMCVBAPUSR-ZZBRAN1 = KNA1-BRAN1.
endif.
 
**>> Get Customer Hierarchy from Partner function 1A
tables: knvp .
select single * from knvp where kunnr = I_XMCVBAK-KUNNR
                        and   parvw = '1A'.
if sy-subrc = 0.
 E_XMCVBAPUSR-ZZHIENR01 = KNVP-KUNN2.
endif.
 
**>> Get Customer credit group from transactions.
 
IF I_XMCVBKD-ZTERM = 'Z00'.
 E_XMCVBAPUSR-ZZKVGR1 = 'CAS'.
ELSE.
 E_XMCVBAPUSR-ZZKVGR1 = 'CRE'.
ENDIF.