like rifle grenade, take mortar shell in inventory
that might resolve that mortar spam
That would probably only punish mortarmen for a crime they did not commit.
The true issue with mortar is not its base ammunition, it is additional and unlimited ammo received from engineers and the ability to fire from spawn. Remove or preferably limit both and mortar will probably be just fine (I don´t believe that limiting only one of these two issues is going to end with satisfactory results).
my suggestion can block to receive ammo from crate.
item in inventory(bomb,medkit,rifle grenade) can’t resupply from crate
I see your point, however, if only source of ammunition (including the base ammunition, which is how I understood the suggestion) is inventory for mortarmen, they would perhaps be too limited into the point of being useless.
i think it can solve to increase motarman’s inventory slot or make backpack(already exist in game but no usable for german now) that only mortarmen can use it
That wouldnt work, as they can then just stack 10 grenades into their inventory and become grenadier 
it should make that extended slot can take only mortar shell
or just save the trouble and put a hard cap on mortar ammo
Would also save the trouble of having to obtain 20 mortar shells .-.