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: 

Cluster to custom container

Former Member
0 Kudos
161

Hi Friends,

I'm working on an object which involves transfering data stored in clusters(PCL1) to the custom container(text editor in infotype), i.e, importing the text from cluster to text editor and dislaying the text in text editor.

I would be glad to receive inputs on this.

Cheers,

Rajeev

1 ACCEPTED SOLUTION

Former Member
0 Kudos
127

Rajeev SM

Glad to hear that the solution is helpful to you.

Regards

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
127

What kind of input are you looking for. Do you need help with the text editor or getting the data which is to be put in the text editor.

Here is a quick sample of an implementation of the text editor in a docking container. This can easlily be converted to use a dynpro with custom container.



report zrich_0001
       no standard page heading.

* Variable for "Text Container" Abap Object
data: editor type ref to cl_gui_textedit,
      docking type ref to cl_gui_docking_container.

data: wa_text like tline-tdline.

data: begin of lines occurs 0.
        include structure tline.
data: end of lines.

data: textlines like tline-tdline occurs 0.
data: syrepid type sy-repid.

parameters: p_check type c.

at selection-screen output.

  syrepid = sy-repid.

  check docking is initial.

  create object docking
              exporting repid     = syrepid
                        dynnr     = sy-dynnr
                        side      = docking->dock_at_left
                        extension = 500.

  create object editor
      exporting parent = docking.

  perform set_text.

start-of-selection.

  perform write_text.

************************************************************************
*       FORM write_text                                                *
************************************************************************
form write_text.

  data: modified type i.

* Retrieve text from container
  call method editor->get_text_as_r3table
     exporting
           only_when_modified = space
     importing
           table              = textlines
           is_modified        = modified
     exceptions
           others             = 1.

* Write out contents of text editor
  leave to list-processing.
  loop at textlines into wa_text.
    write:/ wa_text.
  endloop.

endform.

************************************************************************
*      FORM  SET_TEXT
************************************************************************
form set_text.

  lines-tdline = 'Here we are filling the text editor - Line 1'.
  append lines.

  lines-tdline = 'Here we are filling the text editor - Line 2'.
  append lines.

  loop at lines .
    shift lines left deleting leading space.
    append lines to textlines .
  endloop.

* Fill container with text lines
  call method editor->set_text_as_r3table
     exporting
           table              = textlines
           exceptions
           others             = 1.

endform.

Regards,

Rich Heilman

Former Member
0 Kudos
127

Hi, you mentioned import data from cluster table.

As I know the import/export mechansim can store/read data with cluster table.

Something like following:

INDXKEY = 'KEYVALUE'.

  • store to cluster

EXPORT F1 F2 ... TO

DATABASE PCL1(XX) ID INDXKEY.

  • read from cluster

IMPORT F1 F2 ... FROM DATABASE PCL1(XX) ID INDXKEY.

Hope it will be helpful

Former Member
0 Kudos
127

Hi, something need to reinforce.

in my formerly example,

INDXKEY = 'KEYVALUE'.

  • store to cluster

EXPORT F1 F2 ... TO

DATABASE PCL1(XX) ID INDXKEY.

Will create a entry in table PCL1, RELID = 'XX', SRTFD = 'KEYVALUE'

Similarly, IMPORT F1 F2 ... FROM DATABASE PCL1(XX) ID INDXKEY. is just like reading this entry with certain key condition.

But you ought to know the defination of data structure store in the PCL1. Otherwise, the data can't be read correctly.

Former Member
0 Kudos
127

Hi Heilman / Zhenglin,

Your inputs worked!! Thanks a lot, now i'm able to import/export texts from/to cluster.

Cheers,

Rajeev

0 Kudos
127

Cool, please mark this post as solved. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos
128

Rajeev SM

Glad to hear that the solution is helpful to you.

Regards