Skip to Content
author's profile photo Former Member
Former Member

free text in one of the screen dialog program

Hi ALL,

I have a requirement in dialog programming.

My requirement is that i need a free text in ony my screen.

I have a button on one my screen ,when i press it it should take me a new screen. where i can enter free text like in a note pad or abap editor.

let say i have a unique id and for that i need a free text and i need to save it because when i want i need to display.

Is it possible in dialog program.

If yes please let me know how to create and how to write the code for it and how does it gets saved.

Its bit urgent please let me know.

Thanks in advance.

waiting for your replies s

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Oct 10, 2006 at 01:24 PM

    Hi Swathi,

    YOu can use the methods of the class cl_gui_textedit.

    Refer these links:

    addition-of-text-editor

    text-editor-on-selection-screen

    text-editor

    Regards,

    ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 10, 2006 at 01:32 PM

    There are couple ways to do this, the easiest is to use the EDIT_TEXT function module. Here you will save your text as long text like most of the text in the system is stored. You will need to create a custom text object / id via the transaction SE75.

    In this example, it is reading in any pre-existig text then passing this to the EDIT_TEXT function which displays a screen where the user can add or change the text, user presses save on this screen and it is saved to the db.

    
    report zrich_0003 .
    
    data: xthead type  thead.
    data: ilines type table of tline with header line.
    
    xthead-tdobject = 'ZPT_DET'.   "<- Custom Object
    xthead-tdid     = 'Z001'.      "<- Custom Id
    xthead-tdname   = '004500'.    "<- Name
    xthead-tdspras  = sy-langu.
    xthead-tdlinesize = 72.
    
    call function 'READ_TEXT'
         exporting
              id                      = xthead-tdid
              language                = xthead-tdspras
              name                    = xthead-tdname
              object                  = xthead-tdobject
         tables
              lines                   = ilines
         exceptions
              id                      = 1
              language                = 2
              name                    = 3
              not_found               = 4
              object                  = 5
              reference_check         = 6
              wrong_access_to_archive = 7
              others                  = 8.
    
    
    call function 'EDIT_TEXT'
         exporting
              header        = xthead
         tables
              lines         = ilines
         exceptions
              id            = 1
              language      = 2
              linesize      = 3
              name          = 4
              object        = 5
              textformat    = 6
              communication = 7
              others        = 8.
    
    check sy-subrc = 0.
    
    

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi rich and all,

      I HAVE CRETED A CONTROL CONTAINER WITH NAME TEXTEDITOR1.

      I HAVE USED THIS CODE.

      when i run the t code for my dialog program i can write the text.

      CAN YOU GUYS PLEASE TELL ME HOW TO SAVE IT AND HOW TO RETRIEVE.

      i HAVE NEVER USED THIS .Can you guys be more detailed .

      Let me give an example. lets say we have an SOCIAL SECURITY ID .

      i HAVE A CREATE BUTTON IN MY INITIAL SCREEN

      I GIVE SSN AND PRESS TEXT,THERE I SHOULD BE ABLE WRITE TEXT AND SAVE IT.

      WHEN I GO TO MY INITIAL SCREEN AND CLICK DISPLAY AND I GIVE THE SSN AND THEN PRESS TEXT , INEED TO DISPLAY THE FREE TEXT.

      hOPE IAM CLEAR

      pLEASE HELP ME OUT.

      MODULE STATUS_9001 OUTPUT.

      DATA : V_REPID LIKE SY-REPID.

      V_REPID = SY-REPID.

      SET PF-STATUS '9001'.

      • SET TITLEBAR 'xxx'.

      CREATE OBJECT TEXTEDIT_CUSTOM_CONTAINER

      EXPORTING

      CONTAINER_NAME = 'TEXTEDITOR1'

      EXCEPTIONS

      CNTL_ERROR = 1

      CNTL_SYSTEM_ERROR = 2

      CREATE_ERROR = 3

      LIFETIME_ERROR = 4

      LIFETIME_DYNPRO_DYNPRO_LINK = 5.

      IF SY-SUBRC NE 0.

      • add your handling

      ENDIF.

      • create calls constructor, which initializes, creats and links

      • a TextEdit Control

      CREATE OBJECT EDITOR

      EXPORTING

      PARENT = TEXTEDIT_CUSTOM_CONTAINER

      WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION

      WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE

      EXCEPTIONS

      OTHERS = 1.

      IF SY-SUBRC NE 0.

      CALL FUNCTION 'POPUP_TO_INFORM'

      EXPORTING

      TITEL = V_REPID "--> program name

      TXT2 = SPACE

      TXT1 = 'Error in flush'.

      ENDIF.

      ENDMODULE. " STATUS_9001 OUTPUT

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2006 at 01:35 PM

    Hi,

    For creating a text editor , where you can enter the text you can use the class <b>cl_gui_textedit</b>.

    You will have to create a coustum container and link that to the object of this class.

    • create control container

    DATA: g_editor_container TYPE REF TO

    cl_gui_custom_container.

    CREATE OBJECT g_editor_container

    EXPORTING

    container_name = 'EDITOR'

    EXCEPTIONS

    cntl_error = 1

    cntl_system_error = 2

    create_error = 3

    lifetime_error = 4

    lifetime_dynpro_dynpro_link = 5.

    • create calls constructor, which initializes, creats and links

    • TextEdit Control

    DATA:g_editor TYPE REF TO cl_gui_textedit.

    CREATE OBJECT g_editor

    EXPORTING

    parent = g_editor_container

    wordwrap_mode =

    cl_gui_textedit=>wordwrap_at_fixed_position

    wordwrap_position = line_length

    wordwrap_to_linebreak_mode =

    cl_gui_textedit=>true.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2006 at 01:39 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 10, 2006 at 01:53 PM

    Hi,

    cehck the Below Blog...

    /people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class

    
    *--  test program to display a text area thru a custom control
    
    PROGRAM  z_test_text    .
    DATA: txt     TYPE REF TO cl_gui_textedit,
          txt_con TYPE REF TO cl_gui_custom_container.
    DATA: gt_text(100) OCCURS 10 WITH HEADER LINE.
    DATA: BEGIN OF it_tab OCCURS 0,
          LINE(100),
          END OF it_tab.
    
    start-of-selection.
    
    
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_1000  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_1000 OUTPUT.
      SET PF-STATUS 'TEXT'.
      SET TITLEBAR 'TEXT AREA'.
    it_tab-line = 'aaaaaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    
    it_tab-line = 'aaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    
    it_tab-line = 'aaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    
    it_tab-line = 'aaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    
    it_tab-line = 'aaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    
    it_tab-line = 'aaa'.
    append it_tab.
    it_tab-line = 'bbb'.
    append it_tab.
    it_tab-line = 'ccc'.
    append it_tab.
    it_tab-line = 'ddd'.
    append it_tab.
    *-- test display in text area
    *  gt_text = 'aaa'.
    *  APPEND gt_text.
    *-- populating gt_text from it_tab.
     loop at it_tab.
        gt_text = it_tab-line.
        append gt_text.
     endloop.
    
    ENDMODULE.                 " STATUS_1000  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  pbo_1000  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE pbo_1000 OUTPUT.
      DATA: container(30).
    
      container = 'TEXT'.
    
      IF txt IS INITIAL.
        CREATE OBJECT txt_con
         EXPORTING
           container_name = container
         EXCEPTIONS
           OTHERS = 1.
    
        CREATE OBJECT txt
          EXPORTING
           parent = txt_con
           wordwrap_mode  = cl_gui_textedit=>wordwrap_at_fixed_position
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
      ENDIF.
    
      CALL METHOD txt_con->link
        EXPORTING
          repid     = sy-repid
          dynnr     = '1000'
          container = container.
    
      CALL METHOD txt->set_toolbar_mode
        EXPORTING
          toolbar_mode = txt->true.
    
      CALL METHOD txt->set_statusbar_mode
        EXPORTING
          statusbar_mode = txt->true.
    
      CALL METHOD txt->set_wordwrap_behavior
        EXPORTING
          wordwrap_mode = txt->true.
    
    *-- set text -------------------------------------------
      IF gt_text[] IS INITIAL.
    
      ENDIF.
    
      CALL METHOD txt->set_text_as_r3table
        EXPORTING
          table = gt_text[].
    
    * CALL METHOD txt->set_readonly_mode.
    
    ENDMODULE.                 " pbo_1000  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_1000  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE user_command_1000 INPUT.
      CASE sy-ucomm.
        WHEN  'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    
    ENDMODULE.                 " USER_COMMAND_1000  INPUT

    use this code and enter your text , and then get the text as internal table using the method

    CALL METHOD txt->get_text_as_r3table

    importing

    table = gt_text[].

    and then use SAVE_TEXT Fm to save it. pass the appropriate parameters.

    Regards

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      CALL METHOD g_editor->get_text_as_r3table

      IMPORTING

      table = g_mytable.

      after getting the text of the editor ,while saving into SAP with the help SAVE_TEXT ,only first 2 chars are gettign saved .

      CALL FUNCTION 'SAVE_TEXT'

      EXPORTING

      header = xthead

      TABLES

      lines = tline

      EXCEPTIONS

      id = 1

      language = 2

      name = 3

      object = 4

      OTHERS = 5.

      the format of g_mytable and tine is different...

      please help me to get the solution.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2006 at 01:59 PM

    Hi,

    Via transaction SE75 you can maintain your own text objects.

    You can use them with function module Read_text, Edit_text, Save_text ( for example in this order )

    Good luck,

    Daisy

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Rich Heilman

      Hi Rich. Thanks for being forum moderator and for helping out fellow SAP people.

      I am currently working on an ABAP program with a concern similar to the one posted here. Could you also email me the material you sent here? Kindly send to celesteuy79@yahoo.com.

      Thanks and God bless!

      Celeste

      Edited by: Celeste Uy on Apr 5, 2008 12:36 PM

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.