还剩14页未读,继续阅读
本资源只提供10页预览,全部文档请下载后查看!喜欢就下载吧,查找使用更方便
文本内容:
*--------------------------------------------------------------------------------**Program Name:ZCFMR173**Purpose:材料提成比率查询报表**Project Name:CRM**Created by:huoqi**Create on:
2010.
07.14**Functional Consultant:王莹*Description:材料提成比率查询报表*------------------------------------------------------------------------------------------------------------------------------------**Modification Log**Date ProgrammerCorr.#Description**
2010.
08.04huoqi vl.1先判断材料ID的商品性质为免费材料*还是收费材料,免费材料则材料提成比*率为3收费材料则再继续执行原查找*ZT0116\ZT0117\ZT0118的逻辑**REPORT zcfmrl
73.TABLES:zt
0116.TYPE-POOLS:slis.DATA:fieldcat TYPEslis_t_fieldcat_alv WITH HEADER LINE,g_repid TYPEsy-repid,gs_layout TYPEslis_layout_alv.DATA:It processtype TYPE ztbtrancheck,ls_process_typeTYPEztr_tran_check*RANGES:r_process_type FORcrmd_orderadm_h-process_type.RANGES:is seorg FOR crmt_report_orgnian-service_org.*根据效劳组织找相应的OTJIDDATA:BEGIN OFi_hrpl000OCCURS0,otjid LIKEhrplOOO-otjid,stext LIKEhrplOOO-stext,service_org TYPEcnnt_service_org,END OFi_hrpl
000.*DATA:BEGIN OF it_zzclsp OCCURS0,FROM comm_categorytAPPENDING TABLE it_comm_categorytFOR ALL ENTRIES IN it_category_guidWHERE category guid=it category guid-category guid.END IF.END IF.END IF.SORT i_hrpl000BY otjid.SORT it_zzclsp BYproduct_id.SORT it_comm_prshtext BYproduct_guid.SORT it_zzclsp BYcategory_id.SORT itcommcategoryt BYcategory guid.SORT it_category_guid BYcategory id.SORT it_process_type BYprocess_type.LOOP ATit_out.READ TABLE i_hrpl000WITH KEYotjid=it_out-service_org BINARYSEARCH.IF sy-subrc=
0.it_out-service_org_desc二i_hrpl000-stext.END IF.IF rl=,X,.READ TABLE it_zzclsp WITH KEY product_id=it_out-zzclsp BINARYSEARCH.IF sy-subrc=
0.READ TABLE it_comm_prshtext WITH KEY product_guid=it_zzclsp-product_guid BINARYSEARCH.IF sy-subrc=
0.i t_out-zzc1spdesc=i t_comm_prshtext-short_text.ENDIF.END IF.ENDIF.READ TABLE it_zzclsp WITHKEY category_id=it_out-zzclspz BINARYSEARCH.IF sy-subrc=
0.READ TABLE it_comm_categoryt WITHKEY category_guid二it_zzc1sp-category_guid BINARYSEARCH.IF sy-subrc=
0.it out-zzclspz desc=it commcategoryt-category text.ENDIF.ENDIF.IF r3X.READ TABLE it category guid WITHKEY category id=it out-zzdqspz BINARYSEARCH.IF sy-subrc=
0.READ TABLEit_comm_categoryt WITHKEY category_guid=it_category_guid-category_guid BINARYSEARCH.IF sy-subrc=
0.it_out-zzdqspz_desc=it_comm_categoryt-category_text.END IF.END IF.END IF.READ TABLEit_process_type WITHKEY process_type=it_out-zzfwddlx BINARYSEARCH.IF sy-subrc=
0.itout-zzfwddlxdesc=it_process_type-p description_
20.END IF.MODIFY it_out.ENDLOOP.LOOP ATit_out.IF rl=X.MOVE-CORRESPONDING it_out TOit_outl.APPEND it_outl.CLEAR it_outl.ELSE.LOOP ATitzzclsp WHEREcategoryid=itout-zzclspz.MOVE-CORRESPONDING it_out TOit_outl.it_outl-zzclsp=i t_zzc1sp-product_i d.READ TABLEit_comm_prshtext WITHKEY product_guid二it_zzc1sp-product_guid.IF sy-subrc=
0.it outl-zzclsp desc=itcomm prshtext-shorttext.ENDTF.APPEND it_outl.CLEAR it_outl.ENDLOOP.END IF.ENDLOOP.*根据效劳组织、材料商品ID判断商品性质(逻辑见下述表格),*若商品性质为“免费材料〃,则材料提成比例为3*根据效劳组织、材料商品ID查询ZT0134表,若有维护,木则该字段值固定为“免费材料〃;若无,再根据效劳组织、*材料商品ID对应的材料商品组搜索ZT0135表,若有维护,*则该字段值固定为“免费材料〃,IF it_outl[]IS NOTINITIAL.SELECT zsales_org zzclspidFROM zt0134INTO CORRESPONDINGFIELDS OF TABLEit zt0134FOR ALLENTRIES INit_outlWHERE zsales_org=it_outl-service_orgAND zzclspid=it_outl-zzclspAND date_from=sy-datumAND dateto=sy-datum.SELECT zsales_org zzclspzFROMzt0135INTO CORRESPONDINGFIELDS OFTABLEit_zt0135FOR ALLENTRIES INit_outlWHERE zsalesorg=itoutl-serviceorgAND zzclspz=it_outl-zzclspzAND date_from〈二sy-datumAND date_to=sy-datum.END IF.SORT it_zt0134BY zsales_org zzclspid.SORT it_zt0135BY zsales_org zzclspz.LOOP ATit_outl.READ TABLEit_zt0134WITHKEYzsales_org=it_outl-service_org zzclspid=it_outl-zzclsp.IF sy-subrc=
0.CLEAR:itoutl-zzfwddlx,it outl-zzfwddlx desc,itoutl-zzdqspz,itoutl-zzdqspz desc.it_outl_zzspxz=免费材料.it_outl-zztcbl=
0.ELSE.READ TABLEit_zt0135WITHKEYzsales_org=it_outl-service_org zzclspz=itoutl-zzclspz.IF sy-subrc=
0.CLEAR:it outl-zzfwddlx,it_outl-zzfwddlx_desc,it_outl-zzdqspz,it_outl-zzdqspz_desc.it_outl-zzspxz=免费材料.it_outl-zztcbl=
0.ELSE.it outl-zzspxz=收费材料.END IF.END IF.MODIFYENDLOOP.CLEAR:i_hrpl000,it_zzclsp,it_comm_prshtext,it_zzclsp,it_comm_categoryt,it_category_guid,it_process_type.REFRESH:i_hrpl000,it_zzclsp,it_comm_prshtext,it_zzclsp,it_comm_categoryt,it_category_guid,it_process_type.FREE:i hrplOOO,it zzclsp,it commprshtext,it zzclsp,it commcategoryt,it category guid,itprocess type.IF it_outl[]IS INITIAL.MESSAGE s39800WITH您要找的数据不存在!EXIT.END IF.SORT itoutlBY serviceorg zzclsp zzclspz zzfwddlx zzdqspz zzspxz.DELETE ADJACENTDUPLICATES FROMitoutl COMPARINGserviceorgzzclsp zzclspzzzfwddlx zzdqspzzzspxz.ENDFORM.〃FRM_DATA_PROCESS*------------------------------------------------------------------------------**Form FRM_DATA_OUTPUT*------------------------------------------------------------------------------**text*--------------------------------------------------------------------------------**一一pl text*--p2text*--------------------------------------------------------------------------------*FORM frm_data_output.DATA:v_title TYPElvc_title.v_title二提成比率1ELSEIF r2二v_title二提成比率2ELSEIF r3=vtitle=提成比率3TF rl=,X,.END IF.gs_layout-zebra=X.gs layout-colwidth optimize=X.grepid=sy-repid.IF r3X.PERFORM frm_fill_field USING:SERVICE_ORG,效劳组织ID,SERVICE ORGDESC,效劳组织描述,ZZCLSP,材料商品ID,ZZCLSP_DESC,材料名称,ZZCLSPZ ELSE.材料商品组,ZZCLSPZ_DESC,材料商品组描述,ZZFWDDLX效劳订单类型,ZZFWDDLX DESC,效劳订单类型描述,ZZDQSPZ电器商品组,ZZDQSPZ_DESC,电器商品组描述,ZZSPXZ‘商品性质ZZTCBL,’材料提成比率SERVICE_ORG,效劳组织ID,SERVICE ORGDESC,效劳组织描述‘,ZZCLSP,材料商品ID,材料名称ZZCLSP_DESC,材料商品组,ZZCLSPZ,材料商品组描述,ZZCLSPZ_DESC,效劳订单类型,ZZFWDDLX效劳订单类型描述,ZZFWDDLX_DESC,商品性质,ZZSPXZ,电器商品组ZZDQSPZ电器商品组描述ZZDQSPZ_DESC,材料提成比率ZZTCBL,END IF.INITIAL.PERFORM frmfill field USING:CALL FUNCTIONREUSE_ALV_GRID_DISPLAY,EXPORTINGi_callback_program二g_repidis_layout gs_layoutit_fieldcat fieldcat[],i_default X,i_save A,i_grid_title vtitleTABLES touttabEXCEPTIONSit outlOTHERSEND IF.
2.ENDFORM.FRM DATAOUTPUT*--------------------------------------------------------------------------------------------------------------------------------木*Form FRM_FILL_FIELD*一*text*--------------------------------------------------------------------------------*--P1706text*--P_1707text*-------------------------------------------------------------------------------------------------------------------------*CLEAR fieldcat.fieldcat-fieldname=name.fieldcat-seltext_s f=description.ieldcat-seltext_m*f二description.ieldcat-no_zero二’XLAPPEND fieldcat.ENDFORM.〃FRM_FILL_FIELDFORM frm_fill_fieldUSINGname description.product_id LIKE comm_product-product_id,product_guid LIKEcomni_product-product_giiid,commcategory idLIKE prprdcatr-categoryid,commcategory guid LIKE prprdcatr-category guidEND OFit_zzclsp.**DATA:BEGIN OFit comm_prshtext OCCURS0,product_guidLIKE comm_prshtext-product_guid,short_text LIKEcomm_prshtext-short_text,END OFitcommprshtext.*BEGIN OFit_comm_categoryt OCCURS0,DATA:categoryguidLIKEcommcategoryt-categoryguid,categorytextLIKE commcategoryt-categorytext,END OFit_comm_categoryt.DATA:BEGIN OFit_category_guid OCCURS0,comm_category-category_i d,category_id LIKEcomm_category-category_guid,category_guid LIKEEND OF itcategoryguid.DATA:BEGIN OFit_process_type OCCURS0,process_type LIKE ztr_tran_check-process_type,p description20LIKE ztrtrancheck-p description_20,END OFit_process_type.DATA:BEGIN OFit_out OCCURS0,service org LIKE zt0134-zsales org,service_org_desc LIKEhrplOOO-stext,LIKEzt0134-zzclspid,zzclsp zzclspdesczzclspz LIKEcomm_prshtext-short_text,zzclspzdesc LIKE ztOl16-zzclspz,zzfwddlx LIKEcommcategoryt-categorytext,LIKEztOl16-zzfwddlx,zzfwddlx_desc LIKEcrmc_proc_type_t-p_description_20,zzdqspz LIKEzt0116-zzdqspz,zzdqspz descLIKEcomm_categoryt-category_text,zzspxz10,zztcbl LIKEztOl16-zztcbl,DATA:BEGIN OFitzt0134OCCURS0,zsales_orgLIKEzt0134-zsales_org,zzclspid LIKEzt0134-zzclspid,END OFit_zt
0134.DATA:BEGIN OFit_zt0135OCCURS0,zsalesorg LIKEzt0135-zsales_org,zzclspz LIKEzt0135-zzclspz,ENDOFit_zt
0135.SELECTION-SCREEN BEGIN OFBLOCK blWITH FRAMETITLE text-
001.SELECT-OPTIONS:s_seorgFORzt0116-service_org OBLIGATORY,〃效劳组织s_zzclsp s_type sdqspz zt0116-zzclsp OBLIGATORY,FOR〃材料商品IDzt0116-zzfwddlx,FOR〃效劳订单类型ztOl16-zzdqspz MODIFID mdl.FOR〃电器商品组DATA:it_outl LIKEit_out OCCURS0WITHHEADER LINE.SELECTION-SCREEN ENDOF BLOCKbl.SELECTION-SCREEN BEGINOF BLOCKb2WITH FRAMETITLE text-
002.PARAMETERS:rl RADIOBUTTON GROUP raniDEFAULT XUSER-COMMAND rbl,r2RADIOBUTTON GROUPrani,r3RADIOBUTTONGROUPrani.SELECTION-SCREEN ENDOF BLOCKb
2.SELECTION-SCREEN COMMENT/283comlVISIBLE LENGTH
120.AT SELECTION-SCREEN ONVALUE-REQUEST FORs_type-low.PERFORM sub_pro_type_select USINGs_type-low.AT SELECTION-SCREEN ONVALUE-REQUEST FORs_type-high.PERFORM sub_pro_type_select USINGs_type_low.AT SELECTION-SCREEN OUTPUT.PERFORM frm_pbo.AT SELECTION-SCREEN.PERFORM frm_authority_check.PERFORM frm_input_check.CHECK is_seorg[]IS NOTINITIAL.START-OF-SELECTION.PERFORM frmdata_process.PERFORM frmdataoutput.END-OF-SELECTION.*------------------------------------------------------------------------------**Form SUB_PRO_TYPE_SELECT*------------------------------------------------------------------------------**text*-------------------------------------------------------------------------------**—P_S_TYPE_LOW text*-------------------------------------------------------------------------------*FORM sub_pro_type_se1ect USINGp_s_type_low.DATA:f4help LIKETABLE OFddshretval WITHHEADERLINE.DATA:BEGINOFlist OCCURS0,process_type LIKE ztr_tran_check-process_type,p_description_20LIKEztr_tran_check-p_description_20,ENDOFlist.*带搜索帮助,效劳订单类型的值ZS01-ZS
12.ZGS1-ZGS3r_process_type-sign=I.r_process_type-option=BT.r_process_type-low=ZSOT.r_process_type-high=ZS
12.APPEND r processtype.CLEAR r_process_type.r_process_type-sign=I.rprocesstype-option=BT,.r_process_type-low=ZGS
1.r_process_type-high=ZGS3,.APPEND r_process_type.CLEAR r_process_type.SELECT processtype pdescription20INTO CORRESPONDINGFIELDS OFTABLE lt_process typeFROM crmc_proc_type_tWHERE langu=sy-languAND process_type IN r_process_type.LOOP ATlt_process_type INTOls_process_type.MOVE-CORRESPONDING ls_process_type TOlist.APPEND list.ENDLOOP.CALL FUNCTION,F4IF_INT_TABLE_VALUE_REQUEST,EXPORTING二PROCESSJTYPEretfield=sy-repiddynpprog=sy-dynnrdynpnr=1stepl订单类型查询window_title=,S,value_org二TABLES valuetab=listreturn_tab=f4help.p_s_type_low=f4help-fieldval.*-------------------------------------------------------------------------------**Form FRM_PBO*-------------------------------------------------------------------------------**text*--------------------------------------------------------------------------------**一一>pl text*<一p2text*--------------------------------------------------------------------------------*FORM frm_pbo.CONCATENATE注效劳组织、材料商品ID必填,材料提成比率优先取提成比率1,提成比率1无数据再取提成比率2/提成比率2也无数据再取提成比率3INTO coml.IF r3=,X,.LOOP ATSCREEN.IF screen-groupl=screen-input=O.MODIFY SCREEN.END IF.ENDLOOP.ENDIF.ENDFORM.〃FRM_PBO*------------------------------------------------------------------------------**Form FRM_AUTHORITY_CHECK*------------------------------------------------------------------------------**text*-------------------------------------------------------------------------------**一一pl text*--p2text*-------------------------------------------------------------------------------*FORM frm_authority_check.*权限控制到效劳组织*ZSN_ORGOO1REFRESH isseorg.SELECT*INTO CORRESPONDINGFIELDS OFTABLEi_hrpl000FROM hrplOOOWHEREhrplOOOotjid IN s_seorgAND hrplOOOplvar=OTAND hrplOOO^otype=0,AND hrplOOO^begdasy-datumAND hrplOOOenddasy-datum.IF i_hrpl000[]IS INITIAL.MESSAGE e39800WITH没有找到适宜的组织数据!.ELSE.LOOP ATi_hrpl
000.is_seorg-sign-V.is_seorg-option=EQ.is_seorg-low=iJirpl000-otjid.APPEND isseorg.CLEAR isseorg.ENDLOOP.LOOP ATis_seorg.*需控制到效劳组织只可查看本效劳组织的下的单据权限对象ZSN0RG001AUTHORITY-CHECK OBJECTZSN_ORGOO1ID SALES_ORG FIELDis_seorg-low.IF sy-subrc
0.DELETE isseorg[].MESSAGE139800WITH您没有操作组织is_seorg-low的权限!EXIT.END IF.ENDLOOP.END IF.ENDFORM.〃FRM_AUTHORITY_CHECK*------------------------------------------------------------------------------二*Form FRM_INPUT_CHECK*------------------------------------------------------------------------------**text*-------------------------------------------------------------------------------**一pl text*--p2text*-------------------------------------------------------------------------------*FORM frm_input_check.FIND INTABLE s_zzclsp.IF sy-subrc=
0.MESSAGE e39800WITH材料商品ID不允许输入*.EXIT.END IF.ENDFORM.FRM_INPUT_CHECK*-----------------------------------------------------------------------------------------------------------------------**Form FRM_DATA_PROCESS*-----------------------------------------------------------------------------------------------------------------------*二text*-------------------------------------------------------------------------------------------------------------------------**一pl text*一一p2textFORM frmdata process.*
1、若勾选提成比率1,点执行,则根据查询条件中录入的效劳组织、材料商品ID、*效劳订单类型、电器商品组筛选条件,查询ZT0116表,并显示字段(见下)*若查询条件中效劳订单类型、电器商品组字段不输入,则显示ZT0116表中所有的效劳订单类型和电器商品组*
2、若勾选提成比率2,点执行,则根据查询条件录入的效劳组织、材料商品ID、*效劳订单类型、电器商品组筛选条件,查询ZT0117表,并显示字段(见下)其中,*通过查询条件中录入的材料商品ID先查找该ID对应的材料商品组,*再根据该材料商品组查找ZT0117表若查询条件中效劳订单类型、电器商品组字段不输入,*则显示ZT0117表中所有的效劳订单类型和电器商品组*
3.若勾选提成比率3,点执行,则根据查询条件录入的效劳组织、材料商品ID、*效劳订单类型筛选条件,查询ZT0118表,其中,通过查询条件中录入的材料商品ID*先查找该ID对应的材料商品组,再根据该材料商品组查找ZT0118表*其中查询条件中的电器商品组不作为查询筛选字段*根据输入的材料商品ID来找其对应的材料商品组SELECT aproduct_id aproduct_guid bcategory_id bcategory_guidINTO CORRESPONDINGFIELDS OFTABLEit_zzclspFROM comm_product ASa INNERJOIN commprprdcatrAS bONa^productguid=b^product_guid INNERJOIN comm_hierarchy AScON bhierarchy_guid二chierarchy_guidWHERE a~product_id IN s_zzclspAND c~hierarchy_id=R3MATCLASS’.*CHECK it_zzclsp[]IS NOTINITIAL.IF rl=,X,.CLEAR:it_out.REFRESH:it_out.SELECT serviceorgzzclspzzclspzzzfwddlxzzdqspz zztcblFROM zt0116INTO CORRESPONDINGFIELDS OFTABLEit_outWHERE service_org IN is_seorgAND zzfwddlxIN s_typeAND zzfwddlxIN rprocesstypeAND zzdqspzIN sdqspzs_zzclsp.AND zzclspINELSEIF r2=X.SELECT serviceorgzzclspz zzfwddlxzzdqspzzztcblFROMzt0117INTO CORRESPONDINGFIELDS OFTABLEitoutIN it_zzclspFOR ALL ENTRIESIN isseorgWHERE serviceorg ANDINs_typezzfwddlx ANDzzfwddlxIN r_process_typeAND zzdqspzINs_dqspzAND zzclspz=it_zzclsp-category_id.ELSEIF r3=X.SELECT service_org zzclspzzzfwddlx zztcblFROMzt0118INTO CORRESPONDINGFIELDS OFTABLEit_out FORALLENTRIESINit_zzclspWHERE serviceorgINis_seorgAND zzfwddlxINs_typeAND zzfwddlxINr_process_typeAND zzclspz=it_zzclsp-category_id.ENDIF.*CHECK it_out[]IS NOTINITIAL.IF it_out[]IS NOTINITIALSELECT process_type pdescription2INTO CORRESPONDINGFIELDSOFTABLEit_process_typeFROMcrmc_proc_type_tWHERE langu=sy-languAND process_type INr_process_type.SELECT productguidshort textFROM commprshtextINTO TABLEi t_comm_prshtextFOR ALLENTRIES INit_zzclspWHERE product_guid=it_zzclsp-product_guid.SELECT categoryguid category_textFROMcomm_categorytINTO TABLEi t_comm_categorytFOR ALLENTRIES INit_zzclspWHERE categoryguid=it zzc1sp-categoryguid.IF r3X.SELECT category_idcategory_guidFROM commcategoryINTO TABLEitcategory guidFORALLENTRIESINit_outWHERE category_id=it_out-zzdqspz.IF itcategoryguid[]IS NOTINITIAL.SELECT category_guid category_text。