Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

CRM RFC

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

Former Member
replied

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 View this answer in context
Not what you were looking for? View more on this topic or Ask a question