主要使用BAPI_FIXEDASSET_CHANGE,
同时用的根据表名动态创建模板和fielcat。
下面是结构名
然后附上程序
*&---------------------------------------------------------------------* *& Report ZFICOR025 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zficor025 MESSAGE-ID zhele. INCLUDE zficor025_top. INCLUDE zficor025_scr. INCLUDE zficor025_frm. INITIALIZATION. sscrfields-functxt_01 = '下载文档'. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2. * 选择文件搜索帮助 PERFORM frm_set_file_f4 USING p_file2 CHANGING p_file2. AT SELECTION-SCREEN. CASE sscrfields-ucomm. WHEN 'FC01'. PERFORM frm_down_excel. WHEN OTHERS. ENDCASE. START-OF-SELECTION. * IF r0 EQ 'X'. IF p_file2 IS INITIAL. MESSAGE '请输入文件名' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. PERFORM frm_get_data. "动态创建内表 <dyn_table>,并生成lt_alv_cat PERFORM frm_file_data2. PERFORM frm_check_data. * PERFORM frm_save_data. * ENDIF. * IF r1 EQ 'X'. * PERFORM frm_get_data. "动态创建内表 <dyn_table>,并生成lt_alv_cat * PERFORM frm_get_data2. "从表 zficos025 获取数据 * ENDIF. END-OF-SELECTION. PERFORM f_display_data.View Code
包含文件ZFICOR025_TOP
*&---------------------------------------------------------------------* *& 包含 ZFICOR025_TOP *&---------------------------------------------------------------------* TABLES:sscrfields. DATA: d_ref TYPE REF TO data, d_ref2 TYPE REF TO data, lt_alv_cat TYPE TABLE OF lvc_s_fcat, ls_alv_cat LIKE LINE OF lt_alv_cat. DATA: lt_table LIKE TABLE OF dntab. DATA: ls_table TYPE dntab. DATA: dyn_table TYPE REF TO data. DATA: dyn_wa TYPE REF TO data. FIELD-SYMBOLS :<dyn_table> TYPE table, <dyn_wa> TYPE any, <dyn_field> TYPE any, <fs_str> TYPE any. DATA: dyn_table2 TYPE REF TO data. DATA: dyn_wa2 TYPE REF TO data. FIELD-SYMBOLS :<dyn_table2> TYPE table, <dyn_wa2> TYPE any, <dyn_field2> TYPE any, <fs_str2> TYPE any. DATA: go_excel TYPE ole2_object, go_workbook TYPE ole2_object, go_sheet TYPE ole2_object. DATA: gs_layout TYPE lvc_s_layo, gt_fieldcat TYPE lvc_t_fcat. TYPES: BEGIN OF sy_output. INCLUDE STRUCTURE zficos025. TYPES: zcolor(4), message TYPE char200, " cellcolor TYPE lvc_t_scol, slbox, END OF sy_output. DATA: gt_output TYPE TABLE OF sy_output, gs_output TYPE sy_output.View Code
包含文件ZFICOR025_SCR
*&---------------------------------------------------------------------* *& 包含 ZFICOR025_SCR *&---------------------------------------------------------------------* SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE TEXT-001. *PARAMETERS: p_name TYPE dd03l-tabname OBLIGATORY. PARAMETERS: p_file2 TYPE string MODIF ID m2. *PARAMETERS: r0 RADIOBUTTON GROUP g1 USER-COMMAND u1. * r1 RADIOBUTTON GROUP g1. SELECTION-SCREEN: FUNCTION KEY 1. SELECTION-SCREEN: END OF BLOCK b01.View Code
包含文件ZFICOR025_FRM
*&---------------------------------------------------------------------* *& 包含 ZMMR091_01_FORM *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& FORM FRM_SET_FILE_F4 *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* * -->P_P_FILE2 TEXT * <--P_P_FILE2 TEXT *&---------------------------------------------------------------------* FORM frm_set_file_f4 USING i_file CHANGING i_file2. * 局部变量-文件名定义 DATA l_filename TYPE rlgrap-filename. * 选择文件搜索帮助 CALL FUNCTION 'WS_FILENAME_GET' EXPORTING def_path = i_file mask = ',*.XLSX,*.XLSX,*.XLS,*.XLS.' mode = '0' title = TEXT-002 IMPORTING filename = l_filename EXCEPTIONS inv_winsys = 1 no_batch = 2 selection_cancel = 3 selection_error = 4 OTHERS = 5. * 如果选择了文件 IF sy-subrc = 0 AND l_filename IS NOT INITIAL. i_file2 = l_filename. ENDIF. ENDFORM. FORM frm_down_excel . DATA: lv_selected_folder TYPE string, lv_fullpath TYPE rlgrap-filename. * CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE * CHANGING * SELECTED_FOLDER = LV_SELECTED_FOLDER * EXCEPTIONS * CNTL_ERROR = 1 * ERROR_NO_GUI = 2 * NOT_SUPPORTED_BY_GUI = 3 * OTHERS = 4. * IF SY-SUBRC <> 0. * ENDIF. * * LV_FULLPATH = LV_SELECTED_FOLDER && P_NAME && '.XLS'. SELECT COUNT(*) FROM dd03l WHERE tabname EQ 'ZFICOS025'. IF sy-subrc NE 0. MESSAGE '该表不存在' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. *取出表结构的字段目录 CALL FUNCTION 'NAMETAB_GET' EXPORTING langu = sy-langu tabname = 'ZFICOS025' TABLES nametab = lt_table EXCEPTIONS no_texts_found = 1. *根据取出的字段目录生成参考字段目录 CLEAR lt_alv_cat. LOOP AT lt_table INTO ls_table. IF ls_table-fieldname NE 'MANDT'. ls_alv_cat-fieldname = ls_table-fieldname. ls_alv_cat-ref_table = 'ZFICOS025'. ls_alv_cat-ref_field = ls_table-fieldname. ls_alv_cat-seltext = ls_table-fieldtext. APPEND ls_alv_cat TO lt_alv_cat. ENDIF. CLEAR ls_alv_cat. ENDLOOP. *内表创建 CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = lt_alv_cat IMPORTING ep_table = d_ref2. * BREAK-POINT. *指定生成的内表到字段符号 ASSIGN d_ref2->* TO <dyn_table2>. *创建动态工作区结构 CREATE DATA dyn_wa2 LIKE LINE OF <dyn_table2>. DATA: lt_zit0001 LIKE TABLE OF zit0001. *创建动态工作区 ASSIGN dyn_wa2->* TO <dyn_wa2>. * READ TABLE LT_ALV_CAT INTO LS_ALV_CAT INDEX 1. * IF SY-SUBRC EQ 0. * ASSIGN COMPONENT LS_ALV_CAT-FIELDNAME OF STRUCTURE <DYN_WA2> TO <FS_STR2>. * APPEND <DYN_WA2> TO <DYN_TABLE2>. * ENDIF. * BREAK-POINT. * <FS_STR> = '9998'. DATA: lv_destination TYPE rlgrap-filename. DATA: ls_key TYPE wwwdatatab. * SELECT * INTO CORRESPONDING FIELDS OF TABLE <DYN_TABLE> UP TO 1 * ROWS FROM (P_NAME). * 首先下载模版 * SELECT SINGLE RELID OBJID FROM WWWDATA INTO CORRESPONDING FIELDS OF LS_KEY WHERE RELID = 'MI' AND OBJID = 'ZFICO049'. * CALL FUNCTION 'DOWNLOAD_WEB_OBJECT' * EXPORTING * KEY = LS_KEY * DESTINATION = LV_DESTINATION. * 打开模版 CREATE OBJECT go_excel 'EXCEL.APPLICATION'. IF sy-subrc NE 0. ENDIF. SET PROPERTY OF go_excel 'DISPLAYALERTS' = 0. SET PROPERTY OF go_excel 'VISIBLE' = 1. CALL METHOD OF go_excel 'WORKBOOKS' = go_workbook. SET PROPERTY OF go_excel 'SHEETSINNEWWORKBOOK' = 1. CALL METHOD OF go_workbook 'ADD'. * CALL METHOD OF GO_WORKBOOK 'OPEN' * EXPORTING * #1 = LV_FULLPATH. CALL METHOD OF go_excel 'SHEETS' = go_sheet EXPORTING #1 = 1. CALL METHOD OF go_sheet 'ACTIVATE'. *填值 PERFORM excel_row_insert USING go_sheet 3 1 1. "复制并插入一行 LOOP AT lt_alv_cat INTO ls_alv_cat. PERFORM fill_range USING 1 sy-tabix ls_alv_cat-seltext. ENDLOOP. *关闭 GET PROPERTY OF go_excel 'ACTIVESHEET' = go_sheet. "获取活动SHEET FREE OBJECT go_sheet. FREE OBJECT go_workbook. GET PROPERTY OF go_excel 'ACTIVEWORKBOOK' = go_workbook. * SET PROPERTY OF GO_EXCEL 'VISIBLE' = 0. "是否显示EXCEL 此处显示不退出 CALL METHOD OF go_workbook 'SAVES'. * CALL METHOD OF GO_WORKBOOK 'SAVES' * EXPORTING * #1 = LV_FULLPATH * #2 = 1. * CALL METHOD OF GO_WORKBOOK 'CLOSE'. CALL METHOD OF go_excel 'QUIT'. FREE OBJECT go_sheet. FREE OBJECT go_workbook. FREE OBJECT go_excel. ENDFORM. FORM excel_row_insert USING lcobj_sheet lc_row lc_count lv_rowcopy. DATA lc_range TYPE ole2_object. DATA h_borders TYPE ole2_object. DO lc_count TIMES. CALL METHOD OF lcobj_sheet 'ROWS' = lc_range EXPORTING #1 = lv_rowcopy. CALL METHOD OF lc_range 'COPY'. "COPY第10行插入一个新行 CALL METHOD OF lcobj_sheet 'ROWS' = lc_range EXPORTING #1 = lc_row. CALL METHOD OF lc_range 'INSERT'. CALL METHOD OF lc_range 'CLEARCONTENTS'. "是否需要清空CELL ENDDO. ENDFORM. FORM fill_range USING VALUE(f_row) VALUE(f_col) VALUE(f_value). DATA: row TYPE i, col TYPE i, lo_cell TYPE ole2_object. row = f_row. col = f_col. CALL METHOD OF go_excel 'CELLS' = lo_cell EXPORTING #1 = row #2 = col. SET PROPERTY OF lo_cell 'VALUE' = f_value. ENDFORM. *&---------------------------------------------------------------------* *& FORM FRM_GET_DATA *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* *& --> P1 TEXT *& <-- P2 TEXT *&---------------------------------------------------------------------* FORM frm_get_data . *取出表结构的字段目录 CALL FUNCTION 'NAMETAB_GET' EXPORTING langu = sy-langu tabname = 'ZFICOS025' TABLES nametab = lt_table EXCEPTIONS no_texts_found = 1. *根据取出的字段目录生成参考字段目录 CLEAR lt_alv_cat. LOOP AT lt_table INTO ls_table. * IF LS_TABLE-FIELDNAME NE 'MANDT'. ls_alv_cat-fieldname = ls_table-fieldname. ls_alv_cat-ref_table = 'ZFICOS025'. ls_alv_cat-ref_field = ls_table-fieldname. IF ls_table-fieldname EQ 'MEINS'. ls_alv_cat-no_convext = 'X'. * CLEAR: ls_alv_cat-ref_field,ls_alv_cat-ref_table. ENDIF. ls_alv_cat-seltext = ls_table-fieldtext. ls_alv_cat-scrtext_l = ls_table-fieldtext. ls_alv_cat-scrtext_m = ls_table-fieldtext. ls_alv_cat-scrtext_s = ls_table-fieldtext. APPEND ls_alv_cat TO lt_alv_cat. * ENDIF. CLEAR ls_alv_cat. ENDLOOP. *内表创建 CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = lt_alv_cat IMPORTING ep_table = d_ref. *指定生成的内表到字段符号 ASSIGN d_ref->* TO <dyn_table>. *创建动态工作区结构 CREATE DATA dyn_wa LIKE LINE OF <dyn_table>. *创建动态工作区 ASSIGN dyn_wa->* TO <dyn_wa>. * zcolor DELETE lt_alv_cat[] WHERE fieldname EQ 'MANDT'. ls_alv_cat-fieldname = 'ZCOLOR'. * ls_alv_cat-ref_table = 'ZFICOS025'. * ls_alv_cat-ref_field = 'ZCOLOR'. ls_alv_cat-seltext = '更新结果'. ls_alv_cat-scrtext_l = '更新结果'. ls_alv_cat-scrtext_m = '更新结果'. ls_alv_cat-scrtext_s = '更新结果'. APPEND ls_alv_cat TO lt_alv_cat. ls_alv_cat-fieldname = 'MESSAGE'. * ls_alv_cat-ref_table = 'ZFICOS025'. * ls_alv_cat-ref_field = 'MESSAGE'. ls_alv_cat-seltext = '更新信息'. ls_alv_cat-scrtext_l = '更新信息'. ls_alv_cat-scrtext_m = '更新信息'. ls_alv_cat-scrtext_s = '更新信息'. APPEND ls_alv_cat TO lt_alv_cat. ENDFORM. *&---------------------------------------------------------------------* *& FORM FRM_FILE_DATA2 *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* *& --> P1 TEXT *& <-- P2 TEXT *&---------------------------------------------------------------------* FORM frm_file_data2 . DATA: lv_end TYPE c. DATA: lt_data TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE. DATA lv_filename TYPE rlgrap-filename. DATA lv_tabix TYPE sy-tabix. lv_filename = p_file2. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' "读取EXCEL文件中的内容 EXPORTING filename = lv_filename i_begin_col = '1' i_begin_row = '2' i_end_col = '25' i_end_row = '99999' TABLES intern = lt_data EXCEPTIONS inconsistent_parameters = 1 upload_ole = 2 OTHERS = 3. LOOP AT lt_data. * CLEAR LV_END. * AT END OF ROW. * LV_END = 'X'. * ENDAT. lv_tabix = lt_data-col. * ADD 1 TO LV_TABIX. READ TABLE lt_alv_cat INTO ls_alv_cat INDEX lv_tabix. IF sy-subrc EQ 0. ASSIGN COMPONENT ls_alv_cat-fieldname OF STRUCTURE <dyn_wa> TO <fs_str>. <fs_str> = lt_data-value. ENDIF. AT END OF row. * APPEND <DYN_WA> TO <DYN_TABLE>. MOVE-CORRESPONDING <dyn_wa> TO gs_output. APPEND gs_output TO gt_output. CLEAR: <dyn_wa>,gs_output. ENDAT. ENDLOOP. ENDFORM. FORM frm_add_zero USING lc_char1 CHANGING lc_char2. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = lc_char1 IMPORTING output = lc_char2. ENDFORM. *&---------------------------------------------------------------------* *& FORM FRM_CHECK_DATA *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* *& --> P1 TEXT *& <-- P2 TEXT *&---------------------------------------------------------------------* FORM frm_check_data . DATA: lv_leng TYPE i, lv_tabix TYPE sy-tabix, lv_tabix2 TYPE sy-tabix, lv_value1 TYPE char18, lv_value2 TYPE char18, lv_zcheck TYPE sy-tabix. LOOP AT gt_output INTO gs_output. * lv_leng = strlen( gs_output-ewbez ). * CLEAR: lv_tabix,lv_zcheck,lv_value2,lv_value1,lv_tabix2. * * DO lv_leng TIMES. * ADD 1 TO lv_tabix2. * IF gs_output-matkl+lv_tabix(1) EQ '*' OR lv_tabix2 EQ lv_leng. * gs_output-zvalue1 = lv_value1. * ELSE. * ADD 1 TO lv_zcheck. * lv_value1 = |{ lv_value1 }{ gs_output-matkl+lv_tabix(1) }|. * IF lv_tabix EQ 0. * gs_output-zstart1 = lv_tabix. * ENDIF. * gs_output-zcheck1 = lv_zcheck. * ENDIF. * ADD 1 TO lv_tabix. * ENDDO. PERFORM frm_add_zero USING gs_output-anln1 CHANGING gs_output-anln1. PERFORM frm_add_zero USING gs_output-anln2 CHANGING gs_output-anln2. IF gs_output-anln2 EQ ''. gs_output-anln2 = '0000'. ENDIF. MOVE-CORRESPONDING gs_output TO <dyn_wa>. APPEND <dyn_wa> TO <dyn_table>. MODIFY gt_output FROM gs_output TRANSPORTING anln1 anln2. CLEAR: gs_output. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& FORM FRM_SAVE_DATA *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* *& --> P1 TEXT *& <-- P2 TEXT *&---------------------------------------------------------------------* FORM frm_save_data . * IF <dyn_table>[] IS NOT INITIAL. * MODIFY ZFICOS025 FROM TABLE <dyn_table>. * IF sy-subrc EQ 0. * COMMIT WORK AND WAIT. * ELSE. * ROLLBACK WORK. * ENDIF. * ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& FORM FRM_GET_DATA2 *&---------------------------------------------------------------------* *& TEXT *&---------------------------------------------------------------------* *& --> P1 TEXT *& <-- P2 TEXT *&---------------------------------------------------------------------* *FORM frm_get_data2 . * SELECT * * INTO CORRESPONDING FIELDS OF TABLE @gt_output * FROM ZFICOS025. *ENDFORM. FORM f_display_data . PERFORM f_set_layout. * PERFORM F_SET_FIELDCAT. PERFORM f_alv_display TABLES gt_output. ENDFORM. FORM f_set_layout. CLEAR: gs_layout. gs_layout-box_fname = 'SLBOX'. gs_layout-zebra = 'X'. gs_layout-cwidth_opt = 'X'. gs_layout-ctab_fname = 'CELLCOLOR'. ENDFORM. *FORM F_SET_FIELDCAT. * CLEAR: GT_FIELDCAT[]. * DATA: LS_FIELDCAT TYPE LVC_S_FCAT. * DEFINE SET_FIELDCAT. * CLEAR: LS_FIELDCAT. * LS_FIELDCAT-FIELDNAME = &1. * LS_FIELDCAT-REF_FIELD = &2. * LS_FIELDCAT-REF_TABLE = &3. * LS_FIELDCAT-CONVEXIT = &4. * LS_FIELDCAT-DO_SUM = &5. * LS_FIELDCAT-SELTEXT = &6. * LS_FIELDCAT-SCRTEXT_L = &6. * LS_FIELDCAT-SCRTEXT_M = &6. * LS_FIELDCAT-SCRTEXT_S = &6. * LS_FIELDCAT-COLTEXT = &6. * APPEND LS_FIELDCAT TO GT_FIELDCAT. * END-OF-DEFINITION. **显示内容 * SET_FIELDCAT 'RBUKRS' 'RBUKRS' 'ACDOCA' '' '' '公司代码'. * SET_FIELDCAT 'GJAHR' 'GJAHR' 'ACDOCA' '' '' '会计年度'. * SET_FIELDCAT 'BUDAT' 'BUDAT' 'ACDOCA' '' '' '过账日期'. *ENDFORM. FORM f_alv_display TABLES it_table. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING i_callback_program = sy-repid i_callback_pf_status_set = 'F_SET_PF_STATUS' i_callback_user_command = 'F_USER_COMMAND' is_layout_lvc = gs_layout it_fieldcat_lvc = lt_alv_cat i_save = 'U' TABLES t_outtab = it_table EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. ENDIF. ENDFORM. *-----------------------------------------------------------------------* * *-----------------------------------------------------------------------* FORM f_set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'STD'. ENDFORM. *-----------------------------------------------------------------------* * *-----------------------------------------------------------------------* FORM f_user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. PERFORM f_check_change_data. CASE r_ucomm. WHEN 'ZCHANGE'. PERFORM frm_save_zchange. "保存资产更改数据 WHEN '&IC1'."双击事件 READ TABLE gt_output INTO DATA(gs_output) INDEX rs_selfield-tabindex. IF sy-subrc EQ 0. SET PARAMETER ID 'BUK' FIELD gs_output-bukrs. SET PARAMETER ID 'AN1' FIELD gs_output-anln1. SET PARAMETER ID 'AN2' FIELD gs_output-anln2. CALL TRANSACTION 'AS03' AND SKIP FIRST SCREEN. ENDIF. ENDCASE. PERFORM f_refresh_alv. ENDFORM. *-----------------------------------------------------------------------* * *-----------------------------------------------------------------------* FORM f_check_change_data. DATA: lo_grid TYPE REF TO cl_gui_alv_grid. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = lo_grid. lo_grid->check_changed_data( ). ENDFORM. *-----------------------------------------------------------------------* * *-----------------------------------------------------------------------* FORM f_refresh_alv. DATA: lo_grid TYPE REF TO cl_gui_alv_grid, ls_is_stable TYPE lvc_s_stbl. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = lo_grid. ls_is_stable-col = 'X'. ls_is_stable-row = 'X'. lo_grid->refresh_table_display( EXPORTING is_stable = ls_is_stable EXCEPTIONS finished = 1 OTHERS = 2 ). IF sy-subrc <> 0. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form FRM_SAVE_ZCHANGE *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM frm_save_zchange . DATA: ls_generaldata TYPE bapi1022_feglg001, ls_generaldatax TYPE bapi1022_feglg001x, ls_postingin TYPE bapi1022_feglg002, ls_postinginx TYPE bapi1022_feglg002x, ls_timedepend TYPE bapi1022_feglg003, ls_timedependx TYPE bapi1022_feglg003x, ls_allocations TYPE bapi1022_feglg004, ls_allocationsx TYPE bapi1022_feglg004x, ls_return TYPE bapiret2. DATA: lv_meins TYPE mara-meins. "前台事务码 AS02 LOOP AT gt_output INTO DATA(ls_output). AUTHORITY-CHECK OBJECT 'ZHL_AUTHOR' ID 'ZBUKRS' FIELD ls_output-bukrs. IF sy-subrc NE 0. ls_output-zcolor = '@0A@'. ls_output-message = |无公司{ ls_output-bukrs }权限!|. MODIFY gt_output FROM ls_output. CONTINUE. ENDIF. IF ls_output-deakt CA '.-' OR ls_output-adatu CA '.-'. ls_output-zcolor = '@0A@'. ls_output-message = |日期格式请使用YYYYMMDD|. MODIFY gt_output FROM ls_output. CONTINUE. ENDIF. *常规 ls_generaldata-descript = ls_output-txt50. "资产描述 ls_generaldatax-descript = ls_output-txt50x. ls_generaldata-descript2 = ls_output-txa50. "附加资产描述 ls_generaldatax-descript2 = ls_output-txa50x. ls_generaldata-quantity = ls_output-menge. "数量 ls_generaldatax-quantity = ls_output-mengex. CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT' EXPORTING input = ls_output-meins * LANGUAGE = SY-LANGU IMPORTING output = lv_meins EXCEPTIONS unit_not_found = 1 OTHERS = 2. ls_generaldata-base_uom = lv_meins. "基本计量单位 ls_generaldatax-base_uom = ls_output-meinsx. *过账信息 ls_postingin-deact_date = ls_output-deakt. "不激活的日期 ls_postinginx-deact_date = ls_output-deaktx. *与时间相关 ls_timedepend-from_date = ls_output-adatu. "有效期起始日期 ls_timedependx-from_date = ls_output-adatux. * ls_timedepend-location = ls_output-stort. "资产地点 * ls_timedependx-location = ls_output-stortx. ls_timedepend-room = ls_output-raumn. "房间 ls_timedependx-room = ls_output-raumnx. ls_timedepend-costcenter = ls_output-kostl. "成本中心 ls_timedependx-costcenter = ls_output-kostlx. *分配 ls_allocations-evalgroup1 = ls_output-ord41. "资产状态 ls_allocationsx-evalgroup1 = ls_output-ord41x. ls_allocations-evalgroup4 = ls_output-ord41. "保管人 ls_allocationsx-evalgroup4 = ls_output-ord41x. CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE' EXPORTING companycode = ls_output-bukrs asset = ls_output-anln1 subnumber = ls_output-anln2 generaldata = ls_generaldata generaldatax = ls_generaldatax postinginformation = ls_postingin postinginformationx = ls_postinginx timedependentdata = ls_timedepend timedependentdatax = ls_timedependx allocations = ls_allocations allocationsx = ls_allocationsx IMPORTING return = ls_return. IF ls_return-type = 'S'. COMMIT WORK AND WAIT. ls_output-zcolor = '@09@'. ELSE. ROLLBACK WORK. ls_output-zcolor = '@0A@'. ENDIF. ls_output-message = |{ ls_return-message }{ ls_return-message_v1 }{ ls_return-message_v2 }{ ls_return-message_v3 }{ ls_return-message_v4 }|. MODIFY gt_output FROM ls_output. CLEAR: ls_return,ls_allocationsx,ls_allocations,ls_timedepend,ls_timedependx, ls_postingin,ls_postinginx,ls_generaldata,ls_generaldatax,ls_output. ENDLOOP. ENDFORM.View Code