Hi,
You can achieve this technically by clearing the collection of address context node or customizing.
Write Conditional code in Do_finish_input or Do_prepare_output.
1. Get country and store in a variable.
2. Clear Collection of context node see below code and then set country to your attribute using set_property.
current ?= me->typed_context->BuilAddress->collection_wrapper->clear( ).
or another approach you can also try using Business address services. /Regional Structure feature of SAP.
Set City File Active for your specific countries in SPRO -> SAP WAS -> General settings -> Set Country Specific Checks and then Maintain City/Street/ZIP codes using tcodes SR11/SR21/SR31.
.Regards,
S