Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_CTRACDOCUMENT_CHANGE - Payment Method Update

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

shah_viraj
Active Participant
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

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..!

shah_viraj
Active Participant
0 Kudos

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.