09-14-2017 8:39 AM
Hi,
We are trying to update the two fields through BAPI - BAPI_INCOMINGINVOICE_CHANGE.
Logic here...
lw_ext-belnr = gt_outtab-belnr.
lw_ext-gjahr = gt_outtab-gjahr.
lw_ext-gst_part = gw_parkdata-zlifnr.
lw_ext-plc_sup = lv_region.
APPEND lw_ext to lt_ext.
MOVE 'IVEXT' TO lwa_extensionin-structure.
MOVE lw_ext TO lwa_extensionin-valuepart1.
APPEND lwa_extensionin TO lt_extensionin.
ENDIF.
ENDIF.
***********End of changes*********************
gw_change-doc_type = 'RE'.
gw_change-doc_date = gt_outtab-docdate.
gw_change-pstng_date = gt_outtab-postdate.
gw_change-header_txt = gt_outtab-hdrtxt.
gw_change-alloc_nmbr = gt_outtab-assignm.
gw_change-business_place = gt_outtab-bupla.
gw_changex-header_txt = 'X'.
gw_changex-alloc_nmbr = 'X'.
gw_changex-business_place = 'X'.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CHANGE'
EXPORTING
invoicedocnumber = gt_outtab-belnr
fiscalyear = gt_outtab-gjahr
invoice_doc_status = 'A'
* TABLE_CHANGE = TABLE_CHANGE
headerdata_change = gw_change
headerdata_changex = gw_changex
TABLES
return = t_return
extensionin = lt_extensionin.
CASE sy-subrc.
WHEN 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = w_return.
WHEN OTHERS.
But, after executing the BAPI, it doesn't update the GST Partner and Place of Supply in rbkp table.
Please suggest the same.
Regards
Amol Khochare
09-25-2017 8:21 AM
Solved...
1. Append fields to Header and Item table:
i) BAPI_INCINV_CREATE_HEADER: Append two fields to this table by using append structure
Fields are as a) GST_PART & b) PLC_SUP
ii) BAPI_INCINV_CREATE_ITEM: Append one field HSN_SAC to mentioned table
2. Pass GST_PART, PLC_SUP and HSN_SAC to respective table.
3. Enhancement :
i) Enhancement for Header :
Include Name: LMRM_BAPIF12
Form Name: FORM rbkpv_fill_from_headerdata
Line No: 183
Importing Structure: i_headerdata
Write Code as follows:
IF sy-tcode = 'MIGO'.MOVE:
i_headerdata-gst_part to e_rbkpv-gst_part,
i_headerdata-plc_sup to e_rbkpv-plc_sup.ENDIF.
ii) Enhancement for Item level:
Include Name: LMRM_BAPIF06
Form Name : FORM frseg_fill
Line No : for Ist enhancement 13 & second at 546
Write code as follows:
a) First enhancement :
if ( sy-tcode eq 'MIGO' ).
data : lt_itemdata1 type TABLE OF bapi_incinv_create_item.
FIELD-SYMBOLS : <lfs_item1> TYPE bapi_incinv_create_item.
loop at t_itemdata ASSIGNING <lfs_item1>.
append <lfs_item1> to lt_itemdata1.
clear <lfs_item1>-hsn_sac.
endloop.
endif.
b) Second enhancement :
if ( sy-tcode eq 'MIGO').
FIELD-SYMBOLS : <lfs_frseg1> like LINE OF te_frseg.
data : ls_item1 TYPE bapi_incinv_create_item.
loop at te_frseg ASSIGNING <lfs_frseg1>.
READ TABLE lt_itemdata1 into ls_item1 with key PO_NUMBER = <lfs_frseg1>-EBELN
PO_ITEM = <lfs_frseg1>-EBELP
cond_type = <lfs_frseg1>-KSCHL.
if sy-subrc eq 0.
<lfs_frseg1>-hsn_sac = ls_item1-hsn_sac.
endif.
endloop.
endif.
09-14-2017 10:50 AM
See the answer of Raymond Giuseppi here : https://archive.sap.com/discussions/thread/3816385, about using BAdI MRM_BAPI_MAPPING and reading note 2149315 - BAPI_INCOMINGINVOICE_CREATE and customer fields (which states "No solution in the standard system. It is not planned to add this functionality in the standard. It is currently not possible to process customer fields with these BAPIs.")
09-14-2017 12:59 PM
Hi,
We are facing issue in BAPI_INCOMINGINVOICE_CHANGE.
Regards
Amol Khochare
09-14-2017 3:40 PM
I was afraid you'd just answer that, and not look deeper. The Change BAPI was not mentioned, so it was weird to me as usually SAP mentions all concerned BAPIs, but I hoped you could investigate to make sure.
09-14-2017 3:44 PM
and there's also this answer (enhance the standard to be able to pass custom fields): https://archive.sap.com/discussions/thread/1966552
09-25-2017 8:21 AM
Solved...
1. Append fields to Header and Item table:
i) BAPI_INCINV_CREATE_HEADER: Append two fields to this table by using append structure
Fields are as a) GST_PART & b) PLC_SUP
ii) BAPI_INCINV_CREATE_ITEM: Append one field HSN_SAC to mentioned table
2. Pass GST_PART, PLC_SUP and HSN_SAC to respective table.
3. Enhancement :
i) Enhancement for Header :
Include Name: LMRM_BAPIF12
Form Name: FORM rbkpv_fill_from_headerdata
Line No: 183
Importing Structure: i_headerdata
Write Code as follows:
IF sy-tcode = 'MIGO'.MOVE:
i_headerdata-gst_part to e_rbkpv-gst_part,
i_headerdata-plc_sup to e_rbkpv-plc_sup.ENDIF.
ii) Enhancement for Item level:
Include Name: LMRM_BAPIF06
Form Name : FORM frseg_fill
Line No : for Ist enhancement 13 & second at 546
Write code as follows:
a) First enhancement :
if ( sy-tcode eq 'MIGO' ).
data : lt_itemdata1 type TABLE OF bapi_incinv_create_item.
FIELD-SYMBOLS : <lfs_item1> TYPE bapi_incinv_create_item.
loop at t_itemdata ASSIGNING <lfs_item1>.
append <lfs_item1> to lt_itemdata1.
clear <lfs_item1>-hsn_sac.
endloop.
endif.
b) Second enhancement :
if ( sy-tcode eq 'MIGO').
FIELD-SYMBOLS : <lfs_frseg1> like LINE OF te_frseg.
data : ls_item1 TYPE bapi_incinv_create_item.
loop at te_frseg ASSIGNING <lfs_frseg1>.
READ TABLE lt_itemdata1 into ls_item1 with key PO_NUMBER = <lfs_frseg1>-EBELN
PO_ITEM = <lfs_frseg1>-EBELP
cond_type = <lfs_frseg1>-KSCHL.
if sy-subrc eq 0.
<lfs_frseg1>-hsn_sac = ls_item1-hsn_sac.
endif.
endloop.
endif.
04-13-2018 7:27 AM
Hi
HSN_SAC field is updating as above. But same is not transferring to condintion records fetching i.e. to 'PRICING' function module.