标签:style blog color io os ar for sp div
REPORT ZSDR035.
INCLUDE ZSDR035TOP.
TABLES: KNA1,MKPF,MSEG,MEAN. DATA: lt_data like TABLE OF ZSMBLIST WITH HEADER LINE. DATA: BEGIN OF lt_data_out OCCURS 0. INCLUDE STRUCTURE ZSMBLIST. DATA: COLOR TYPE slis_t_specialcol_alv. DATA: END OF lt_data_out.
INCLUDE ZSDR035SCR.
SELECTION-SCREEN BEGIN OF BLOCK blkr WITH FRAME TITLE text-r01. SELECT-OPTIONS: s_kunnr FOR kna1-kunnr OBLIGATORY, s_budat FOR mkpf-budat, s_CPUDT FOR mkpf-CPUDT DEFAULT sy-datum TO sy-datum, s_BWART FOR MSEG-BWART, s_matnr FOR mseg-matnr, S_SIZE FOR MEAN-J_3AKORDX, s_MBLNR FOR mkpf-MBLNR. SELECTION-SCREEN END OF BLOCK blkr. START-OF-SELECTION. PERFORM FRM_GET_DATA. PERFORM FRM_SET_COLOR. PERFORM FRM_SHOW_ALV.
INCLUDE ZSDR035F01.
FORM FRM_GET_DATA. clear: lt_data,lt_data[]. CALL FUNCTION ‘ZSD_POS_GET_MB_ITEM_LIST‘ EXPORTING IV_SHOWMP = ‘X‘ TABLES IT_KUNNR = S_KUNNR IT_BUDAT = S_BUDAT IT_BLDAT = s_CPUDT IT_MBLNR = S_MBLNR IT_BWART = S_BWART IT_MATNR = S_MATNR IT_SIZE = S_SIZE ET_DATA = lt_DATA. sort lt_DATA by MBLNR MJAHR ZEILE. ENDFORM. FORM FRM_SET_COLOR. DATA: lt_cellcolor type slis_t_specialcol_alv with header line. LOOP AT lt_data. clear: lt_data_out,lt_cellcolor. REFRESH lt_cellcolor. MOVE-CORRESPONDING lt_data to lt_data_out. lt_cellcolor-fieldname = ‘MENGE‘. "列名 if lt_data_out-SHKZG eq ‘H‘. lt_cellcolor-COLOR-col = ‘6‘. lt_cellcolor-COLOR-int = ‘0‘. lt_cellcolor-COLOR-inv = ‘0‘. elseif lt_data_out-SHKZG eq ‘S‘. lt_cellcolor-COLOR-col = ‘5‘. lt_cellcolor-COLOR-int = ‘0‘. lt_cellcolor-COLOR-inv = ‘0‘. endif. APPEND lt_cellcolor. lt_data_out-COLOR[] = lt_cellcolor[]. append lt_data_out. ENDLOOP. ENDFORM. 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-coltab_fieldname = ‘COLOR‘. " 列颜色字段 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-hotspot = &7. ls_fieldcat-emphasize = &8. append ls_fieldcat to it_fieldcat. END-OF-DEFINITION. add_field ‘KUNNR‘ ‘客户编号‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘NAME1‘ ‘客户名称‘ 30 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘MBLNR‘ ‘物料凭证‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘C110‘. add_field ‘MJAHR‘ ‘凭证年度‘ 6 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘ZEILE‘ ‘凭证项目‘ 6 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘BWART‘ ‘移动类型‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘BIZTP‘ ‘类型描述‘ 16 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘GRUND‘ ‘移动原因‘ 8 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘BUDAT‘ ‘记帐日期‘ 12 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘MATNR‘ ‘物料号‘ 18 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘J_3ASIZE‘ ‘网格值‘ 8 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘MENGE‘ ‘数量‘ 10 ‘X‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘ZMATNR‘ ‘小货号‘ 18 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘SPART‘ ‘品牌‘ 8 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘SPARTTXT‘ ‘品牌描述‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘EXTWG‘ ‘系列‘ 8 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘EXTWGTXT‘ ‘系列描述‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. "add_field ‘EBELN‘ ‘采购订单‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘XBLNR‘ ‘参考凭证‘ 18 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘VGBEL‘ ‘销售凭证‘ 18 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘REFKUNNR‘ ‘对方门店‘ 10 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘REFNAME1‘ ‘对方名称‘ 20 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘CPUDT‘ ‘输入日期‘ 12 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘CPUTM‘ ‘输入时间‘ 12 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. add_field ‘USNAM‘ ‘用户名‘ 12 ‘‘ ‘‘ ‘‘ ‘‘ ‘‘. CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY‘ EXPORTING i_callback_program = sy-repid it_fieldcat = it_fieldcat is_layout = ls_layout i_callback_user_command = ‘USER_COMMAND_ALV‘ i_save = ‘U‘ TABLES t_outtab = lt_data_out. 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.
INCLUDE ZSDR035I01.
FORM user_command_alv USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. CASE r_ucomm. WHEN ‘&IC1‘. READ TABLE lt_data INDEX rs_selfield-tabindex. IF rs_selfield-fieldname = ‘MBLNR‘ AND rs_selfield-value <> ‘‘. SET PARAMETER ID ‘MBN‘ FIELD lt_data-mblnr. SET PARAMETER ID ‘MJA‘ FIELD lt_data-mjahr. CALL TRANSACTION ‘MB03‘ AND SKIP FIRST SCREEN. ENDIF. ENDCASE. " 刷新ALV报表 rs_selfield-row_stable = rs_selfield-tabindex. rs_selfield-refresh = ‘X‘. ENDFORM.
标签:style blog color io os ar for sp div
原文地址:http://www.cnblogs.com/qlp1982/p/4039795.html