*바피데이터 생성
"header
CLEAR lt_header.
lt_header-invoice_ind = 'X'.
lt_header-doc_type = 'RE'.
lt_header-doc_date = p_invoice.
lt_header-pstng_date = p_posting.
lt_header-comp_code = p_bukrs.
lt_header-diff_inv = gt_list_0200-lifnr.
lt_header-currency = gv_curr1.
lt_header-pmnttrms = gt_list_0200-zterm.
lt_header-calc_tax_ind = 'X'.
WRITE p_amount TO lv_tax_amount CURRENCY gv_curr1.
PERFORM p2000_write_no_mask CHANGING lv_tax_amount.
lt_header-gross_amount = lv_tax_amount.
* lt_header-gross_amount = p_amount. "p_balance * -1. 수정 20081111
lt_header-bline_date = p_base.
"tax
* WRITE p_tax TO lv_tax_amount CURRENCY gv_curr1.
* PERFORM p2000_write_no_mask CHANGING lv_tax_amount.
*
* lt_tax_data-tax_code = p_va.
* lt_tax_data-tax_amount = lv_tax_amount.
* APPEND lt_tax_data.
LOOP AT gt_list_0200.
CLEAR lt_item.
lv_counter = lv_counter + 1.
"item
lt_item-invoice_doc_item = lv_counter."sy-tabix.
lt_item-po_number = gt_list_0200-ebeln.
lt_item-po_item = gt_list_0200-ebelp.
lt_item-de_cre_ind = ' '.
IF gt_list_0200-webre = 'X'.
lt_item-ref_doc = gt_list_0200-belnr.
lt_item-ref_doc_year = gt_list_0200-mjahr.
lt_item-ref_doc_it = gt_list_0200-buzei.
ELSE.
CLEAR: lt_item-ref_doc , lt_item-ref_doc_year , lt_item-ref_doc_it .
ENDIF.
lt_item-tax_code = p_va.
WRITE gt_list_0200-amount TO lv_tax_amount CURRENCY gv_curr1.
PERFORM p2000_write_no_mask CHANGING lv_tax_amount.
lt_item-item_amount = lv_tax_amount.
* lt_item-item_amount = gt_list_0200-amount.
lt_item-quantity = gt_list_0200-temp."grmenge
lt_item-po_unit = gt_list_0200-grmeins.
APPEND lt_item.
ENDLOOP.
SORT lt_item BY invoice_doc_item po_number po_item.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = lt_header
IMPORTING
invoicedocnumber = lv_iv
fiscalyear = lv_year
TABLES
taxdata = lt_tax_data[]
itemdata = lt_item[]
return = lt_return.
ENDIF.
현재다른것들은 송장처리가 제대로 됩니다 한개 또는 다수도 정상처리됩니다
외주임가공시 저장은되는데회계문서의 아이템들이 덜생깁니다
이럴때 헤더나 아이템단에 넣거나 빼야하는 항목들이 있는지 알려주세요