Company code is the basic organizational unit in SAP from which many of the settings depend. Besides all of the possible standard customizing there will be always a question coming if something can be made default per company – like MIRO document type. If there is no suitable standard customizing you look for alternatives and you find an userexit/ BADI / BTE or any other option available in ABAP enhancement framework.
Time to think about the design now – certainly you would like to avoid hardcoding entries so it should be flexible enough to add an entry pro company.
Here normally the thinking drifts towards a custom table – either existing one for customer-specific parameters or a new one. That is one feasible solution but how about settings which you can make without any new table/ maintenance of custom tables?
Company code additional parameters
In company code parameters (transaction OBY6 ) there is a button with ‘additional data’:
Clicking on it brings you to list of parameters that can be maintained with either meaningful values (like local Tax Number in Germany) or just activation of functions (like Detail Tax Entry with MIRO).
What if you could maintain the entries here – that would also make it possible to keep all the defaults or simple company-dependent customizing parameters in one place.
How to add own parameter
Fortunately there is a simple way to do archive that. Start table maintenance transaction SM30 and choose view V_T001I (it is also available in couple of IMG points):
Voila – you can now define new parameter and even make it country dependent.
Let’s say that we want to maintain the parameter for default document type for MIRO and also a second one with Polish Local Tax Number – that one should be only available for companies from Poland.
Save the settings now and that is it – you can now see the parameters in OBY6.
German company in OBY6:
Polish company:
So the entries work as desired and are limited to country where it is needed.
How to use in custom code
Now the specification to developer – how can you can access the parameter in ABAP. All the values maintained are stored in table T001Z:
To access the data (single or multilple entries) best option will be to use FM READ_ADD_COMPANY_CODE_INFO with parameters like below:
DATA: l_s_company_parameter_value TYPE t001z.
DATA: l_v_company_code TYPE bukrs.
DATA: l_v_parameter_id TYPE party.
CALL FUNCTION 'READ_ADD_COMPANY_CODE_INFO'
EXPORTING
ic_bukrs = l_v_company_code
ic_party = l_v_parameter_id
IMPORTING
es_t001z = l_s_company_parameter_value
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
Pedro Pascal
Se unió el 07/03/2018