Monday, September 29, 2014

Changing Customer Master Data for Payment Term

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



Sunday, September 7, 2014

Checking if Internal table got specific value



Reading/Checking internal table for specific value.

Below is code is best way to check whether the internal table having the value based on the key.


 READ TABLE my_items WITH KEY model im_item
             TRANSPORTING NO FIELDS.
  l_index sy-tabix.
  IF sy-subrc NE 0.
    RAISE failure.
  ENDIF


 TRANSPORTING NO FIELDS addition make its optimize way to make the program run faster perhaps.