Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Finding Sales org from country code

ronak_pandya
Explorer
0 Likes
3,521

Hello Friends,

Are there any table or FM available to find sales org from Country code eg: UK, DE etc.....or vice-versa in SAP CRM.

Regrads,

Ronak Pandya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,733

Try as below in CRM

Find country from sales org.


DATA: lt_attrib_ext TYPE hrtb_attvalrt.


CALL FUNCTION 'RHGA_READ_ATTRIBUTES'
   EXPORTING
     scenario   = 'SALE'
     otype        = 'O '
     realo         = '61000117' "ID
   IMPORTING
     attrib_ext  = lt_attrib_ext.

Find sales org. from country


  DATA: lt_search_attr TYPE hrtb_attvalue,
              ls_search_attr TYPE omattvalue,
              lt_result      TYPE hrtb_objkey.

ls_search_attr-attrib = 'COUNTRY'.
ls_search_attr-value = 'AU'.
APPEND ls_search_attr TO lt_search_attr.


CALL FUNCTION 'HR_GENAT_FIND_ATTRIBUTES'
   EXPORTING
     scenario      = 'SALE'
     search_attr  = lt_search_attr
   IMPORTING
     result           = lt_result.

Hello Friends,

Are there any table or FM available to find sales org from Country code eg: UK, DE etc.....or vice-versa in SAP CRM.

Regrads,

Ronak Pandya

3 REPLIES 3
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,733

In what business context would such function be needed?

I doubt this is a common requirement... Don't know about CRM but in SAP ERP this can be easily found in TVKO -> ADRC tables.

Read only

Former Member
0 Likes
1,734

Try as below in CRM

Find country from sales org.


DATA: lt_attrib_ext TYPE hrtb_attvalrt.


CALL FUNCTION 'RHGA_READ_ATTRIBUTES'
   EXPORTING
     scenario   = 'SALE'
     otype        = 'O '
     realo         = '61000117' "ID
   IMPORTING
     attrib_ext  = lt_attrib_ext.

Find sales org. from country


  DATA: lt_search_attr TYPE hrtb_attvalue,
              ls_search_attr TYPE omattvalue,
              lt_result      TYPE hrtb_objkey.

ls_search_attr-attrib = 'COUNTRY'.
ls_search_attr-value = 'AU'.
APPEND ls_search_attr TO lt_search_attr.


CALL FUNCTION 'HR_GENAT_FIND_ATTRIBUTES'
   EXPORTING
     scenario      = 'SALE'
     search_attr  = lt_search_attr
   IMPORTING
     result           = lt_result.

Read only

0 Likes
1,733

Thanks Mohammad Arshid Ansari, these FM were helpful to me.