06-04-2014 10:43 AM
Hi Friends,
I need to update Payment Method (field PYMET) in table DFKKOP.
I am using BAPI_CTRACDOCUMENT_CHANGE to do this.
I have passed below data into the BAPI
Import parameters
Document Number
Tables
PMNT_METH in PARTNERPOSITIONS
and PMNT_METH = X in PARTNERPOSITIONSX.
But the table DFKKOP is not getting updated with new Payment
Method, and the BAPI Return parameter is not giving any message.
Please guide me to solve this problem.
06-04-2014 12:26 PM
Hi Dipin,
BAPI_CTRACDOCUMENT_CHANGE uses the Function module FKK_DOCUMENT_CHANGE to update the documents. Put a break-point at FKK_DOCUMENT_CHANGE in this BAPI and check the SY-SUBRC value.
Also, I assume that you are executing BAPI_TRANSACTION_COMMIT after using the BAPI.
06-04-2014 10:58 AM
Hi Dipin,
You can use below code for the updation of PYMET field from DFKKOP table.
SELECT * FROM dfkkop INTO TABLE t_dfkkop
if sy-subrc eq 0.
LOOP AT t_dfkkop INTO wa_dfkkop.
wa_dfkkop-pymet = c_i.
MODIFY t_dfkkop FROM wa_dfkkop TRANSPORTING pymet.
ENDLOOP.
MODIFY dfkkop FROM TABLE t_dfkkop.
IF sy-subrc EQ 0.
COMMIT WORK.
ENDIF.
endif.
06-04-2014 11:24 AM
Hi Pratima,
Thank you so much for your reply. But I am not sure what all
are the functions the BAPI BAPI_CTRACDOCUMENT_CHANGE
is performing.
So I need to use this BAPI to update the Payment Method.
Regards,
Dipin
06-04-2014 11:42 AM
Hi Dipin,
Try using BAPI - 'BAPI_CTRACDOCUMENT_GETDETAIL' . It will fetch all the details of the document in internal table t_partnerposition.
After that change the field pymet and modify the internal table.
Pass this internal table to BAPI - BAPI_CTRACDOCUMENT_CHANGE for the parameter partnerpositions.It will change the pymet of document.
Hope this will help you.
06-04-2014 12:08 PM
Hi Pratima,
It is advisable not to update any standard table from a Z programme as it can create inconsistency in the database system.
Thanks
Viraj
06-04-2014 12:13 PM
Hi Viraj,
If the requirment is like that, what else we can do to fulfill the requirement?
Do you have any alternative solution for this?
If yes, please share.It will be very helpful.
Thanks,
Pratima.
06-04-2014 12:17 PM
The BAPI suggested by you should serve the purpose, but please remember what so ever the requirement is, never update the standard table...!!!! It is against the SAP compliance, SAP would not support you for inconsistency created through standard table update...!!! I have seen that case in my previous company that is why I am sharing this..!
06-04-2014 12:26 PM
Hi Dipin,
BAPI_CTRACDOCUMENT_CHANGE uses the Function module FKK_DOCUMENT_CHANGE to update the documents. Put a break-point at FKK_DOCUMENT_CHANGE in this BAPI and check the SY-SUBRC value.
Also, I assume that you are executing BAPI_TRANSACTION_COMMIT after using the BAPI.