In this customizing below, you can define the mapping relationship between ERP sales organization and CRM org:
For example, ERP sales org 0001 is mapped to CRM O 50040102:
The mapping relationship is stored in table HRV1222A, you can query by attribute name R3_SA_ORG:
The CRM sales org ID is stored in field OBJID:
Or you can use API CL_CRM_ORGMAN_SERVICES=>MAP_R3_SALES_ORG_TO_HROBJECT to archieve the same.