Handling Invalid Address Information

Within this guide you are going to learn how you can correct an invalid delivery address.

Context

  • An invalid address may result in S4Hana not being able to create the purchase requisition. This means, that the confirm of a booking may result in an error.
  • The following fix can only be applied to baskets in the registered state.
  • The person applying the fix is an expert.

Fix

  1. Enable port-forwarding to the order-management-database service.
    Attention, you are about to perform changes on a productive database.
    There are no safety checks in place! It is possible to destroy the application without any chance of recovery. Performing a database dump before applying any changes is recommended.
    kubectl port-forward -n default deployment/order-management-database 5488:5432
  2. Connect to the database using psql.
  3. Run a test run of your changes. The following command updates the postal code for an order, dumps the current information about the order and rolls the changes back. You have to change both the postal code value and the orders id within the command.
BEGIN;UPDATE "Orders"-- Set PostalCode hereSET "Address_PostalCode"=''-- Set OrderId hereWHERE "Id"='ORDXXXXX';-- Updates Connected PurchaseBasketsUPDATE "PurchaseBaskets"SET "Address_PostalCode"="Orders"."Address_PostalCode"FROM "Orders"WHERE 	-- Set OrderId here	"Orders"."Id"='ORDXXXXX' AND 	"PurchaseBaskets"."OrderId"="Orders"."Id";-- Updates Connected StockTransferBasketsUPDATE "StockTransferBaskets"SET "Address_PostalCode"="Orders"."Address_PostalCode"FROM "Orders"WHERE 	-- Set OrderId here	"Orders"."Id"='ORDXXXXX' AND 	"StockTransferBaskets"."OrderId"="Orders"."Id";ROLLBACK;
  1. Perform the command, if you are sure about the changes. Just use COMMIT instead of ROLLBACK at the end.
BEGIN;UPDATE "Orders"-- Set PostalCode hereSET "Address_PostalCode"=''-- Set OrderId hereWHERE "Id"='ORDXXXXX';-- Updates Connected PurchaseBasketsUPDATE "PurchaseBaskets"SET "Address_PostalCode"="Orders"."Address_PostalCode"FROM "Orders"WHERE 	-- Set OrderId here	"Orders"."Id"='ORDXXXXX' AND 	"PurchaseBaskets"."OrderId"="Orders"."Id";-- Updates Connected StockTransferBasketsUPDATE "StockTransferBaskets"SET "Address_PostalCode"="Orders"."Address_PostalCode"FROM "Orders"WHERE 	-- Set OrderId here	"Orders"."Id"='ORDXXXXX' AND 	"StockTransferBaskets"."OrderId"="Orders"."Id";COMMIT;
  1. Perform a manual confirm for the booking that failed.
  2. Finally, reanimate the booking processing workflow, that crashed during the confirmation of a related booking.
    image.png