There are situation that you need to edit the Customer Master Data in SAP.
In this situation, we want to edit the payment term in of the customer under Company Data.
Basically before you are trying to use any BAPI that changing the data, run the BAPI that get the detail from the system. As for this I'm using BAPI_CUSTOMER_GETDETAIL1.
In this BAPI you will need to enter the appropriate data to get the detail of the Customer.
Then you will get the data of that specific customer
Based on the data that you receive follow that and fill up in the BAPI_CUSTOMER_CHANGEFROMDATA1.
IMPORTANT to change the data, you need to fill up in PI_PERSONALDATA field LASTNAME, CITY, COUNTRY, COUNTRYISO, LANGUP, LANGUP_ISO, CURRENCY, CURRENCY_ISO.
And the field that you need to change (in this case we changing Payment Term). Fill up the first PI_OPT_PERSONALDATA. In that table you just need to fill up the field that you want to change (Payment Term) and also table below it PI_OPT_PERSONALDATAX.
Then fill up the SALESORG, DIVISION, DIVISION_CHANNEL and CUSTOMER No.. Then run it.
If the return is 000, then you BAPI is execute with no error and now you can check using tcode XD03.
Have Fun...!! :)