批量导入凭证时,凭证的分割

    xiaoxiao2023-03-24  6

    <span style="font-size:18px;">TYPES : BEGIN OF ltype_cost_share, zflag TYPE posnr_acc, "凭证标示 bschl TYPE bseg-bschl, "记帐代码 gl_account TYPE c001-sakn1, "科目 * doc_date TYPE char8, "document date * pos_date TYPE char8, "posting date * period TYPE char4, "period amount TYPE bseg-wrbtr, "凭证中的金额 vbelv TYPE vbfa-vbelv, "销售订单 posnv TYPE vbfa-posnv, "销售订单行项目 sgtxt TYPE bseg-sgtxt, "Item text. belnr TYPE bkpf-belnr, "凭证编号 fis_period TYPE char8, "period fisc_year TYPE char8, "记账年份 messag TYPE char300, "报消息 END OF ltype_cost_share. DATA :lt_cost_share TYPE TABLE OF ltype_cost_share, ls_cost_share LIKE LINE OF lt_cost_share, lt_display_cost TYPE TABLE OF ltype_cost_share, ls_display_cost LIKE LINE OF lt_display_cost DATA: ls_cost_share2 LIKE ls_cost_share. DATA: lt_temp_cost TYPE TABLE OF ltype_cost_share. "// 将EXCEL表中内容拆分凭证 CLEAR ls_cost_share. CLEAR lt_temp_cost[]. DELETE lt_cost_share WHERE bschl IS INITIAL. SORT lt_cost_share BY zflag. CLEAR ls_cost_share. LOOP AT lt_cost_share INTO ls_cost_share. APPEND ls_cost_share TO lt_display_cost. CLEAR ls_cost_share. ENDLOOP. CLEAR ls_cost_share. LOOP AT lt_cost_share INTO ls_cost_share. APPEND ls_cost_share TO lt_temp_cost. READ TABLE lt_cost_share INTO ls_cost_share2 INDEX 2. IF sy-subrc = 0. "//有下条记录 IF ls_cost_share-zflag = ls_cost_share2-zflag. "//同一个凭证 DELETE lt_cost_share. ELSE. "//BAPI post PERFORM frm_bapi_post_data5 TABLES lt_temp_cost." TAB_RETURN. DELETE lt_cost_share. CLEAR lt_temp_cost[]. ENDIF. ELSE. "// 只有一条记录了 "//BAPI post PERFORM frm_bapi_post_data5 TABLES lt_temp_cost." TAB_RETURN. ENDIF. CLEAR ls_cost_share. ENDLOOP.</span>
    转载请注明原文地址: https://ju.6miu.com/read-1202799.html
    最新回复(0)