物料主proe文件导出物料清单保存error怎么办

物料主数据的导入
个人觉得,这是这么久以来遇到的比较难的需求,第一次接触什么视图的扩充、第一次接触bapi,所以将是以代码放在这里,以便有需求的朋友参考。
& *&---------------------------------------------------------------------*
*&&Report&&ZMM_MLL_01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
REPORT&&ZMM_ML_01.
tables:&mara,"常规物料数据
&&&&&&&&marc,"物料的工厂数据
&&&&&&&&mbew,"物料的仓储位置数
&&&&&&&&makt,"物料描述
&&&&&&&&mvke."物料销售数据
data:&begin&of&itab&occurs&0,
&&&&&&matnr&like&mara-matnr,&&"物料号
&&&&&&mbrsh&like&mara-mbrsh,&&"行业领域
&&&&&&mtart&like&mara-mtart,&&"物料类型
&&&&&&maktx&like&makt-maktx,&&"物料描述
&&&&&&meins&like&mara-meins,&&"基本单位
&&&&&&bismt&like&mara-bismt,&&"旧物料编码
&&&&&&matkl&like&mara-matkl,&&"物料组
*******组织级别
&&&&&&werks&like&marc-werks,&&"工厂
&&&&&&lgort&like&mard-lgort,&&"库存地点
&&&&&&vkorg&like&mvke-vkorg,&&"销售组织
&&&&&&vtweg&like&mvke-vtweg,&&"分销渠道
*********&&&&&&销售组织1以视图
&&&&&&dwerk&like&mvke-dwerk,&&"交货工厂
&&&&&&spart&like&mara-spart,&&"部门(产品组)
&&&&&&taxkm&like&mlan-taxm1,&&"税分类
*********&&&&&&销售组织2以视图
&&&&&&ktgrm&like&mvke-ktgrm,&&"科类设计组
*******************一般/工厂视图
&&&&&&&mtvfp&like&marc-mtvfp,&&"可用性检查
&&&&&&tragr&like&mara-tragr,&&"运输组
&&&&&&ladgr&like&marc-ladgr,&&"装载组
********************维护工厂数据/存储1视图
&&&&&&mhdrz&like&mara-mhdrz,&"最小剩余货架寿命
&&&&&&mhdhb&like&mara-mhdhb,&"总货架寿命
end&of&itab.
&&&&&data:begin&of&t_itab&occurs&0,
&&&&&&matnr&type&marc-matnr,
&&&&&&end&of&t_itab.
&&&&&&data:begin&of&t_itab01&occurs&0,
&&&&&&&&&me03(50)&type&c,
&&&&&&end&of&t_itab01.
data:&wa_header&like&bapimathead,"带有控制信息的表头段,也就是各视图
&&&&&&wa_mara&&&like&bapi_mara,"客户端层次物料数据
&&&&&&wa_marax&&like&bapi_marax,"BAPI_MARA&的复选框结构
&&&&&&wa_marc&&&like&bapi_marc,"工厂级别的物料数据
&&&&&&wa_marcx&&like&bapi_marcx,"BAPI_MARC&的复选框结构
&&&&&&wa_mard&&&like&bapi_mard,"存储位置级别的物料数据
&&&&&&wa_mardx&&like&bapi_mardx,"
&&&&&&wa_mvke&&&like&bapi_mvke,"销售数据
&&&&&&wa_mvkex&&like&bapi_mvkex,"
&&&&&&wa_return&like&bapiret2,"用来判断返回情况
&&&&&&it_makt&&&like&bapi_makt&&occurs&0&with&header&line,
&&&&&&it_marm&&&like&bapi_marm&&occurs&0&with&header&line,
&&&&&&it_marmx&&like&bapi_marmx&occurs&0&with&header&line,
&&&&&&it_mlan&&&like&bapi_mlan&&occurs&0&with&header&line.
*&&&&&bapi_makt:物料描述
*&&&&&bapi_marm:计量单位
*&&&&&bapi_marmx:BAPI_MARM&的复选框结构
*&&&&&bapi_mlan:税收数据
constants:&gc_x&type&c&value&'X'."标志
data:l_unit&like&mara-meins."基本单位
*******************定义的在alv上展示的结构
data:&begin&of&it_message&occurs&0,
&&&&&&flag(1),
&&&&&&&&&index&&like&sy-tabix,
&&&&&&&&&matnr&&like&mara-matnr,
&&&&&&&&&maktx&&like&makt-maktx,
&&&&&&&&&msgtp&&type&bapi_mtype,
&&&&&&&&&id&&&&&type&symsgid,
&&&&&&&&&number&type&symsgno,
&&&&&&&&&text(220),
&&&&&&end&of&it_message.
data:&g_lines(10),"统计内表数据条,
&&&&&&g_text(20),
&&&&&&g_answer(1).
data:&l_mtart&&&&&&&type&mara-mtart,"物料类型
&&&&&&l_bapireturn1&like&bapireturn1,"返回参数
&&&&&&it_num&&&&&&&&like&bapimatinr&occurs&0&with&header&line,"物料编号,用来接收自动生成的号
&&&&&&l_mbrsh&&&&&&&type&mara-mbrsh."行业领域
****定义临时变量
data:&l_matnr&type&mara-matnr.&&&&&&"物料号*
************************************************************************
*&&&&&&&&&&&&&&&&&&&&&&ABOUT&ALV
************************************************************************
*创建ALV必不可少的组件
type-pools:&slis.
data:&afield&&&&&&&&type&slis_fieldcat_alv,
&&&&&&fieldcat&&&&&&type&slis_t_fieldcat_alv,
&&&&&&gs_layout&&&&&type&slis_layout_alv,
&&&&&&g_repid&&&&&&&type&sy-repid,
&&&&&&i_layout&&&&&&type&slis_layout_alv,
&&&&&&gridlsl&&&&&&&type&lvc_s_glay,
&&&&&&u_er_fieldcat&type&slis_t_fieldcat_alv.
************************************************************************
*&SELECTION-SCREEN&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
************************************************************************
selection-screen&begin&of&block&&blk&with&frame&title&text01.
*PARAMETERS:&p_inpath&TYPE&string.
parameters:p_inpath&like&rlgrap-filename&obligatory.
selection-screen&end&of&block&blk.
************************************************************************
*&INITIALIZATION&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
************************************************************************
initialization.
&&g_repid&=&sy-repid."这句代码表示掉用系统的字段,千万不敢丢掉啊~~~~~~
&&text01&=&'物料主数据批量导入'.
************************************************************************
*&AT&SELECTION-SCREEN&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
************************************************************************
at&selection-screen&on&value-request&for&p_inpath.
&&perform&get_pc_filename&."USING&p_inpath.
************************************************************************
*&START-OF-SELECTION&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
************************************************************************
start-of-selection.
&&perform&upload_data.
&&perform&frm_prepare.
&&perform&frm_get_data.
&&perform&disp_data.
*&---------------------------------------------------------------------*
*&&&&&&&Form&&get_pc_filename
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&&&&&--&P_P_INPATH&&text
**----------------------------------------------------------------------*
form&get_pc_filename&.
******&&*fieldtable是一个表类型,描述文件名字的表
&&data:&&&l_filetab&type&filetable,
&&&&&&&&&&l_waftab&&like&line&of&l_filetab,
&&&&&&&&&&l_rc&&&&&&type&i.
&&call&method&cl_gui_frontend_services=&file_open_dialog
&&&&exporting
&&&&&&window_title&&&&&&&&&&&&=&'打开文件'
*&&&&&DEFAULT_EXTENSION&&&&&&&=
*&&&&&DEFAULT_FILENAME&&&&&&&&=
*&&&&&FILE_FILTER&&&&&&&&&&&&&=
*&&&&&WITH_ENCODING&&&&&&&&&&&=
&&&&&&initial_directory&&&&&&&=&'C:/'
*&&&&&MULTISELECTION&&&&&&&&&&=
&&&&changing
&&&&&&file_table&&&&&&&&&&&&&&=&l_filetab
&&&&&&rc&&&&&&&&&&&&&&&&&&&&&&=&l_rc
*&&&&&USER_ACTION&&&&&&&&&&&&&=
*&&&&&FILE_ENCODING&&&&&&&&&&&=
&&&&exceptions
&&&&&&file_open_dialog_failed&=&1
&&&&&&cntl_error&&&&&&&&&&&&&&=&2
&&&&&&error_no_gui&&&&&&&&&&&&=&3
&&&&&&not_supported_by_gui&&&&=&4
&&&&&&others&&&&&&&&&&&&&&&&&&=&5.
****&&*调用系统的消息类
&&if&sy-subrc&&&&0.
&&&&message&id&sy-msgid&type&sy-msgty&number&sy-msgno
&&&&with&sy-msgv1&sy-msgv2&sy-msgv3&sy-msgv4.
&&&&read&table&l_filetab&into&l_waftab&index&1.
&&&&p_inpath&=&l_waftab-filename.
&&&&clear:&l_filetab,
&&&&&&&&&&&l_waftab.
endform.&&&&&&&&&&&&&&&&&&&&"get_pc_filename
*---------------------------------------------------------------------*
*&&&&&&&FORM&UPLOAD_DATA&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
*---------------------------------------------------------------------*
*&&&&&&&........&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*
*---------------------------------------------------------------------*
form&upload_data.
&&clear:itab,&itab[].
&&data&lt_excel&type&table&of&alsmex_tabline&with&header&line.
&&data&l_index&like&sy-tabix.
&&field-symbols&.
&&call&function&'ALSM_EXCEL_TO_INTERNAL_TABLE'
&&&&exporting
&&&&&&filename&&&&&&&&&&&&&&&&=&p_inpath
&&&&&&i_begin_col&&&&&&&&&&&&&=&'1'"开始的列
&&&&&&i_begin_row&&&&&&&&&&&&&=&'2'"开始的行
&&&&&&i_end_col&&&&&&&&&&&&&&&=&'5000'"结束的列
&&&&&&i_end_row&&&&&&&&&&&&&&&=&'500000'
&&&&tables
&&&&&&intern&&&&&&&&&&&&&&&&&&=&lt_excel"定义的用来放excel中的数据的内表
&&&&exceptions
&&&&&&inconsistent_parameters&=&1
&&&&&&upload_ole&&&&&&&&&&&&&&=&2
&&&&&&others&&&&&&&&&&&&&&&&&&=&3.
&&if&sy-subrc&&&&0.
&&&&message&id&sy-msgid&type&sy-msgty&number&sy-msgno
&&&&&&&&&&&&with&sy-msgv1&sy-msgv2&sy-msgv3&sy-msgv4.
*&&&将EXCEL格式中的数据导入到内表itab中
&&loop&at&lt_excel.
&&&&move&lt_excel-col&to&l_index.
&&&&assign&component&l_index&of&structure&itab&to&.
&&&&move&lt_excel-value&to&.
&&&&at&end&of&row.
*&&&&&&TRANSLATE&gt_user-uname&TO&UPPER&CASE.
&&&&&&append&itab.
&&&&&&clear&itab.
&&&&endat.
&&endloop.
endform.&&&&&&&&&&&&&&&&&&&&"&UPLOAD_DATA
*&---------------------------------------------------------------------*
*&&&&&&&Form&&FRM_PREPARE
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&--&&&p1&&&&&&&&text
*&&&--&&p2&&&&&&&&text
*----------------------------------------------------------------------*
form&frm_prepare&.
&&&&select&matnr&from&marc
&&&&&&&&into&corresponding&fields&of&table&t_itab.
endform.&&&&&&&&&&&&&&&&&&&&"&FRM_PREPARE
*&---------------------------------------------------------------------*
*&&&&&&&Form&&FRM_GET_DATA
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&--&&&p1&&&&&&&&text
*&&&--&&p2&&&&&&&&text
*----------------------------------------------------------------------*
form&frm_get_data&.
&&data:&l_line(10),
&&&&&&&&l_percent(6),
&&&&&&&&l_text(40).
&&describe&table&itab&lines&g_lines.
&&concatenate&'确认总共是'&g_lines&'条物料吗?'&into&g_text.
&&condense&g_text.
&&call&function&'POPUP_TO_CONFIRM_STEP'"弹出确认框
&&&&exporting
&&&&&&textline1&=&g_text
&&&&&&titel&&&&&=&'确认'
&&&&importing
&&&&&&answer&&&&=&g_answer.
&&case&g_answer.
&&&&when&'J'.
&&&&when&others.
&&&&&&return.
&&endcase.
&&loop&at&itab.
*&&&&&&data:me01(18),
*&&&&&&&&&&&me02(50).
&if&itab-matnr&is&not&initial.
&&&&&&clear&l_matnr.
&&&&&&perform&add_zero&using&itab-matnr&changing&l_matnr."物料号补0
&&&&&&itab-matnr&=&l_matnr.
*&&&&read&table&t_itab&with&key&matnr&=&itab-matnr.
*&&&&if&sy-subrc&&&&0.
*&&&&&&me01&=&itab-matnr.
*&&&&&&&&concatenate&'物料号'&me01&'不存在,不能进行视图扩充'&into&me02.
**&&&&&&&&MESSAGE&ME02&TYPE&'I'.
*&&&&&&&&t_itab01-me03&=&me02.
*&&&&&&&&append&t_itab01.
*&&&&&&&&clear&t_itab01.
*&&&&endif.
*&&&&endif.
&&endloop.
*&&&&if&t_itab01[]&is&not&initial.
*&&&&&&&&&&&&loop&at&t_itab01.
*&&&&&&&&&&&&&&&&&&write:/&t_itab01-me03.
*&&&&&&&&&&&&endloop.
*&&&&&&&&&&&&stop.
*&&&&&&&&&&&&return.
*&&&&endif.
&loop&at&itab.
&&&&translate&itab-lgort&to&upper&case.
&&&&l_line&=&l_line&+&1.
&&&&l_percent&=&l_line&*&100&/&g_lines."计算现在的进度
&&&&concatenate&'已完成'&l_line&'条/'&g_lines&'条'&into&l_text.
&&&&condense&l_text.
&&&&call&function&'SAPGUI_PROGRESS_INDICATOR'"进度条函数
&&&&&&exporting
&&&&&&&&percentage&=&l_percent
&&&&&&&&text&&&&&&&=&l_text.
&&&&clear:&l_percent,l_text.
**自动产生物料号
&&&&if&itab-matnr&is&initial.
&&&&&&data:mm(4)&type&c."不同的物料类型,,不同的号码范围
&&&&&&clear&mm.
&&&&&&mm&=&itab-mtart.
&&&&&&call&function&'BAPI_MATERIAL_GETINTNUMBER'
&&&&&&&&exporting
&&&&&&&&&&material_type&&&&=&mm
&&&&&&&&&&industry_sector&&=&'M'
&&&&&&&&&&required_numbers&=&1
&&&&&&&&importing
&&&&&&&&&&return&&&&&&&&&&&=&l_bapireturn1
&&&&&&&&tables
&&&&&&&&&&material_number&&=&it_num.
&&&&&&if&l_bapireturn1-type&ca&'EA'."如果是错误或中断就回滚~~~
&&&&&&&&rollback&work.
&&&&&&else.
&&&&&&&&loop&at&it_num.
&&&&&&&&&&itab-matnr&=&it_num-material.
&&&&&&&&endloop.
&&&&&&endif.
&&&&&&CALL&FUNCTION&'CONVERSION_EXIT_MATN1_INPUT'
&&&&&&EXPORTING
&&&&&&&&input&&=&itab-matnr
&&&&&&IMPORTING
&&&&&&&&output&=&itab-matnr.
*&endloop.
*******************************************************************************
***&插入wa_header
&&wa_header-material&&&&&&=&itab-matnr."物料号
&&wa_header-ind_sector&&&&=&itab-mbrsh."行业领域
&&wa_header-matl_type&&&&&=&itab-mtart."物料类型
&&wa_header-basic_view&&&&=&gc_x."基本视图
&&wa_header-sales_view&&&&=&gc_x."销售视图
&&wa_header-purchase_view&=&gc_x."采购视图
&&wa_header-storage_view&&=&gc_x."存储视图
***插入wa_mara
&&wa_mara-matl_group&&&&&&=&itab-matkl."物料组
PERFORM&&get_meins&USING&itab-meins&&CHANGING&l_unit.
&&wa_mara-base_uom&&&&&&&&=&l_unit."计量单位
&&wa_mara-old_mat_no&&&&&&=&itab-bismt."旧物料号
&&wa_mara-division&&&&&&&&=&itab-spart."产品组
&&wa_mara-trans_grp&&&&&&&=&itab-tragr."运输组
&&wa_marax-matl_group&&&&&&=&gc_x.
&&wa_marax-base_uom&&&&&&&&=&gc_x.
&&wa_marax-base_uom_iso&&&&=&gc_x.
&&wa_marax-old_mat_no&&&&&&=&gc_x.
&&wa_marax-division&&&&&&&&=&gc_x.
&&wa_marax-trans_grp&&&&&&&=&gc_x.
***插入marc
&&&&wa_marc-plant&&&&&&&&&&&&=&itab-werks."工厂
&&&&wa_marc-availcheck&&&&&&&=&itab-mtvfp."可用性检查
&&&&wa_marc-loadinggrp&&&&&&&=&itab-ladgr."装载组
***插入marcx
&&&&wa_marcx-plant&&&&&&&&&&&&=&itab-werks.
&&&&wa_marcx-availcheck&&&&&&&=&gc_x.
&&&&wa_marcx-loadinggrp&&&&&&&=&gc_x.
**插入mard
&&&&wa_mard-plant&&&&&&&&&&&&&=&itab-werks.
&&&&wa_mard-stge_loc&&&&&&&&&&=&itab-lgort."库存地点
***插入mardx
&&&&wa_mardx-plant&&&&&&&&&&&&=&itab-werks.
&&&&wa_mardx-stge_loc&&&&&&&&&=&itab-lgort.
***插入mvke
&&&&wa_mvke-sales_org&&&&&&&&&&=&itab-vkorg."销售组织
&&&&wa_mvke-distr_chan&&&&&&&&&=&itab-vtweg."分销渠道
&&&&wa_mvke-delyg_plnt&&&&&&&&&=&itab-dwerk."交货工厂
&&&&wa_mvke-acct_assgt&&&&&&&&&=&itab-ktgrm."科目设置组
***插入mvkex
&&&&wa_mvkex-sales_org&&&&&&&&&&&=&itab-vkorg.
&&&&wa_mvkex-distr_chan&&&&&&&&&&=&itab-vtweg.
&&&&wa_mvkex-delyg_plnt&&&&&&&&&&=&gc_x.
&&&&wa_mvkex-item_cat&&&&&&&&&&&&=&gc_x.
&&&&wa_mvkex-acct_assgt&&&&&&&&&&=&gc_x.
***插入makt
&&it_makt-langu&&&&&&&&&&&&&&=&sy-langu.
&&SELECT&SINGLE&laiso
&&&&FROM&t002
&&&&INTO&it_makt-langu_iso
&&WHERE&spras&=&sy-langu.
&&it_makt-matl_desc&&&&&&&&&&=&itab-maktx."物料描述
&&APPEND&it_makt.
&&&&it_mlan-depcountry&&&&&&&&&&=&'DE'.
&&&&it_mlan-depcountry_iso&&&&&&=&'CN'.
&&&&it_mlan-tax_type_1&&&&&&&&&&=&'MWST'.
&&&&it_mlan-taxclass_1&&&&&&&&&&=&itab-taxkm."税分类
&&&&APPEND&it_mlan.
*****************************************************************************************operate&bapi
&&&&CALL&FUNCTION&'BAPI_MATERIAL_SAVEDATA'
&&&&EXPORTING
&&&&&&headdata&&&&&&&&&&&&&=&wa_header
&&&&&&clientdata&&&&&&&&&&&=&wa_mara
&&&&&&clientdatax&&&&&&&&&&=&wa_marax
&&&&&&plantdata&&&&&&&&&&&&=&wa_marc
&&&&&&plantdatax&&&&&&&&&&&=&wa_marcx
&&&&&&storagelocationdata&&=&wa_mard
&&&&&&storagelocationdatax&=&wa_mardx
&&&&&&salesdata&&&&&&&&&&&&=&wa_mvke
&&&&&&salesdatax&&&&&&&&&&&=&wa_mvkex
&&&&IMPORTING
&&&&&&return&&&&&&&&&&&&&&&=&wa_return
&&&&TABLES
&&&&&&materialdescription&&=&it_makt
&&&&&&unitsofmeasure&&&&&&&=&it_marm
&&&&&&unitsofmeasurex&&&&&&=&it_marmx
&&&&&&taxclassifications&&&=&it_mlan.
&&&&it_message-index&=&l_line.
&&&&it_message-matnr&=&itab-matnr.
&&&&it_message-maktx&=&itab-maktx.
&&&&it_message-msgtp&=&wa_return-type.
&&&&it_message-id&&&&=&wa_return-id.
&&&&it_message-number&=&wa_return-number.
&&&&select&single&text
&&&&&&from&t100
&&&&&&into&it_message-text
&&&&where&sprsl&=&sy-langu&and
&&&&&&&&&&arbgb&=&it_message-id&and
&&&&&&&&&&msgnr&=&it_message-number.
&&&&replace&first&occurrence&of&'&'&&in&it_message-text&&with&wa_return-message_v1.
&&&&replace&first&occurrence&of&'&'&&in&it_message-text&&with&wa_return-message_v2.
&&&&replace&first&occurrence&of&'&'&&in&it_message-text&&with&wa_return-message_v3.
&&&&replace&first&occurrence&of&'&'&&in&it_message-text&&with&wa_return-message_v4.
&&&&condense&it_message-text.
&&&&append&it_message.
&&&&clear:&it_message.
&&&&if&wa_return-type&=&'E'.
&&&&&&call&function&'BAPI_TRANSACTION_ROLLBACK'.
&&&&&&call&function&'BAPI_TRANSACTION_COMMIT'
&&&&&&&&exporting
&&&&&&&&&&wait&=&gc_x.
&&&&endif.
&&&&clear:&wa_header,wa_mara,wa_marax,wa_marc,wa_marcx,wa_mard,wa_mardx,
&&&&&&&&&&&&wa_mvke,wa_mvkex,wa_return.
&&&&clear:&it_makt,it_marm,it_marmx,it_mlan,it_makt[],it_marm[],it_marmx[],
&&&&&&&&&&&it_mlan[].
&&endloop.
***显示结果
*&&PERFORM&frm_get_out.
endform.&&&&&&&&&&&&&&&&&&&&"&FRM_GET_DATA
*&---------------------------------------------------------------------*
*&&&&&&&Form&&DISP_DATA
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&--&&&p1&&&&&&&&text
*&&&--&&p2&&&&&&&&text
*----------------------------------------------------------------------*
form&disp_data&.
&&perform&layout_build.
&&perform&fieldcat_init&using&fieldcat[]."S
&&perform&display_alv.
endform.&&&&&&&&&&&&&&&&&&&&"&DISP_DATA
*&---------------------------------------------------------------------*
*&&&&&&&Form&&LAYOUT_BUILD
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&--&&&p1&&&&&&&&text
*&&&--&&p2&&&&&&&&text
*----------------------------------------------------------------------*
form&layout_build&.
&&i_layout-box_fieldname&&&&&&&&=&'FLAG'.
&&i_layout-colwidth_optimize&&&&=&'X'.&"优化列宽选项是否设置
&&i_layout-zebra&&&&&&&&&&&&&&&&=&'X'.
&&i_layout-detail_initial_lines&=&'X'.
&&i_layout-no_vline&&&&&&&&&&&&&=&'X'."&layout_build
endform.&&&&&&&&&&&&&&&&&&&&"&LAYOUT_BUILD
*&---------------------------------------------------------------------*
*&&&&&&&Form&&FIELDCAT_INIT
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&&&&&--&P_FIELDCAT[]&&text
*----------------------------------------------------------------------*
form&fieldcat_init&&using&&&&u_er_fieldcat&type&slis_t_fieldcat_alv.
&&data:&afieldcat&type&slis_fieldcat_alv,
&&&&&&&&&&&&pos&type&i.
&&clear&pos.
&&define&d_get_field.
&&&&pos&=&pos&+&1.
&&&&clear&afieldcat.
&&&&afieldcat-col_pos&&&=&&pos.
&&&&afieldcat-fieldname&=&&&1.
&&&&afieldcat-seltext_l&=&&&2.
&&&&afieldcat-key&&&&&&&=&&&3.
&&&&append&afieldcat&to&u_er_fieldcat.
&&end-of-definition.
&&d_get_field&'INDEX'&'行号'&&'10'&.
&&d_get_field&'MATNR'&'物料号'&'20'&.
&&d_get_field&'MAKTX'&'物料描述'&'40'&&.
&&d_get_field&'MSGTP'&'消息类型'&'10'&&.
&&d_get_field&'ID'&'消息类'&'10'&&.
&&d_get_field&'NUMBER'&'消息号'&'10'&&.
&&d_get_field&'TEXT'&'消息文本'&'30'&&.
endform.&&&&&&&&&&&&&&&&&&&&"&FIELDCAT_INIT
*&---------------------------------------------------------------------*
*&&&&&&&Form&&DISPLAY_ALV
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&--&&&p1&&&&&&&&text
*&&&--&&p2&&&&&&&&text
*----------------------------------------------------------------------*
form&display_alv&.
&&call&function&'REUSE_ALV_GRID_DISPLAY'
&&&&exporting
&&&&&&i_grid_settings&&&&&&&&&&=&gridlsl
&&&&&&i_callback_program&&&&&&&=&g_repid
&&&&&&i_callback_pf_status_set&=&'USER_STATUS'
&&&&&&i_callback_user_command&&=&'USER_COMMAND'
&&&&&&it_fieldcat&&&&&&&&&&&&&&=&fieldcat
&&&&&&is_layout&&&&&&&&&&&&&&&&=&i_layout
*&&&&&&&i_save&&&&&&&&&&&&&&&&&&=&'A'
*&&&&&IT_SORT&&&&&&&&&&&&&&&&&&=&IT_SORT
*&&&&&IT_EVENTS&&&&&&&&&&&&&&&&=&ER_EVENTS[]
&&&&tables
&&&&&&t_outtab&&&&&&&&&&&&&&&&&=&it_message."设置ALV显示状态和title
endform.&&&&&&&&&&&&&&&&&&&&"&DISPLAY_ALV
*&---------------------------------------------------------------------*
&form&user_command&using&ok_ucomm&like&sy-ucomm
&&&&&&&&&&&&&&&&&&&&&&&rs_selfield&type&slis_selfield.
&&rs_selfield-refresh&=&'X'.
endform.&&&&&&&&&&&&&&&&&&&&"user_command
*&---------------------------------------------------------------------*
*&&&&&&&Form&&USER_STATUS
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&&&&&--&EXTAB&&&&&&text
*----------------------------------------------------------------------*
form&user_status&using&extab&type&slis_t_extab.
&&set&pf-status&'STATUS_ALV1'.
&&set&titlebar&'TITLE_ALV'.
endform.&&&&&&&&&&&&&&&&&&&&"USER_STATUS
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&&&&&&&Form&&GET_MEINS
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&&&&&--&P_ITAB_MEINS&&text
*&&&&&&&--P_L_UNIT&&text
*----------------------------------------------------------------------*
form&GET_MEINS&&using&&&&p_itab_meins"进行内外单位的转换
&&&&&&&&&&&&&&&&changing&p_l_unit.
SELECT&SINGLE&msehi&INTO&p_l_unit&FROM&t006a&WHERE&spras&=&sy-langu&and&mseh3&=&p_itab_meins.
&&IF&sy-subrc&&&&0.
&&&&p_l_unit&&=&p_itab_meins.
endform.&&&&&&&&&&&&&&&&&&&&"&GET_MEINS
*&---------------------------------------------------------------------*
*&&&&&&&Form&&ADD_ZERO
*&---------------------------------------------------------------------*
*&&&&&&&text
*----------------------------------------------------------------------*
*&&&&&&--&P_ITAB_MATNR&&text
*&&&&&&&--P_L_MATNR&&text
*----------------------------------------------------------------------*
form&ADD_ZERO&&&using&matnr_in&changing&matnr_out.
&call&function&'CONVERSION_EXIT_MATN1_INPUT'
input&&&&&&&&&&&&&&=&&matnr_in
output&&&&&&&&&&&&&=&&matnr_out.
*&EXCEPTIONS
*&&&LENGTH_ERROR&&&&&&&=&1
*&&&OTHERS&&&&&&&&&&&&&=&2
&&if&sy-subrc&&&&0.
*&Implement&suitable&error&handling&here
endform.&&&&&&&&&&&&&&&&&&&&"&ADD_ZERO
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 市场部物料管理文件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信