Chinaunix首页 | 论坛 | 博客
  • 博客访问: 706155
  • 博文数量: 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-07-04 17:39:44

sap crm主数据(客户,物料)。
 
查询用户所在的销售组织
 

FUNCTION zgrb_search_org_fr_user. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IN_UNAME) TYPE XUBNAME DEFAULT SY-UNAME *" EXPORTING *" REFERENCE(PARTNER) TYPE BU_PARTNER *" TABLES *" RANGE_ORG STRUCTURE ZRANGE_ORG OPTIONAL *"---------------------------------------------------------------------- DATA:it_hrp1001_1 TYPE TABLE OF hrp1001, wa_hrp1001_1 TYPE hrp1001. DATA:it_hrp1001_2 TYPE TABLE OF hrp1001, wa_hrp1001_2 TYPE hrp1001. DATA: it_attrib TYPE TABLE OF pt1222, wa_attrib TYPE pt1222. DATA: it_result_tab TYPE TABLE OF swhactor, wa_result_tab TYPE swhactor. DATA: it_result_objec TYPE TABLE OF objec, wa_result_objec TYPE objec. DATA: it_attrib1 TYPE STANDARD TABLE OF pt1222 , wa_attrib1 TYPE pt1222 . ************************************************************************* CALL FUNCTION 'CRM_ISA_IUSER_GET_BP_TO_ALIAS' EXPORTING username = in_uname IMPORTING business_partner = partner. CLEAR it_hrp1001_1. SELECT * FROM hrp1001 INTO wa_hrp1001_1 WHERE sobid = partner AND sclas = 'BP' AND subty = 'B207' AND begda <= sy-datum AND endda >= sy-datum. APPEND wa_hrp1001_1 TO it_hrp1001_1. CLEAR wa_hrp1001_1. ENDSELECT. IF it_hrp1001_1[] IS INITIAL . SELECT * FROM hrp1001 "根据登陆用户 INTO wa_hrp1001_1 WHERE sobid = partner AND sclas = 'US' AND subty = 'B208' AND begda <= sy-datum AND endda >= sy-datum. APPEND wa_hrp1001_1 TO it_hrp1001_1. CLEAR wa_hrp1001_1. ENDSELECT. ENDIF. CLEAR it_hrp1001_2. LOOP AT it_hrp1001_1 INTO wa_hrp1001_1. SELECT * FROM hrp1001 INTO wa_hrp1001_2 WHERE sobid = wa_hrp1001_1-objid AND sclas = 'CP' AND subty = 'A008' AND begda <= sy-datum AND endda >= sy-datum. APPEND wa_hrp1001_2 TO it_hrp1001_2. CLEAR wa_hrp1001_2 . ENDSELECT. CLEAR wa_hrp1001_1. ENDLOOP. ************************************************************************************************** * & 读取职位的属性 -> 销售组织 ************************************************************************************************** CLEAR wa_hrp1001_2 . LOOP AT it_hrp1001_2 INTO wa_hrp1001_2 . REFRESH: it_result_tab ,it_result_objec. CLEAR: wa_result_tab ,wa_result_objec. CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = 'S' act_objid = wa_hrp1001_2-objid act_wegid = 'SAP_ORG' authority_check = '' TABLES result_tab = it_result_tab. LOOP AT it_result_tab INTO wa_result_tab WHERE otype = 'O'. ENDLOOP . CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = wa_result_tab-otype act_objid = wa_result_tab-objid act_wegid = 'O-O' authority_check = '' TABLES result_objec = it_result_objec. LOOP AT it_result_objec INTO wa_result_objec . IF wa_result_objec-short+0(4) = 'SORG' . range_org-low+0(2) = wa_result_objec-otype. range_org-low+2(8) = wa_result_objec-objid. SELECT SINGLE otype INTO wa_result_objec-otype FROM crmd_orgman_temp WHERE sales_org = range_org-low . IF sy-subrc = 0 . range_org-sign = 'I' . range_org-option = 'EQ' . APPEND range_org. CLEAR range_org. ENDIF. ENDIF . ENDLOOP . ENDLOOP . ENDFUNCTION.

 

查询某销售组织下的 客户数据。

      SELECT * FROM CRMV_BP_FRG0140                             INTO TABLE it_CRMV_BP_FRG0140
      WHERE   sales_org  EQ 'O 50000012' .

 

查询某销售组织下的 物料数据。

       SELECT * FROM COMV_PR_SALES_OT                             INTO TABLE it_COMV_PR_SALES_OT  

       WHERE sales_org  EQ 'O 50000012' .


 

阅读(2911) | 评论(0) | 转发(0) |
0

上一篇:dialog

下一篇:动态内表做的report

给主人留下些什么吧!~~