To get company code details you can use the following BAPI.
BAPI_COMPANYCODE_GETDETAIL
The above mentioned BAPI can be used to get the following details.Company Code, Name of the company code or company, City, Country key, Currency Key, Language key, Chart of accounts, Fiscal year variant, VAT registration number, Company, Address number, Country ISO code, ISO currency code, Language according to ISO 639, Append Structure for Foreign Key Z001, T004, Append Structure for Foreign Key T880
_____________________________________________________________
Complete Address info with the following fields.Address number, Form of address text, Name 1, Name 2, Name 3, Name 4, c/o name, City, District, City code for city/street file, City postal code, PO Box postal code, Company postal code (for large customers), PO Box, PO Box city, Post delivery district, Street name, Street code for city/street file
_____________________________________________________________
You need to pass the Company Code Number to get the above mentioned details.The code is shown below
REPORT ZEX_COMPANYDET .
Parameter: p_comcod like BAPI0002_2-COMP_CODE.
data: st_comcod like BAPI0002_2,
st_compcodad like BAPI0002_3,
d_ret like BAPIRETURN.
CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'
EXPORTING
COMPANYCODEID = p_comcod
IMPORTING
COMPANYCODE_DETAIL = st_comcod
COMPANYCODE_ADDRESS = st_compcodad
RETURN = d_ret
.
if sy-subrc = 0.
endif.
Parameter: p_comcod like BAPI0002_2-COMP_CODE.
data: st_comcod like BAPI0002_2,
st_compcodad like BAPI0002_3,
d_ret like BAPIRETURN.
CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'
EXPORTING
COMPANYCODEID = p_comcod
IMPORTING
COMPANYCODE_DETAIL = st_comcod
COMPANYCODE_ADDRESS = st_compcodad
RETURN = d_ret
.
if sy-subrc = 0.
endif.