分类:
2011-07-04 17:39:44
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' .