Chinaunix首页 | 论坛 | 博客
  • 博客访问: 706267
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类:

2011-06-30 19:17:47

  crmm_but_lnk0141
 
 
FUNCTION zgep_complain_f0029.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(LV_NAME) TYPE  BAPIBNAME-BAPIBNAME DEFAULT SY-UNAME
*"     VALUE(LV_USERALIAS) TYPE  CRMT_ISA_IUSER_LOGIN-USERALIAS
*"       OPTIONAL
*"     VALUE(LANGU) LIKE  SY-LANGU DEFAULT SY-LANGU
*"  EXPORTING
*"     VALUE(PRO_MILL) TYPE  WERKS_D
*"     VALUE(WERKS) TYPE  WERKS_D
*"     VALUE(PARTNER) TYPE  BU_PARTNER
*"  TABLES
*"      COMP_ORG_HRP STRUCTURE  ZGEP_COMPLAIN_S0004 OPTIONAL
*"----------------------------------------------------------------------

  DATA : lv_bplogin TYPE bu_partner .
  DATA : BEGIN OF obtype OCCURS 0 ,
           otype      TYPE otype      ,
           objid      TYPE hrobjid    ,
         END OF obtype .
  DATA : BEGIN OF orgtype OCCURS 0 ,
           varyf      TYPE varyf      ,
         END OF orgtype .
  REFRESH: obtype , orgtype .
  CLEAR: obtype , orgtype , lv_bplogin .
  CALL FUNCTION 'CRM_ISA_IUSER_GET_BP_TO_ALIAS'
    EXPORTING
      useralias        = lv_useralias
      username         = lv_name
    IMPORTING
      business_partner = lv_bplogin.
  IF sy-subrc = 0 .
    partner = lv_bplogin .
    SELECT otype objid
      INTO CORRESPONDING FIELDS OF obtype
      FROM hrp1000
      WHERE stext = lv_bplogin AND endda > sy-datum .
      APPEND obtype .
      CLEAR: obtype .
    ENDSELECT .
    IF sy-subrc = 0 .
      LOOP AT obtype .
        SELECT varyf
          INTO orgtype-varyf
          FROM hrp1001
          WHERE otype = obtype-otype AND objid = obtype-objid
                AND endda > sy-datum .
          APPEND orgtype .
          CLEAR: orgtype .
        ENDSELECT .
      ENDLOOP .
    ENDIF .
    LOOP AT orgtype .
      SELECT *
        INTO CORRESPONDING FIELDS OF comp_org_hrp
        FROM hrp1000
        WHERE otype = orgtype-varyf+(1) AND
          objid = orgtype-varyf+2(8) AND
*          BEGDA > '20050101' and
          endda > sy-datum . "and langu = langu .
        SELECT SINGLE process_type mill werks
          INTO (comp_org_hrp-process_type,comp_org_hrp-mill,
                                comp_org_hrp-werks)
          FROM z1crm_comp_org
          WHERE sales_group = comp_org_hrp-otjid .
        APPEND comp_org_hrp .
        CLEAR: comp_org_hrp .
      ENDSELECT .
    ENDLOOP .
    CLEAR: pro_mill , werks .
    LOOP AT comp_org_hrp .
      IF comp_org_hrp-process_type = 'KGEA' OR
          comp_org_hrp-process_type = 'KZHA' OR
          comp_org_hrp-process_type = 'KYZA' OR
          comp_org_hrp-process_type = 'KFYA' OR
          comp_org_hrp-process_type = 'KJHA' .
        DELETE comp_org_hrp .
      ELSE .
        SELECT SINGLE mill werks
          INTO (pro_mill,werks)
          FROM z1crm_comp_org
          WHERE sales_group = comp_org_hrp-otjid .
      ENDIF .
    ENDLOOP .
  ENDIF .
 
ENDFUNCTION.
 
  CALL FUNCTION 'CRM_ISAI_CONTACT_SOLDTOS_GET'
    EXPORTING
      iv_contact = contact
      iv_shop    = xshop-id
    TABLES
      et_soldto  = xsoldto.
 
 
 
FUNCTION ZGEP_COMPLAIN_F0008.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(SALES_ORG_RESP) TYPE  CRMT_SALES_ORG_RESP OPTIONAL
*"  EXPORTING
*"     VALUE(RETURN) TYPE  CPSTATUS
*"  TABLES
*"      EMPLOYEE STRUCTURE  ZCRM_EMPLOYEE OPTIONAL
*"----------------------------------------------------------------------
  tables: HRP1001 ,HRP1000 , BUT050.
  DATA: OTYPE TYPE OTYPE ,
        OBJID TYPE HROBJID ,
        OBJECT(10) .
  DATA : LEN TYPE I .
  data: begin of lt_employee occurs 0 ,
          employee(14) ,
        end of lt_employee .
  data : begin of lt_boemployee occurs 0 .
          include structure ZCRM_EMPLOYEE .
  data : end of lt_boemployee .
  data : ftab TYPE TABLE OF STRING.
  data : pro_mill type werks_d ,
         mill      type werks_d ,
         VARYF    type VARYF .
  data : begin of t_tab occurs 0 ,
                OTYPE TYPE OTYPE ,
                OBJID   TYPE HROBJID ,
         end of t_tab .
  data : begin of t_mill occurs 0 ,
                  mill TYPE WERKS_D ,
              end of t_mill .
  APPEND 'SHORT' TO ftab.
  APPEND 'STEXT' TO ftab.
  refresh : lt_employee , lt_boemployee .
  clear : lt_employee , lt_boemployee .
  clear: OTYPE,OBJECT,OBJID  .   "sales_org_resp  = O 50001240
  OTYPE = SALES_ORG_RESP+(1) .   "OTYPE = O
  OBJECT = SALES_ORG_RESP+2(8) . "OBJECT = 50001240
  shift OBJECT right .
  move OBJECT to OBJID .
  select VARYF                   "select BO employee
    into lt_employee-employee
    from HRP1001
    where OTYPE = OTYPE and OBJID = OBJID and RSIGN = 'B'
          and SCLAS = 'S' and ENDDA >= sy-datum .
    append lt_employee .
    clear: lt_employee .
  endselect .
  clear: OTYPE,OBJECT,OBJID .    "select BO BP
  loop at lt_employee .
    OTYPE = lt_employee-employee+(1) .
    OBJECT = lt_employee-employee+2(8) .
    shift OBJECT right .
    move OBJECT to OBJID .
    select distinct (ftab)
      into (lt_boemployee-OBTYPE,lt_boemployee-employee)
      from HRP1000
      where OTYPE = OTYPE and OBJID = OBJID
            and ENDDA >= sy-datum .
      collect lt_boemployee .
      clear: lt_boemployee .
    endselect .
  endloop .
  loop at lt_boemployee .          "select Mill BP
    EMPLOYEE-OBTYPE = lt_boemployee-OBTYPE .
    EMPLOYEE-EMPLOYEE = lt_boemployee-EMPLOYEE .
    append EMPLOYEE .
    clear: EMPLOYEE .
    select PARTNER1
      into EMPLOYEE-EMPLOYEE
      from BUT050
      where PARTNER2 = lt_boemployee-EMPLOYEE and
            RELTYP = 'BUR021' and DATE_TO > SY-DATUM .
      EMPLOYEE-OBTYPE = 'COMPLAINMILL' .
      append EMPLOYEE .
      clear: EMPLOYEE .
    endselect .
  endloop .
  SORT EMPLOYEE BY OBTYPE EMPLOYEE .
  DELETE ADJACENT DUPLICATES FROM EMPLOYEE
    COMPARING OBTYPE EMPLOYEE .
********************************************************************
  clear: pro_mill .
  select single MILL
    into pro_mill
    from Z1CRM_COMP_ORG
    where SALES_GROUP = SALES_ORG_RESP .
  loop at employee where OBTYPE = 'COMPLAINMILL' .
    refresh: t_mill ,T_TAB.
    clear: OTYPE,OBJECT,OBJID,VARYF,mill,t_mill,T_TAB  .
    select OTYPE OBJID
      into (T_TAB-OTYPE,T_TAB-OBJID)
      from HRP1000
      where MC_STEXT = employee-EMPLOYEE and ENDDA >= sy-datum .
      append T_TAB .
      clear : T_TAB .
    endselect .
    loop at T_TAB .
      select single VARYF
        into VARYF
        from HRP1001
        where OTYPE = T_TAB-OTYPE and OBJID = T_TAB-OBJID
              and ENDDA >= sy-datum .
      select single mill
        into t_mill-mill
        from Z1CRM_COMP_ORG
        where SALES_GROUP = VARYF .
        append t_mill .
        clear: t_mill .
    endloop .
    loop at t_mill where mill = pro_mill .
    endloop .
    if sy-subrc <> 0 .
      delete employee .
      clear: employee .
    endif .
  endloop .
***********************************************************************
  loop at employee .
    select single NAME_LAST NAME_FIRST
      into (employee-name_last,employee-NAME_FIRST)
      from but000
      where PARTNER = employee-employee .
    modify employee .
    clear: employee .
  endloop .
  if sy-subrc = 0 .
    RETURN = 'S' .
  else .
    RETURN = 'F' .
  endif .
  LOOP AT EMPLOYEE .
    LEN = STRLEN( EMPLOYEE-EMPLOYEE ) .
    IF LEN <> 10 AND LEN > 0  .
      LEN = 10 - LEN .
      DO LEN TIMES .
        CONCATENATE '0' EMPLOYEE-EMPLOYEE INTO EMPLOYEE-EMPLOYEE .
      ENDDO .
      MODIFY EMPLOYEE .
      CLEAR: EMPLOYEE .
    ENDIF.
  ENDLOOP .
 
 

ENDFUNCTION.
 
 
*data: zVKGRP type  VKGRP .
*获取R/3
  CALL FUNCTION 'CRM_MAPPING_SALES_GROUP'
    EXPORTING
      iv_sales_group  = zsales_org_resp
    CHANGING
      cv_r3_vkgrp     = zvkgrp
    EXCEPTIONS
      value_not_found = 1
      OTHERS          = 2.
阅读(1615) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~