*&———————————————————————*
*& REPORT ZHDL_PP_REPORT_026
*&
*&———————————————————————*
*&
*&
*&———————————————————————*
REPORT zhdl_pp_report_026.
TYPE-POOLS: truxs.
TYPE-POOLS: slis.
TABLES:mard.
DEFINE fc_add .
ls_fieldcat–fieldname = &1 .
ls_fieldcat–seltext_l = &2 .
ls_fieldcat–outputlen = &3 .
* LS_FIELDCAT-HOTSPOT = &4 .
ls_fieldcat–edit = &4 .
ls_fieldcat–do_sum = &5 .
ls_fieldcat–emphasize = &6 .
************INS BY SUNF 2013.7.1 START
*************添加选择列
ls_fieldcat–checkbox = &7 .
ls_fieldcat–edit = &8 .
* LS_FIELDCAT-refresh = &9.
************INS BY SUNF 2013.7.1 END
append ls_fieldcat to p_lt_fieldcat .
clear: ls_fieldcat .
END-OF-DEFINITION .
TYPES: BEGIN OF record,
dwerk(004) TYPE c ,
lgort(004) TYPE c,
aufnr(012) TYPE c ,
matnr_com(018) TYPE c ,
maktg_com1(50) TYPE c,
psmng(016) TYPE c ,
amein(003) TYPE c ,
zlabst(016) TYPE c,
END OF record.
DATA : lt_itab TYPE TABLE OF record WITH HEADER LINE ,
lt_itab1 TYPE TABLE OF record WITH HEADER LINE .
* LT_ITAB1 TYPE TABLE OF RECORD WITH HEADER LINE .
DATA : lt_pltl TYPE TABLE OF zhdl_pp_st_026 WITH HEADER LINE ,
lt_pltl1 TYPE TABLE OF zhdl_pp_st_026 WITH HEADER LINE .
DATA: it_raw TYPE truxs_t_text_data.
DATA : ls_goodsmvt_header TYPE bapi2017_gm_head_01,
lt_goodsmvt_item TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
lv_posting_doc TYPE bapi2017_gm_head_ret.
DATA : gt_return TYPE TABLE OF bapiret2 WITH HEADER LINE .
DATA: ls_layout TYPE slis_layout_alv ,
lt_event TYPE slis_t_event ,
lt_fieldcat TYPE slis_t_fieldcat_alv ,
lt_sortinfo TYPE slis_t_sortinfo_alv .
DATA: l_exit_caused_by_caller TYPE c ,
ls_exit_caused_by_user TYPE slis_exit_by_user .
DATA: it_events TYPE slis_t_event,
wa_events LIKE LINE OF it_events.
REFRESH: it_events.
CLEAR: wa_events,it_events.
wa_events–name = ‘USER_COMMAND’.
wa_events–form = ‘USER_COMMAND’.
APPEND wa_events TO it_events .
DATA: ls_fieldcat TYPE slis_fieldcat_alv .
DATA: g_lights_name TYPE lvc_cifnm VALUE ‘LIGHT’.
DATA : labst TYPE labst ,
labst_z TYPE labst ,
labst_t TYPE labst ,
s_labst TYPE string ,
lv_return_code TYPE c,
lt_return TYPE TABLE OF bapiret2 WITH HEADER LINE.
DATA: functxt TYPE smp_dyntxt.
TABLES: sscrfields.
SELECTION-SCREEN BEGIN OF BLOCK block3 WITH FRAME TITLE text–b01.
PARAMETER: p_file TYPE localfile.
SELECTION-SCREEN END OF BLOCK block3.
SELECTION-SCREEN: FUNCTION KEY 1.
INITIALIZATION.
functxt–icon_id = ‘con_export’.
functxt–icon_text = ‘导入模板下载’.
sscrfields–functxt_01 = functxt.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
DATA: file_table TYPE filetable.
DATA: BEGIN OF wa,
filename(1024),
END OF wa.
DATA: rc LIKE sy–subrc .
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
initial_directory = ‘C:\’
CHANGING
file_table = file_table
rc = rc.
LOOP AT file_table INTO wa .
p_file = wa–filename.
ENDLOOP.
AT SELECTION-SCREEN.
CASE sy–ucomm.
WHEN ‘FC01’.
PERFORM download_tem.
ENDCASE.
START-OF-SELECTION.
PERFORM get_data.
PERFORM alv_display .
*&———————————————————————*
*& Form GET_DATA
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM get_data .
*GET UPLOAD DATA
CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’
EXPORTING
* I_FIELD_SEPERATOR = ‘;’
i_line_header = ‘X’ “XLS ÓÐÎÞ±ÊÌ ‘X’ÓбÊÌÂ
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = lt_itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
.
IF sy–subrc <> 0.
MESSAGE e001(读取文件错误!!!).
ENDIF.
lt_itab1[] = lt_itab[] .
LOOP AT lt_itab.
MOVE-CORRESPONDING lt_itab TO lt_pltl .
lt_pltl–message = ‘数据没有问题’ .
lt_pltl–light = ‘3’ .
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_itab–aufnr
IMPORTING
output = lt_itab–aufnr.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
IF lt_itab–dwerk IS INITIAL
OR lt_itab–matnr_com IS INITIAL
OR lt_itab–psmng IS INITIAL
OR lt_itab–lgort IS INITIAL
OR lt_itab–amein IS INITIAL
OR lt_itab–aufnr IS INITIAL .
lt_pltl–light = ‘1’.
lt_pltl–message = ‘该行的相关数据不能为空!’ .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
SELECT SINGLE werks INTO lt_itab–dwerk FROM t001w WHERE
werks = lt_itab–dwerk .
IF sy–subrc <> 0.
lt_pltl–light = ‘1’.
CONCATENATE ‘该’ lt_itab–dwerk ‘工厂不存在’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
SELECT SINGLE lgort INTO lt_itab–lgort FROM t001l WHERE
lgort = lt_itab–lgort AND werks = lt_itab–dwerk .
IF sy–subrc <> 0.
lt_pltl–light = ‘1’.
CONCATENATE ‘该’ lt_itab–lgort ‘在’ lt_itab–dwerk ‘工厂下不存在’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
SELECT SINGLE matnr INTO lt_itab–matnr_com FROM marc WHERE
matnr = lt_itab–matnr_com AND werks = lt_itab–dwerk .
IF sy–subrc <> 0.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
lt_pltl–light = ‘1’.
CONCATENATE ‘该’ lt_itab–matnr_com ‘在’ lt_itab–dwerk ‘工厂下不存在!!’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
SELECT SINGLE meinh INTO lt_itab–amein FROM marm WHERE
matnr = lt_itab–matnr_com AND meinh = lt_itab–amein .
IF sy–subrc <> 0.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
lt_pltl–light = ‘1’.
CONCATENATE ‘该’ lt_itab–matnr_com ‘不存在’ lt_itab–amein ‘单位!!’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
CLEAR : labst ,s_labst .
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
SELECT SINGLE rsnum rspos INTO (lt_pltl–rsnum,lt_pltl–rspos) FROM resb WHERE
matnr = lt_itab–matnr_com AND aufnr = lt_itab–aufnr .
IF sy–subrc <> 0.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–aufnr
IMPORTING
output = lt_itab–aufnr.
lt_pltl–light = ‘1’.
CONCATENATE ‘该’ lt_itab–aufnr ‘和’ lt_itab–matnr_com ‘不存在相关的261预留(伴随生产订单生成的)!!’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR lt_pltl .
CONTINUE .
ENDIF.
SELECT SINGLE maktg INTO lt_pltl–maktg_com FROM makt WHERE matnr = lt_itab–matnr_com AND spras = ‘1’ .
******************INS BY SUNFANG 2013.7.5 START
* IF LT_ITAB-MAKTG_COM1 <> LT_PLTL-MAKTG_COM.
* LT_PLTL-LIGHT = ‘2’.
* CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
* EXPORTING
* INPUT = LT_ITAB-MATNR_COM
* IMPORTING
* OUTPUT = LT_ITAB-MATNR_COM.
* CONCATENATE ‘该’ LT_ITAB-MATNR_COM ‘的描述维护不正确’ INTO LT_PLTL-MESSAGE1 .
* APPEND LT_PLTL .
* CLEAR LT_PLTL .
* CONTINUE .
* ENDIF.
******************INS BY SUNFANG 2013.7.5 END
lt_pltl–bwart = ‘261’ .
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
SELECT SINGLE labst INTO labst FROM mard WHERE
werks = lt_itab–dwerk AND lgort = lt_itab–lgort AND matnr = lt_itab–matnr_com .
lt_itab–zlabst = labst.
lt_pltl–zlabst = labst.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
LOOP AT lt_itab1 WHERE matnr_com = lt_itab–matnr_com.
labst_z = lt_itab1–psmng .
labst_t = labst_t + labst_z .
CLEAR labst_z .
ENDLOOP.
IF labst < labst_t.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT’
EXPORTING
input = lt_itab–matnr_com
IMPORTING
output = lt_itab–matnr_com.
lt_pltl–light = ‘1’.
s_labst = labst .
CONCATENATE ‘该’ lt_itab–matnr_com ‘当前库存为’ s_labst ‘,投料数量之和大于当前库存’ INTO lt_pltl–message .
APPEND lt_pltl .
CLEAR: lt_pltl , labst_t .
CONTINUE .
ENDIF.
APPEND lt_pltl .
CLEAR : lt_pltl , labst_t .
ENDLOOP.
ENDFORM. ” GET_DATA
*&———————————————————————*
*& Form ALV_DISPLAY
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM alv_display .
PERFORM frm_build_fieldcat CHANGING lt_fieldcat .
PERFORM frm_build_layout .
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
i_callback_program = sy–repid
i_callback_pf_status_set = ‘PF_STATUS_SET’
i_callback_user_command = ‘USER_COMMAND’
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_events = it_events
TABLES
t_outtab = lt_pltl
EXCEPTIONS
program_error = 1
OTHERS = 2.
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. ” ALV_DISPLAY
*&———————————————————————*
*& Form FRM_BUILD_FIELDCAT
*&———————————————————————*
* text
*———————————————————————-*
* <–P_LT_FIELDCAT text
*———————————————————————-*
FORM frm_build_fieldcat CHANGING p_lt_fieldcat TYPE slis_t_fieldcat_alv .
REFRESH p_lt_fieldcat .
fc_add ‘LIGHT’ ‘指示灯’ ’10’ ” ” ” ” ”.
fc_add ‘DWERK’ ‘工厂’ ‘7’ ” ” ” ” ” .
fc_add ‘AUFNR’ ‘生产订单’ ’12’ ” ” ” ” ”.
fc_add ‘LGORT’ ‘库存地点’ ’12’ ” ” ” ” ” .
fc_add ‘RSNUM’ ‘预留编号’ ’10’ ” ” ” ” ” .
fc_add ‘RSPOS’ ‘预留行号’ ’10’ ” ” ” ” ”.
fc_add ‘MATNR_COM’ ‘组件物料号’ ’10’ ” ” ” ” ” .
fc_add ‘MAKTG_COM’ ‘组件物料描述’ ’25’ ” ” ” ” ” .
fc_add ‘ZLABST’ ‘线边库库存’ ’13’ ” ” ” ” ” .
fc_add ‘PSMNG’ ‘消耗数量’ ’13’ ” ” ” ” ” .
fc_add ‘AMEIN’ ‘单位’ ‘4’ ” ” ” ” ” .
fc_add ‘BWART’ ‘移动类型’ ’10’ ” ” ” ” ” .
fc_add ‘MESSAGE’ ‘数据信息’ ‘100’ ” ” ” ” ” .
ENDFORM. ” FRM_BUILD_FIELDCAT
*&———————————————————————*
*& Form FRM_BUILD_LAYOUT
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM frm_build_layout .
ls_layout–lights_fieldname = g_lights_name.
ENDFORM. ” FRM_BUILD_LAYOUT
*&———————————————————————*
*& FORM USER_COMMAND
*&———————————————————————*
* TEXT
*———————————————————————-*
* –>UCOMM TEXT
* –>SELFIELD TEXT
*———————————————————————-*
FORM user_command USING ucomm LIKE sy–ucomm
selfield TYPE slis_selfield.
DATA: lr_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION ‘GET_GLOBALS_FROM_SLVC_FULLSCR’
IMPORTING
e_grid = lr_grid.
CALL METHOD lr_grid->check_changed_data.
selfield–refresh = ‘X’.
CASE ucomm.
WHEN ‘DEL_PO’.
DELETE lt_pltl WHERE light = ‘1’ .
WHEN ‘OK_ALL’.
DELETE lt_pltl WHERE light = ‘1’.
READ TABLE lt_pltl WITH KEY light = ‘1’ .
IF sy–subrc = 0.
MESSAGE ‘数据有误,请查看红灯数据,根据错误信息在文件中改正并重新上传!’ TYPE ‘S’ DISPLAY LIKE ‘E’.
EXIT.
ENDIF.
PERFORM goodsmvt_create .
WHEN ‘&F031’ .
SET SCREEN 0.
WHEN ‘&F151’.
SET SCREEN 0.
WHEN ‘&F121’ .
SET SCREEN 0.
ENDCASE.
IF gt_return[] IS NOT INITIAL .
PERFORM display_log TABLES gt_return.
ENDIF.
CLEAR gt_return[] .
ENDFORM. “USER_COMMAND
*&———————————————————————*
*& Form PF_STATUS_SET
*&———————————————————————*
* text
*———————————————————————-*
* –>UT_EXCLUDE text
*———————————————————————-*
FORM pf_status_set USING ut_exclude TYPE slis_t_extab .
SET PF-STATUS ‘STATUS_100’ .
ENDFORM . “PF_STATUS_SET
*&———————————————————————*
*& Form FRM_GOODSMVT_CREATE
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM goodsmvt_create .
lt_pltl1[] = lt_pltl[] .
SORT lt_pltl1 BY aufnr ASCENDING .
DELETE ADJACENT DUPLICATES FROM lt_pltl1 COMPARING aufnr .
LOOP AT lt_pltl1.
lv_return_code = ‘S’ .
CLEAR:ls_goodsmvt_header,lt_goodsmvt_item[],lv_posting_doc.
ls_goodsmvt_header–pstng_date = sy–datum.
ls_goodsmvt_header–doc_date = sy–datum.
ls_goodsmvt_header–pr_uname = sy–uname.
LOOP AT lt_pltl WHERE aufnr = lt_pltl1–aufnr.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_pltl–aufnr
IMPORTING
output = lt_pltl–aufnr.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_pltl–matnr_com
IMPORTING
output = lt_pltl–matnr_com.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_pltl–rsnum
IMPORTING
output = lt_pltl–rsnum.
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input = lt_pltl–rspos
IMPORTING
output = lt_pltl–rspos.
lt_goodsmvt_item–stge_loc = lt_pltl–lgort .
lt_goodsmvt_item–orderid = lt_pltl–aufnr.“PRODUCTION ORDER
lt_goodsmvt_item–move_type = lt_pltl–bwart.“收货移动类型
lt_goodsmvt_item–material = lt_pltl–matnr_com.
lt_goodsmvt_item–plant = lt_pltl–dwerk.
lt_goodsmvt_item–reserv_no = lt_pltl–rsnum.“预留号
lt_goodsmvt_item–res_item = lt_pltl–rspos.“预留行项目
lt_goodsmvt_item–entry_qnt = lt_pltl–psmng.“数量
lt_goodsmvt_item–entry_uom = lt_pltl–amein.“单位
lt_goodsmvt_item–res_type = ”.“记录类型
APPEND lt_goodsmvt_item.
CLEAR:lt_goodsmvt_item.
ENDLOOP.
CALL FUNCTION ‘BAPI_GOODSMVT_CREATE’
EXPORTING
goodsmvt_header = ls_goodsmvt_header
goodsmvt_code = ’03’
IMPORTING
goodsmvt_headret = lv_posting_doc
TABLES
goodsmvt_item = lt_goodsmvt_item
return = lt_return.
LOOP AT lt_return WHERE type = ‘A’ OR type = ‘E’.
lv_return_code = ‘F’.
MOVE-CORRESPONDING lt_return TO gt_return.
APPEND gt_return.
ENDLOOP.
IF lv_return_code = ‘S’.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
wait = ‘X’.
gt_return–type = ‘S’ .
gt_return–id = ‘ZHDLMSG001’ .
gt_return–number = ‘011’ .
gt_return–message_v1 = lt_pltl1–aufnr.
gt_return–message_v2 = lv_posting_doc–mat_doc .
gt_return–message_v3 = lv_posting_doc–doc_year .
APPEND gt_return .
CLEAR gt_return .
CLEAR:ls_goodsmvt_header,lv_posting_doc,lt_goodsmvt_item[],lt_return[].
ELSE.
CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK’.
EXIT .
ENDIF.
ENDLOOP.
ENDFORM. ” FRM_GOODSMVT_CREATE
*&———————————————————————*
*& Form DISPLAY_LOG
*&———————————————————————*
* text
*———————————————————————-*
* –>P_GT_RETURN text
*———————————————————————-*
FORM display_log TABLES p_return STRUCTURE bapiret2 .
DATA:
l_log_handle TYPE balloghndl,
l_s_log TYPE bal_s_log,
l_s_msg TYPE bal_s_msg,
l_msgno TYPE symsgno,
l_s_display_profile TYPE bal_s_prof.
* APPLICATION LOG: GLOBAL: EXPORT MEMORY
CALL FUNCTION ‘BAL_GLB_MEMORY_EXPORT’.
* APPLICATION LOG: GLOBAL: (PARTIALLY) RESET MEMORY
CALL FUNCTION ‘BAL_GLB_MEMORY_REFRESH’
EXPORTING
i_refresh_all = ‘X’
EXCEPTIONS
not_authorized = 1
OTHERS = 2.
IF sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
ENDIF.
* APPLICATION LOG: LOG: CREATE WITH HEADER DATA
CALL FUNCTION ‘BAL_LOG_CREATE’
EXPORTING
i_s_log = l_s_log
IMPORTING
e_log_handle = l_log_handle
EXCEPTIONS
OTHERS = 1.
IF sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
ENDIF.
* MAP FIELD (THERE SHOULD BE A FM FOR THAT ?)
LOOP AT p_return.
l_s_msg–msgid = p_return–id.
l_s_msg–msgno = p_return–number.
l_s_msg–msgty = p_return–type.
l_s_msg–msgv1 = p_return–message_v1.
l_s_msg–msgv2 = p_return–message_v2.
l_s_msg–msgv3 = p_return–message_v3.
l_s_msg–msgv4 = p_return–message_v4.
IF l_s_msg–msgty = ‘E’.
l_s_msg–probclass = ‘1’.
ELSEIF l_s_msg–msgty = ‘W’.
l_s_msg–probclass = ‘2’.
ELSE.
l_s_msg–probclass = ‘3’.
ENDIF.
* APPLICATION LOG: LOG: MESSAGE: ADD
CALL FUNCTION ‘BAL_LOG_MSG_ADD’
EXPORTING
i_log_handle = l_log_handle
i_s_msg = l_s_msg
EXCEPTIONS
OTHERS = 1.
IF sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
ENDIF.
ENDLOOP.
* APPLICATION LOG: DISPLAY PROFILE: DISPLAY WITHOUT TREE (POPUP)
CALL FUNCTION ‘BAL_DSP_PROFILE_POPUP_GET’
IMPORTING
e_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
ENDIF.
* APPLICATION LOG: FULLSCREEN LOG OUTPUT
l_s_display_profile–use_grid = ‘ ‘.
l_s_display_profile–title = text–004.
CALL FUNCTION ‘BAL_DSP_LOG_DISPLAY’
EXPORTING
i_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy–subrc <> 0.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno
WITH sy–msgv1 sy–msgv2 sy–msgv3 sy–msgv4.
ENDIF.
* APPLICATION LOG: GLOBAL: IMPORT AND INSERT MEMORY
CALL FUNCTION ‘BAL_GLB_MEMORY_IMPORT’
EXPORTING
i_complete_overwrite = ‘X’.
ENDFORM. ” DISPLAY_LOG
*&———————————————————————*
*& Form DOWNLOAD_TEM
*&———————————————————————*
* text
*———————————————————————-*
* –> p1 text
* <– p2 text
*———————————————————————-*
FORM download_tem .
DATA: l_filename TYPE string.
DATA: l_path TYPE string.
DATA: l_fullpath TYPE string.
DATA: l_wwwdb TYPE wwwdatatab.
DATA: l_rlgrp TYPE rlgrap–filename.
DATA: l_subrc TYPE sy–subrc.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = ‘Select File’
default_extension = ‘XLS’
default_file_name = ‘批量视图维护模板’
* WITH_ENCODING =
file_filter = cl_gui_frontend_services=>filetype_excel
* INITIAL_DIRECTORY =
* PROMPT_ON_OVERWRITE = ‘X’
CHANGING
filename = l_filename
path = l_path
fullpath = l_fullpath
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy–subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: l_wwwdb, l_rlgrp,l_subrc.
l_wwwdb–relid = ‘MI’.
l_wwwdb–objid = ‘ZPP0030’.
l_rlgrp = l_fullpath.
CALL FUNCTION ‘DOWNLOAD_WEB_OBJECT’
EXPORTING
key = l_wwwdb
destination = l_rlgrp
IMPORTING
rc = l_subrc
* CHANGING
* TEMP =
.
IF l_subrc <> 0.
MESSAGE ‘文件下载失败!’ TYPE ‘E’.
EXIT.
ENDIF.
ENDFORM. ” DOWNLOAD_TEM