Application Development 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: 

CRM RFC

Former Member
0 Kudos
176

hi experts,

Can anybody give me a sample code how to use this METHOD CL_CRM_ORGMAN_SERVICES=>READ_R3_SALES_ORG_TEXT. Actually my problem is I want to get the complete description of the specific sales organization. I just can't find the right table in the CRM database. I can't use the HRP1000 table because its just giving me the short description.

best regardz,

glenzg

1 ACCEPTED SOLUTION

alejandro_bindi
Active Contributor
0 Kudos
98

Using that method is pretty straightforward:


PARAMETERS: p_vkorg TYPE vkorg.
DATA: gt_r3_sales_orgs  TYPE  crmt_r3_sales_org_t,
      gt_r3_sales_orgs_texts  TYPE  crmtb_orgman_r3_vkorg_text,
      gs_r3_sales_orgs_texts  TYPE  LINE OF crmtb_orgman_r3_vkorg_text.

APPEND p_vkorg TO gt_r3_sales_orgs.
cl_crm_orgman_services=>read_r3_sales_org_text(
  EXPORTING
    iv_r3_sales_orgs       = gt_r3_sales_orgs
  IMPORTING
    ev_r3_sales_orgs_texts = gt_r3_sales_orgs_texts
  EXCEPTIONS
    wrong_sales_org        = 1
    buffer_empty           = 2
    OTHERS                 = 3
       ).
CHECK sy-subrc = 0.

LOOP AT gt_r3_sales_orgs_texts INTO gs_r3_sales_orgs_texts.
  WRITE: gs_r3_sales_orgs_texts-description.
ENDLOOP.

If you want to retrieve the CRM description there's another code you can use. CRM Sales Organizations have a different format than R3's. So if you have an R/3 sales org. (i.e. VKORG) you previously have to convert it to CRM format.

You can use this methods for retrieving the CRM description:


PARAMETERS: p_vkorg TYPE vkorg.

DATA: gr_org_man TYPE REF TO cl_crm_org_management.
DATA: gv_crm_sales_org TYPE crmt_sales_org.
DATA: gv_description  TYPE  crmt_description.
DATA: gv_short  TYPE  crmt_sales_org_short.

cl_crm_org_management=>get_instance(
  IMPORTING
    ev_instance = gr_org_man
).

gr_org_man->get_sales_org_of_vkorg(
  EXPORTING
    iv_vkorg            = p_vkorg
  IMPORTING
    ev_sales_org        = gv_crm_sales_org
  EXCEPTIONS
    crm_key_not_defined = 1
    OTHERS              = 2
       ).
CHECK sy-subrc = 0.

gr_org_man->get_sales_org_description(
  EXPORTING
    iv_sales_org   = gv_crm_sales_org
  IMPORTING
    ev_description = gv_description
    ev_short       = gv_short
       ).

WRITE: /, gv_description,
       /, gv_short.

Regards

2 REPLIES 2

alejandro_bindi
Active Contributor
0 Kudos
99

Using that method is pretty straightforward:


PARAMETERS: p_vkorg TYPE vkorg.
DATA: gt_r3_sales_orgs  TYPE  crmt_r3_sales_org_t,
      gt_r3_sales_orgs_texts  TYPE  crmtb_orgman_r3_vkorg_text,
      gs_r3_sales_orgs_texts  TYPE  LINE OF crmtb_orgman_r3_vkorg_text.

APPEND p_vkorg TO gt_r3_sales_orgs.
cl_crm_orgman_services=>read_r3_sales_org_text(
  EXPORTING
    iv_r3_sales_orgs       = gt_r3_sales_orgs
  IMPORTING
    ev_r3_sales_orgs_texts = gt_r3_sales_orgs_texts
  EXCEPTIONS
    wrong_sales_org        = 1
    buffer_empty           = 2
    OTHERS                 = 3
       ).
CHECK sy-subrc = 0.

LOOP AT gt_r3_sales_orgs_texts INTO gs_r3_sales_orgs_texts.
  WRITE: gs_r3_sales_orgs_texts-description.
ENDLOOP.

If you want to retrieve the CRM description there's another code you can use. CRM Sales Organizations have a different format than R3's. So if you have an R/3 sales org. (i.e. VKORG) you previously have to convert it to CRM format.

You can use this methods for retrieving the CRM description:


PARAMETERS: p_vkorg TYPE vkorg.

DATA: gr_org_man TYPE REF TO cl_crm_org_management.
DATA: gv_crm_sales_org TYPE crmt_sales_org.
DATA: gv_description  TYPE  crmt_description.
DATA: gv_short  TYPE  crmt_sales_org_short.

cl_crm_org_management=>get_instance(
  IMPORTING
    ev_instance = gr_org_man
).

gr_org_man->get_sales_org_of_vkorg(
  EXPORTING
    iv_vkorg            = p_vkorg
  IMPORTING
    ev_sales_org        = gv_crm_sales_org
  EXCEPTIONS
    crm_key_not_defined = 1
    OTHERS              = 2
       ).
CHECK sy-subrc = 0.

gr_org_man->get_sales_org_description(
  EXPORTING
    iv_sales_org   = gv_crm_sales_org
  IMPORTING
    ev_description = gv_description
    ev_short       = gv_short
       ).

WRITE: /, gv_description,
       /, gv_short.

Regards

0 Kudos
98

Many thanks Alejandro Bindi , I know I can rely in this forum guys...thanks for the help.

You deserve the points.

best regards,

glenzg