首页 > 代码库 > 门店查询报表

门店查询报表

REPORT  ZSDR004.


INCLUDE ZSDR004TOP.

TABLES: KNA1,/ATU/STOREMASTER,KNVV,ZSSTORE02.TYPE-POOLS: slis.DATA: ls_data type ZSSTORE02,      it_data type TABLE OF ZSSTORE02 WITH HEADER LINE."设置面积DATA: it_ZSTORE_A like TABLE OF ZSTORE_A WITH HEADER LINE,      it_ZSTORE_AR like TABLE OF ZSTORE_AR WITH HEADER LINE,      it_3ASEAN like TABLE OF J_3ASEANT WITH HEADER LINE,      it_ZSTORE_QR like TABLE OF ZSTORE_QR WITH HEADER LINE,      it_ZMAP_VFILD like TABLE OF ZMAP_VFILD WITH HEADER LINE,      it_ZMAP_TFILD like TABLE OF ZMAP_TFILD WITH HEADER LINE,      it_ZST_SEAN_PATTR like TABLE OF ZST_SEAN_PATTR WITH HEADER LINE.FIELD-symbols: <dyn_table> TYPE STANDARD TABLE,       " 内表结构               <dyn_wa>,                              " 表头               <dyn_field>.                           "DATA: it_alv_cat TYPE TABLE OF lvc_s_fcat,      ls_alv_cat LIKE LINE OF it_alv_cat,      it_alv_cat_s TYPE TABLE OF lvc_s_fcat.

 

 

INCLUDE ZSDR004SCR.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.  SELECT-OPTIONS: S_3ADCCU FOR KNA1-J_3ADCCU,                  S_KUNNR FOR KNA1-KUNNR,                  S_NAME1 FOR KNA1-NAME1 NO INTERVALS,                  S_KATR2 FOR KNA1-KATR2,                  S_VKORG FOR /ATU/STOREMASTER-VKORG,                  S_BRSCH FOR KNA1-BRSCH,                  S_SPART FOR /ATU/STOREMASTER-SPART,                  S_OMODE FOR /ATU/STOREMASTER-/ATU/STORETYPE,                  S_KDGRP FOR KNVV-KDGRP,                  S_KDKG1 FOR KNA1-KDKG1,                  s_KONZS FOR KNA1-KONZS,                  s_VWERK FOR KNVV-VWERK,                  s_LGORT FOR /ATU/STOREMASTER-LGORT,                  S_VKGRP FOR KNVV-VKGRP,                  S_VKTXT FOR ZSSTORE02-VKTXT NO INTERVALS,                  S_VKBUR FOR KNVV-VKBUR,                  S_VBTXT FOR ZSSTORE02-VBTXT NO INTERVALS,                  S_BZIRK FOR KNVV-BZIRK,                  S_BZTXT FOR ZSSTORE02-BZTXT NO INTERVALS.SELECTION-SCREEN END OF BLOCK B1.SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.  PARAMETERS: P_SHOWA AS CHECKBOX DEFAULT ‘‘,              P_SHOWP AS CHECKBOX DEFAULT ‘‘,              P_SHOWC AS CHECKBOX DEFAULT ‘‘,"显示关闭店              P_SHOWQ AS CHECKBOX DEFAULT ‘‘.SELECTION-SCREEN END OF BLOCK B2.START-OF-SELECTION.  PERFORM FRM_GET_LIST.  PERFORM FRM_DEFINE_STRUCTURE.  PERFORM FRM_CREATE_TABLE.  PERFORM FRM_FILL_TABLE.  PERFORM FRM_SHOW_ALV.

 


INCLUDE ZSDR004I01.

FORM user_command USING r_ucomm LIKE sy-ucomm                        rs_selfield TYPE slis_selfield.  READ TABLE it_data INDEX rs_selfield-tabindex.  CASE r_ucomm.    WHEN &IC1.      DATA: bdcdata_wa  TYPE bdcdata,            bdcdata_tab TYPE TABLE OF bdcdata.      DATA opt TYPE ctu_params.      CLEAR bdcdata_wa.      bdcdata_wa-program  = /ATU/CA_STORE_MASTER.      bdcdata_wa-dynpro   = 0050.      bdcdata_wa-dynbegin = X.      APPEND bdcdata_wa TO bdcdata_tab.      CLEAR bdcdata_wa.      bdcdata_wa-fnam = BDC_CURSOR.      bdcdata_wa-fval = /ATU/STOREMASTER-/ATU/STORE_ID.      APPEND bdcdata_wa TO bdcdata_tab.      CLEAR bdcdata_wa.      bdcdata_wa-fnam = /ATU/STOREMASTER-/ATU/STORE_ID.      bdcdata_wa-fval = it_data-kunnr.      APPEND bdcdata_wa TO bdcdata_tab.      opt-dismode = E.      CALL TRANSACTION /ATU/STORE3 USING bdcdata_tab OPTIONS FROM opt.  ENDCASE.  " 刷新ALV报表  rs_selfield-row_stable = rs_selfield-tabindex.  rs_selfield-refresh = X.ENDFORM.

 


INCLUDE ZSDR004F01.

FORM FRM_GET_LIST.  RANGES: lra_kunnr for kna1-kunnr.  CLEAR: IT_ZSTORE_A,IT_DATA,it_ZMAP_VFILD,it_ZMAP_TFILD,it_ZST_SEAN_PATTR.  REFRESH: IT_ZSTORE_A,IT_DATA,it_ZMAP_VFILD,it_ZMAP_TFILD,it_ZST_SEAN_PATTR.  CALL FUNCTION ZSD_GET_STORE    EXPORTING      IV_BLOCK     = P_SHOWC      IV_SHOWTXT   = X      IV_SHOWAREA  = P_SHOWA      IV_SHOWQR    = P_SHOWP    TABLES      IT_3ADCCU    = S_3ADCCU      IT_KUNNR     = S_KUNNR      IT_NAME1     = S_NAME1      IT_BZIRK     = S_BZIRK      IT_VKORG     = S_VKORG      IT_VKGRP     = S_VKGRP      IT_VKBUR     = S_VKBUR      IT_KATR2     = S_KATR2      IT_STORETYPE = S_OMODE      IT_KDGRP     = S_KDGRP      IT_KDKG1     = S_KDKG1      IT_KONZS     = S_KONZS      IT_VWERK     = S_VWERK      IT_LGORT     = S_LGORT      ET_STORE     = IT_DATA      ET_STORE_A   = IT_ZSTORE_A      ET_STORE_AR  = IT_ZSTORE_AR      ET_STORE_Q   = IT_3ASEAN      ET_STORE_QR  = IT_ZSTORE_QR.  DELETE IT_DATA WHERE VKTXT NOT IN S_VKTXT OR VBTXT NOT IN S_VBTXT OR BZTXT NOT IN S_BZTXT.  DELETE IT_DATA WHERE STORETYPE eq DC.  SORT IT_ZSTORE_A BY ZAREA.  SORT IT_3ASEAN BY J_3ASEAN.  if P_SHOWQ eq X.    "取季节属性    LOOP AT IT_DATA.      clear lra_kunnr.      lra_kunnr-sign = I.      lra_kunnr-option = EQ.      lra_kunnr-low  = IT_DATA-KUNNR.      COLLECT lra_kunnr.    ENDLOOP.    CALL FUNCTION ZSD_GET_STORE_SEAN_ATTR      TABLES        IT_STORE      = lra_kunnr        ET_MAP_VALUE  = it_ZMAP_VFILD        ET_MAP_TEXT   = it_ZMAP_TFILD        ET_DATA       = it_ZST_SEAN_PATTR.  endif.ENDFORM.                    "FRM_GET_LIST"定义内表结构*&---------------------------------------------------------------------**&      Form  FRM_DEFINE_STRUCTURE*&---------------------------------------------------------------------**       text*----------------------------------------------------------------------*FORM FRM_DEFINE_STRUCTURE.  DATA: LS_TABLE TYPE DNTAB,        IT_TABLE TYPE TABLE OF DNTAB.  "根据表名取出表结构的字段目录  CALL FUNCTION NAMETAB_GET    EXPORTING      LANGU          = SY-LANGU      TABNAME        = ZSSTORE02    TABLES      NAMETAB        = IT_TABLE    EXCEPTIONS      NO_TEXTS_FOUND = 1.  LOOP AT IT_TABLE INTO LS_TABLE.    CLEAR LS_ALV_CAT.    LS_ALV_CAT-FIELDNAME = LS_TABLE-FIELDNAME.    LS_ALV_CAT-INTLEN    = LS_TABLE-INTLEN.    APPEND LS_ALV_CAT TO IT_ALV_CAT.  ENDLOOP.  IT_ALV_CAT_S[] = IT_ALV_CAT[].  IF P_SHOWA EQ X.    LOOP AT IT_ZSTORE_A.      CLEAR LS_ALV_CAT.      LS_ALV_CAT-FIELDNAME = IT_ZSTORE_A-ZAREA.      APPEND LS_ALV_CAT TO IT_ALV_CAT.    ENDLOOP.  ENDIF.  IF P_SHOWP EQ X.    LOOP AT IT_3ASEAN.      CLEAR LS_ALV_CAT.      LS_ALV_CAT-FIELDNAME = IT_3ASEAN-J_3ASEAN.      APPEND LS_ALV_CAT TO IT_ALV_CAT.    ENDLOOP.  ENDIF.  if P_SHOWQ eq X.    LOOP AT IT_ZMAP_TFILD.      CLEAR LS_ALV_CAT.      LS_ALV_CAT-FIELDNAME = IT_ZMAP_TFILD-FIELDNAME.      APPEND LS_ALV_CAT TO IT_ALV_CAT.    ENDLOOP.  ENDIF.ENDFORM.                    "FRM_DEFINE_STRUCTURE"创建动态内表*&---------------------------------------------------------------------**&      Form  FRM_CREATE_TABLE*&---------------------------------------------------------------------**       text*----------------------------------------------------------------------*FORM FRM_CREATE_TABLE.  DATA: DY_TABLE TYPE REF TO DATA,  DY_LINE TYPE REF TO DATA.  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE    EXPORTING      IT_FIELDCATALOG = IT_ALV_CAT    IMPORTING      EP_TABLE        = DY_TABLE.  ASSIGN DY_TABLE->* TO <DYN_TABLE>.  CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.  ASSIGN DY_LINE->* TO <DYN_WA>.ENDFORM.                    "FRM_CREATE_TABLE"填 充内表*&---------------------------------------------------------------------**&      Form  FRM_FILL_TABLE*&---------------------------------------------------------------------**       text*----------------------------------------------------------------------*FORM FRM_FILL_TABLE.  FIELD-SYMBOLS: <DYN_FIELD_TEMP> TYPE ANY.  DATA:LV_FIELD(50) TYPE C.  SORT IT_DATA BY KUNNR.  LOOP AT IT_DATA.    CLEAR: <DYN_WA>.    LOOP AT IT_ALV_CAT_S INTO LS_ALV_CAT.      CLEAR LV_FIELD.      CONCATENATE IT_DATA- LS_ALV_CAT-FIELDNAME INTO LV_FIELD.      ASSIGN (LV_FIELD) TO <DYN_FIELD_TEMP>.      ASSIGN COMPONENT LS_ALV_CAT-FIELDNAME OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.      <DYN_FIELD> = <DYN_FIELD_TEMP>.    ENDLOOP.    IF P_SHOWA EQ X.      LOOP AT IT_ZSTORE_AR WHERE KUNNR = IT_DATA-KUNNR.        ASSIGN COMPONENT IT_ZSTORE_AR-ZAREA OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.        <DYN_FIELD> = IT_ZSTORE_AR-VALUE.      ENDLOOP.    ENDIF.    IF P_SHOWP EQ X.      LOOP AT IT_ZSTORE_QR WHERE KUNNR = IT_DATA-KUNNR.        ASSIGN COMPONENT IT_ZSTORE_QR-QUART OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.        <DYN_FIELD> = IT_ZSTORE_QR-KDKG1.      ENDLOOP.    ENDIF.    if P_SHOWQ eq X.      LOOP AT it_ZST_SEAN_PATTR WHERE KUNNR = IT_DATA-KUNNR.        LOOP AT IT_ZMAP_TFILD.          CLEAR LV_FIELD.          CONCATENATE IT_ZST_SEAN_PATTR- IT_ZMAP_TFILD-FIELDNAME INTO LV_FIELD.          ASSIGN (LV_FIELD) TO <DYN_FIELD_TEMP>.          ASSIGN COMPONENT IT_ZMAP_TFILD-FIELDNAME OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.          <DYN_FIELD> = <DYN_FIELD_TEMP>.        ENDLOOP.      ENDLOOP.    endif.    APPEND <DYN_WA> TO <DYN_TABLE>.  ENDLOOP.ENDFORM.                    "FRM_FILL_TABLE*&---------------------------------------------------------------------**&      Form  FRM_SHOW_ALV*&---------------------------------------------------------------------**       text*----------------------------------------------------------------------*FORM FRM_SHOW_ALV.  DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,        LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,        LS_LAYOUT TYPE SLIS_LAYOUT_ALV.  CLEAR LS_LAYOUT.  LS_LAYOUT-EDIT              = ‘‘.  LS_LAYOUT-EDIT_MODE         = SPACE.  LS_LAYOUT-ZEBRA             = X.  LS_LAYOUT-COLWIDTH_OPTIMIZE = ‘‘.  DEFINE ADD_FIELD.    CLEAR: LS_FIELDCAT.    LS_FIELDCAT-FIELDNAME    = &1.    LS_FIELDCAT-REPTEXT_DDIC = &2.    LS_FIELDCAT-INTLEN       = &3.    LS_FIELDCAT-DO_SUM       = &4.    LS_FIELDCAT-NO_ZERO      = &5.    LS_FIELDCAT-KEY          = &6.    LS_FIELDCAT-FIX_COLUMN   = &7.    APPEND LS_FIELDCAT TO IT_FIELDCAT.  END-OF-DEFINITION.  ADD_FIELD J_3ADCCU 总店编号 10 ‘‘ ‘‘ X X.  ADD_FIELD KUNNR 子店编号 10 ‘‘ ‘‘ X X.  ADD_FIELD NAME1 名称 20 ‘‘ ‘‘ X X.  ADD_FIELD LOEVM 关闭 4 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD STORETYPETXT 运营模式 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VKORG 销售机构 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VKORGTXT 销售机构名称 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD BRSCH 营销品牌 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD BRSCHTXT 营销品牌名称 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPART 品牌 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD KATR2TXT 店铺类型 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD KDGRPTXT 客户组 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD KONZS 商场 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD KDKG1 门店属性 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VWERK 交货工厂 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD LPRIO 交货优先权 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD LGORT 库存地点 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/REGION 门店地区 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/DISTRICT 所属经营部 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/AREA 商圈 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/ST_SEL_AREA 营业面积 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/STORE_AREA 建筑面积 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/NUM_WINDOWS 橱窗数量 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD /ATU/NUM_REGSTER 导购人数 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD DATLT 联系人 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VIPAR 积分区域 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD TELF1 电话 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD TELF2 移动电话 11 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD TELFX 传真 10 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD P_TEL1 电话号码1 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD P_TEL2 电话号码2 8 ‘‘ ‘‘ ‘‘ ‘‘.  "ADD_FIELD ‘REMARK‘ ‘VOIP电话‘ 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD P_TFX 传真号码 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VKTXT 主管 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD BZTXT 地区 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD VBTXT 管理区域 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD RETXT  8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD ORT01 城市 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD PSTLZ 邮政编码 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD TELBX 承运商 8 ‘‘ ‘‘ ‘‘ ‘‘.  add_field CITY2 收货城市 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD STR_SUPPL1 收货地址 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD STRAS 门店地址 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SENDDAY 发送周期 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD BACKDAY 退货周期 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD OPENINGDATE 开店日期 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD REMODDATE 改型日期 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD CLOSINGDATE 关店日期 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SMSNM 短信接收人 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SMSTL 短信接收号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SMSNM_D 调拨短信接收人 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SMSTL_D 调拨短信接收号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SMSFQ 短信发送频率 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD RTE_NBR 运输区域 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL1 周一波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL2 周二波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL3 周三波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL4 周四波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL5 周五波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL6 周六波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  ADD_FIELD SPL7 周七波次序号 8 ‘‘ ‘‘ ‘‘ ‘‘.  IF P_SHOWA EQ X.    LOOP AT IT_ZSTORE_A.      ADD_FIELD IT_ZSTORE_A-ZAREA IT_ZSTORE_A-NAME1 6 ‘‘ ‘‘ ‘‘ ‘‘.    ENDLOOP.  ENDIF.  IF P_SHOWP EQ X.    LOOP AT IT_3ASEAN.      ADD_FIELD IT_3ASEAN-J_3ASEAN IT_3ASEAN-TEXT 6 ‘‘ ‘‘ ‘‘ ‘‘.    ENDLOOP.  ENDIF.  if P_SHOWQ eq X.    LOOP AT IT_ZMAP_TFILD.      ADD_FIELD IT_ZMAP_TFILD-FIELDNAME IT_ZMAP_TFILD-DDTEXT 10 ‘‘ ‘‘ ‘‘ ‘‘.    ENDLOOP.  ENDIF.  CALL FUNCTION REUSE_ALV_GRID_DISPLAY    EXPORTING      I_CALLBACK_PROGRAM      = SY-REPID      IT_FIELDCAT             = IT_FIELDCAT      IS_LAYOUT               = LS_LAYOUT              "i_callback_pf_status_set = ‘SET_PF_STATUS‘      I_CALLBACK_USER_COMMAND = USER_COMMAND      I_SAVE                  = A    TABLES      T_OUTTAB                = <DYN_TABLE>.  IF SY-SUBRC <> 0.    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.  ENDIF.ENDFORM.                    "FRM_SHOW_ALV

 

门店查询报表