cancel
Showing results for 
Search instead for 
Did you mean: 

Fill textbox in WEBUI using FM COM_TEXT MAINTAIN

Former Member
0 Kudos

Hi Gurus,

I am a newbie in CRM.

i would like to ask how to fill (by using codes) a textbox in webui using the FM Com_Text_Maintain with a standard text coming from SO10.

is there a general or usual way of doing it?

Requirements:

1. When the user picks "templates" from the drop down list, the system will fill up the textbox with a standard text coming from SO10.

2. The user can edit the the standard text written in the textbox afterwards.

thank you very much

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have solved the issue,

I am now able to append and save standard texts in my textbox and in the logs.

i just removed the processing of ls_attr-conc_formatted_lines from the code above. conc_formatted_lines should be empty.

Answers (1)

Answers (1)

Former Member
0 Kudos


Hi Lronmac,

I have had a similar scenario that I was wanting to implement into our Service Ticket Transaction within IC.

You are on the right path, however all you need to do is;

1. Create a Standard Text entry (SO10) with the text you are wanting to pull into the textbox

2. Create a custom FM i.e. Z_CRM_HEADER_TEXT

   
    DATA lt_lines TYPE TABLE OF TLINE.

  es_reference-tdobject = 'TEXT'.
  es_reference-tdid = 'ST'.
  es_reference-tdname = 'ZCRM_DEFAULT_HEADING'.
  es_reference-tdspras = sy-langu.

2. Create an Access Sequence i.e. Z_TEMP

Maintain the Definition of Access Sequence
Ref Object: TEXT
Ref Text Type: ST
Function: Z_CRM_HEADER_TEXT

Go back to your 'Definition of Procedure' and maintain the Access field with your Access Sequence Object.

Refresh Web UI and it should now pull through the Standard Text

Former Member
0 Kudos

Hi Thomas!

Thanks for the reply, really appreciate it.


Unfortunately, We already tried that procedure but it does not work...

The functionality where the standard text showing up in the text box works for us before the upgrade.


We had our system upgraded recently which caused this the standard text to disappear in the text box.


I tried tinkering with the codes and i was able to pull up the standard text from the SO10. -> (i celebrated with a beer when the standard text showed up in the textbox)

But the problem now is that when i press "save", the edited standard text (yes, the user will edit the textbox with the standard text in it) is not saved in the logs -> only the bare standard text is saved and appended in the logs.

Here is what i did so far:

1. I redefined class CL_SRQM_NOT_TEXTVIEW_IMPL      method CHECK_CREATE_BTTEXT

2. the codes in red is the one i added, i included some part of the codes from the method for reference purposes to where you are in the code.

* creation logic is in on_new_focus of BTText node

*   Add the new item to the collection

     IF new_entity_x IS BOUND.

**     Set the focus

       current_x ?= new_entity_x.

*     Set the text profile

       current_x->set_property(

                    iv_attr_name = 'TDOBJECT'                "#EC NOTEXT

                    iv_value     = lv_text_obj_x ).

       current_x->set_property_as_string(

                    iv_attr_name = 'TDSPRAS'                 "#EC NOTEXT

                    iv_value     new_tdspras_x ).

       current_x->set_property_as_string(

                    iv_attr_name = 'TDID'                    "#EC NOTEXT

                    iv_value     = new_tdid_x ).


**** LRON START NOV 19 2014

*      new_entity_x->deactivate_sending( ).

*      typed_context->bttext->collection_wrapper->add( iv_entity    = new_entity_x

*                                                      iv_set_focus = abap_true ).

TYPES: text_line(132) TYPE c.

   DATA: ls_attr       TYPE crmst_text_btil,

         lt_text_table TYPE TABLE OF text_line,

         lt_itf_text   TYPE comt_text_lines_t,

         lv_string     TYPE string,

         lv_str        TYPE string,

         lv_blanks     TYPE i.

   FIELD-SYMBOLS: <str> TYPE text_line.

*****************************************************************************************

** GET THE TEMPLATE!

   CALL FUNCTION 'READ_TEXT'

   EXPORTING

                ID                            = 'ST'

                 LANGUAGE             = 'E'

                 NAME                     = 'ZST_ZTCASE'

                 OBJECT                   = 'TEXT'

     TABLES

                 LINES                      = lt_itf_text

    EXCEPTIONS

                 ID                           = 1

                 LANGUAGE            = 2

                 NAME                    = 3

                 NOT_FOUND         = 4

                 OBJECT                 = 5

                 REFERENCE_CHECK                          = 6

                 WRONG_ACCESS_TO_ARCHIVE       = 7

                 OTHERS                                             = 8

             .

   IF SY-SUBRC = 0.

* Implement suitable error handling here

   CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

     EXPORTING

       language    = 'E'

     TABLES

       itf_text    = lt_itf_text

       text_stream = lt_text_table.

   LOOP AT lt_text_table ASSIGNING <str>.

* this crude logig has to be implemented since abap cuts off

* blanks at the end of a string

     MOVE <str> TO lv_str.

     SHIFT lv_str BY lv_blanks PLACES RIGHT.

     CONCATENATE lv_string lv_str INTO lv_string.

     lv_blanks = 132 - STRLEN( <str> ).

   ENDLOOP.

   ls_attr-conc_lines = lv_string.        "CONCLINES!!!!!

* Fill out the concatenated formated text lines field ---

   ls_attr-conc_formatted_lines = cl_gstext_tools=>transform_itf_to_itfstring( lt_itf_text ). "FORMATTED-CONCLINES!!!!!!

IF sy-subrc = 0.

IF new_tdid_x = 'ZTEM'.

       current_x->set_property_as_string(

                    iv_attr_name = 'CONC_LINES'                    "#EC NOTEXT

                    iv_value     = ls_attr-conc_lines ).

       current_x->set_property_as_string(

                    iv_attr_name = 'CONC_FORMATTED_LINES'                    "#EC NOTEXT

                    iv_value     = ls_attr-conc_formatted_lines ).

       new_entity_x->deactivate_sending( ).

       typed_context->bttext->collection_wrapper->add( iv_entity    = new_entity_x

                                                       iv_set_focus = abap_true ).

       else.

         new_entity_x->deactivate_sending( ).

       typed_context->bttext->collection_wrapper->add( iv_entity    = new_entity_x

                                                       iv_set_focus = abap_true ).

ENDIF.

ENDIF.

     ENDIF.

**** LRONEND NOV 19 2014

       typed_context->bttext->collection_wrapper->publish_current( ).

     ENDIF.

   ENDIF.

   gv_prev_changeable = lv_changeable_x.



Any thoughts?

Thank you very much!