Symptom
- When using the API 'API_MATERIAL_STOCK_SRV' you enter a material which contains a special character, after executing the API it brings back no results.
Environment
- SAP S/4HANA Cloud Public Edition
Reproducing the Issue
1. Within the request you enter a material eg. 'TG10-R+S'
/sap/opu/odata/sap/API_MATERIAL_STOCK_SRV/A_MatlStkInAcctMod?$filter=Material eq 'TG10-R+S' and InventoryStockType eq '01'&$select=Material,Plant,StorageLocation,InventoryStockType,MaterialBaseUnit,MatlWrhsStkQtyInMatlBaseUnit
2. Press GET / Execute which shows no results.
Cause
The material number includes a plus sign: 'TG10-R+S'
Resolution
Not all signs can be used without Encoding in a URL. The plus character + has to be replaced by %2B
The new request:
/sap/opu/odata/sap/API_MATERIAL_STOCK_SRV/A_MatlStkInAcctMod?$filter=Material eq 'TG10-R%2BS' and InventoryStockType eq '01'&$select=Material,Plant,StorageLocation,InventoryStockType,MaterialBaseUnit,MatlWrhsStkQtyInMatlBaseUnit
The request is processed following the general rules regarding URL-Encoding:
A URL is composed from a limited set of characters belonging to the US-ASCII character set.
These characters include digits (0-9), letters(A-Z, a-z), and a few special characters ( "-" , "." , "_" , "~" ).
Keywords
API, API_MATERIAL_STOCK_SRV, Read, Material Stock, MB5B, AMATLSTKINACCMO, CDS, A_MATLSTKINACCTMOD, Special Character, Plus, +, URL, Encoding, %2B, US-ASCII , KBA , MM-FIO-IM-SGM , Fiori UI for Stock and Goods Movements , MM-FIO-IM-SGM-2CL , Fiori UI for Stock and Goods Movements (Public Cloud) , Problem