admin 管理员组文章数量: 887021
2024年2月18日发(作者:do while循环的语句格式)
SAP批量修改销售订单FirstDate*&---------------------------------------------------------------------**& Report ZSD200*&---------------------------------------------------------------------**&PROGRAM NAME :
SELECTION-SCREEN END OF BLOCK blk01.********************************* AT SELECTION-SCREEN ON VALUE-REQUEST FOR xxxxx.********************************AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. PERFORM frm_get_filepath USING p_path.********************************* START OF SELECTION********************************START-OF-SELECTION. PERFORM frm_upload_data. IF lt_infor IS NOT INITIAL AND g_update_flag = 'X'. PERFORM frm_update_data. PERFORM frm_alv_diplay. ELSE. PERFORM frm_alv_diplay. ENDIF.*&---------------------------------------------------------------------**& Form FRM_GET_FILEPATH*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->P_P_PATH text*----------------------------------------------------------------------*FORM frm_get_filepath USING p_p_path. CALL FUNCTION 'F4_FILENAME' IMPORTING file_name = p_M. " FRM_GET_FILEPATH*&---------------------------------------------------------------------**& Form FRM_UPLOAD_DATA*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM frm_upload_data . DATA: lc_fname TYPE rlgrap-filename. DATA: iv_line TYPE sy-tabix, l_previous_line TYPE sy-tabix, l_sytabix TYPE sy-tabix, l_next_line TYPE sy-tabix, l_mod TYPE i. DATA: ls_upload_next LIKE LINE OF lt_upload. DATA: lwa_upload LIKE LINE OF lt_upload. lc_fname = p_path. CLEAR lt_upload[]. CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' EXPORTING filename = lc_fname i_begin_col = 1 i_begin_row = 2 i_end_col = 3 i_end_row = 65536
i_end_row = 65536 TABLES intern = lt_upload EXCEPTIONS inconsistent_parameters = 1 upload_ole = 2 OTHERS = 3. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. IF lt_upload IS NOT INITIAL. SORT lt_upload BY row col. CLEAR lt_infor[]. CLEAR ls_upload. LOOP AT lt_upload INTO ls_upload. CLEAR l_next_line. l_next_line = sy-tabix + 1. CASE ls_upload-col. WHEN 1. "// sales order CONDENSE ls_upload-value. ls_infor-vbeln = ls_upload-value.* WHEN 2. "// requested delivery data* CONDENSE ls_upload-value.* ls_infor-vdatu = ls_upload-value. WHEN 2. "// CONDENSE ls_upload-value. ls_infor-edatu = ls_upload-value. ENDCASE. CLEAR ls_upload_next. READ TABLE lt_upload INTO ls_upload_next INDEX l_next_line. IF ls_upload_next-row NE ls_upload-row. APPEND ls_infor TO lt_infor. CLEAR ls_infor. ENDIF. CLEAR ls_upload. ENDLOOP. M. " FRM_UPLOAD_DATA*&---------------------------------------------------------------------**& Form FRM_UPDATE_DATA*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM frm_update_data . CLEAR ls_infor. LOOP AT lt_infor INTO ls_infor. PERFORM frm_delinfo_update. MODIFY lt_infor FROM ls_infor.
MODIFY lt_infor FROM ls_infor. M. " FRM_UPDATE_DATA*&---------------------------------------------------------------------**& Form FRM_DELINFO_UPDATE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM frm_delinfo_update .* CLEAR lt_vbuk.* SELECT* vbeln* gbstk* FROM vbuk* INTO CORRESPONDING FIELDS OF TABLE lt_vbuk* WHERE vbeln = ls_infor-vbeln.** CLEAR ls_vbuk.* READ TABLE lt_vbuk INTO ls_vbuk WITH KEY vbeln = ls_infor-vbeln.* IF ls_vbuk-gbstk = 'C'.* msg1 = 'Sales Order Completed.'.* ELSE.* UPDATE vbak SET vdatu = ls_infor-vdatu WHERE vbeln = ls_infor-vbeln.* IF sy-subrc = 0.* msg1 = 'Requested delivery data update was succeed.'.* ENDIF.* ENDIF. CLEAR lt_vbup[]. SELECT vbeln posnr lfgsa FROM vbup INTO CORRESPONDING FIELDS OF TABLE lt_vbup WHERE vbeln = ls_infor-vbeln. CLEAR msg2. LOOP AT lt_vbup INTO ls_vbup WHERE lfgsa ne 'C'. IF sy-subrc ne '0'. msg2 = 'Order Deliveried.'. ELSE. UPDATE vbep SET edatu = ls_infor-edatu WHERE vbeln = ls_vbup-vbeln AND posnr = ls_vbup-posnr AND etenr = '1'. IF sy-subrc = '0'. msg2 = 'First delivery data update was succeed.'. ENDIF. ENDIF. ENDLOOP. CONCATENATE msg1 msg2 INTO ls_infor-message_text. CLEAR msg1. CLEAR M. " FRM_DELINFO_UPDATE*&---------------------------------------------------------------------**& Form FRM_ALV_DIPLAY*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*
* --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM frm_alv_diplay . DATA: l_repid TYPE sy-repid, ls_layout TYPE slis_layout_alv, lt_event TYPE slis_t_event, lt_fieldcat TYPE slis_t_fieldcat_alv. PERFORM frm_build_layout CHANGING ls_layout. PERFORM frm_build_fieldcat CHANGING lt_fieldcat. MOVE sy-repid TO l_repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = l_repid is_layout = ls_layout it_fieldcat = lt_fieldcat it_events = lt_event i_callback_user_command = 'FRM_USER_COMMAND'* i_callback_pf_status_set = 'FRM_PF_STATUS_SET' TABLES t_outtab = lt_M. " FRM_ALV_DIPLAY*&---------------------------------------------------------------------**& Form frm_build_fieldcat*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->CT_FIELDCAT text*----------------------------------------------------------------------*FORM frm_build_fieldcat CHANGING ct_fieldcat TYPE slis_t_fieldcat_alv. DATA: ls_fieldcat LIKE LINE OF ct_fieldcat. DATA: l_col_pos TYPE i. REFRESH ct_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-col_pos = l_col_pos. ls_fieldcat-fieldname = 'VBELN'. ls_fieldcat-seltext_l = 'Sales Order'. ls_fieldcat-seltext_m = 'Sales Order'. ls_fieldcat-seltext_s = 'Sales Order'. l_col_pos = l_col_pos + 1. APPEND ls_fieldcat TO ct_fieldcat.* CLEAR ls_fieldcat.* ls_fieldcat-col_pos = l_col_pos.* ls_fieldcat-fieldname = 'VDATU'.* ls_fieldcat-seltext_l = 'Req. '.* ls_fieldcat-seltext_m = 'Req. '.* ls_fieldcat-seltext_s = 'Req. '.* l_col_pos = l_col_pos + 1.* APPEND ls_fieldcat TO ct_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-col_pos = l_col_pos. ls_fieldcat-fieldname = 'EDATU'. ls_fieldcat-seltext_l = 'First Delivery Date'. ls_fieldcat-seltext_m = 'First Delivery Date'. ls_fieldcat-seltext_s = 'First Date'. l_col_pos = l_col_pos + 1. APPEND ls_fieldcat TO ct_fieldcat.
版权声明:本文标题:SAP批量修改销售订单FirstDate 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1708213135h516870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论