cancel
Showing results for 
Search instead for 
Did you mean: 

CRMD_Order Tables for Notes and Reason

Former Member
0 Kudos

Hello Experts,

Could you help me to find out the tables used for storing the

1. Reason field and its corresponding codes.

2. Log (Internal Notes)

For reading the text, I am following the link but READ_TEXT FM is not working with GUID. It is taking TDNAME as "GUID + <Some text which includes Date>".

Pointers towards this will be a advantages to us.

Thanks in Advance,

Prashant

Accepted Solutions (1)

Accepted Solutions (1)

VishnAndr
Active Contributor

Hello, Prashant.

READ_TEXT function module is definetly what you need to get text for order.

Import parameters should be:

ID = text id (A002, A003 etc)

NAME = object GUID

OBJECT = 'CRM_ORDERH'

You can check this putting a breakpoint at the beggining of READ_TEXT and entering an order wich has some text.

Regarding reasons... If you don't need direct table access to them it's better to use FM CRM_ORDER_READ (by the way, it returns texts too in et_text) for getting desired information. It returns only what you ask for. Reasons too.

Former Member
0 Kudos

Hi Andrei,

Thanks for you reply. When I tried to run READ_TEXT using only GUID, I am not getting result but when I tried to use the same with GUID + some text which contains Date, it is returning correct text value.

Sample TDNAME from my system : "4EF2CD76E21413A0E1008000AC1E1586 20111226072745989".

4EF2CD76E21413A0E1008000AC1E1586 is my GUID got from CRMD_ORDERADM_H but how to get another text (BOLD text from TDNAME)which is from GUID?

Any pointers?

Thanks,

Prashant

VishnAndr
Active Contributor
0 Kudos

If in TDNAME there is also a timestamp so it seems that this text type has a 'Log' or 'Display Log' active in text determination procedure (P or R for Changes column).

So you need to get all existed TDNAMEs for your order and text type and then read them with READ_TEXT fm consequentially.

You can select them right from STXH using TDID, TDOJECT and TDLANGUAGE. And for TDNAME use a pattern: your_guid+*. It will return all TDNAMEs for your GUID.

Alternatively you can use SELECT_TEXT fm to do the same.

VishnAndr
Active Contributor
0 Kudos

I can guess that 'reason' you can get from et_service_os table of CRM_ORDER_READ.

If you care of a perfomance for this FM: If you ask the system to return only desired information (table), then it will read only data which is needed for requested table. It collects requested objects in CRM_ORDER_READ with statement:

IF IT_REQUESTED_OBJECTS is INITIAL.
   INCLUDE LCRM_ORDER_APIF12.
ELSE.
   lt_requested_objects = it_requested_objects.
ENDIF.

So if you don't send this FM it_requested_objects the system will fill it with actually requested by you (take a look into mentioned include).

Former Member
0 Kudos

Hi Andrei,

Thanks for your valuable inputs.

I can able to retrieve the 'Reason' field along with the associated code by using FM 'CRM_ORDER_READ'. I have used below code.


 data:
     lt_header_guid TYPE CRMT_OBJECT_GUID_TAB,
     ls_header_guid type CRMT_OBJECT_GUID,
     lt_text  TYPE CRMT_TEXT_WRKT,
     LT_SERVICE_OS type CRMT_SRV_OSSET_WRKT,
     cv_log_handle  TYPE BALLOGHNDL,
     ls_requested   TYPE CRMT_OBJECT_NAME,
     lt_requested   TYPE CRMT_OBJECT_NAME_TAB.

  ls_header_guid = '4EF2CD76E21413A0E1008000AC1E1586'.
  APPEND ls_header_guid to  lt_header_guid.

  ls_requested = 'SERVICE_OS'.
  append ls_requested to lt_requested.
  ls_requested = 'TEXT'.
  append ls_requested to lt_requested.

  CALL FUNCTION 'CRM_ORDER_READ'
    EXPORTING
      IT_HEADER_GUID        = lt_header_guid
      IT_REQUESTED_OBJECTS = lt_requested
    IMPORTING
      ET_TEXT                     = lt_text
      ET_SERVICE_OS        = LT_SERVICE_OS
    CHANGING
      CV_LOG_HANDLE     = cv_log_handle
    EXCEPTIONS
      OTHERS                     = 7.
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.

The 'Reason' and its code can be found in

1. LT_SERVICE_OS[1]-OSSET[1]-SUBJECT[1]-CODETEXT

2. LT_SERVICE_OS[1]-OSSET[1]-SUBJECT[1]-CODE

But I am not able to retrieve text in ET_TEXT. When I Run report CRM_READ_ORDER I can see log in ET_TEXT.

Am I missing anything?

Thanks,

Prashant

VishnAndr
Active Contributor
0 Kudos

First thing.

As I stated above you do not need to fill lt_requested_object by yourself. System will take care of this.

Second.

You have P in Changes for the text type. So it will never be returned from CRM_ORDER_READ FM (but for example text type with R will). So you need to get text from READ_TEXT and fetch it.

Former Member
0 Kudos

Hi Andrei,

We can use FM 'CRM_TEXT_READ_API' to fetch the log. I am using below code -


data : 
	li_header_guid         TYPE CRMT_OBJECT_GUID_TAB,
	ls_header_guid 	type CRMT_OBJECT_GUID,
	li_text                 	type CRMT_TEXT_WRKT. 

  ls_header_guid = '4EF2CD76E21413A0E1008000AC1E1586'.
  APPEND ls_header_guid to  lt_header_guid.

* Call this FM to read 'Internal Note' for the Order.
  CALL FUNCTION 'CRM_TEXT_READ_API'
    EXPORTING
      IT_GUID        = li_header_guid
      IV_OBJECT_KIND = 'A'
    IMPORTING
      ET_TEXT        = li_text.

The log can be found in li_text[1]-lines

Thanks again for your great help Andrei...

Regards,

Prashant

Former Member
0 Kudos

Hi Prashant,

can we use 'CRM_TEXT_READ_API' FM to fetch follow on task.if yes what r the export parameters.

Thanks in advance.

Answers (1)

Answers (1)

Former Member
0 Kudos

General Procedure to retrieve Transaction specific Text  notes  ( ex Order/Leads/Opportunity/service request etc ).

Step1: get the "Transaction Guid" (ex Lead) from  from the table "crmd-orderadm_h".

Step2: Enter the "Transaction Guid" of (step1) ,under the field "Text Name" along with other parameters as shown in example in the table "STXL" in order to retrieve Text Guid.

note: based upon the number of text types defined ,we will get "n" of Text Guids.

example:

ZLD1-lead specific text

Text object     CRM_ORDERH (SAP Standard for transactions)

Text Name     E83935A924381ED3A (Transaction Guid)

Text ID          Lead (you can get Text ids details from the text management as per your project)

Language       EN.

Step3: Enter the "Text Guid" in the function module "READ_TEXT" (use T-code SE37) along with other parameters as shown in below example to get Transaction specific long text.

example

CLIENT                          XXX

ID                                  Lead

LANGUAGE                   EN

NAME                            E83935A924381AD3AACD46D9E5A45ZXC

OBJECT                        CRM_ORDERH.

Result:

*  Lead is from SAP golden customer,contact asap.