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: 

replacing editor-call

Former Member
0 Kudos

hi , after recently upgrading from 4.6c to ecc6.0 we have experienced various program incompatibilities. I have the following problem can anyone help ?

I have a program that performs an editor-call for an internal table , however this no longer works.

I have been trying to utilise the cl_gui_textedit class as per saptextedit_demo_3 and am having problems displaying the contents of my internal table within the control window. again I have tried a number of set / get methods from the mentioned class without success. I receive the message that my internal table is not of type 'C'.

Any suggestions greatly appreciated.

8 REPLIES 8

Former Member
0 Kudos

Could you post a little bit of the code, specifically where you define the internal table, and where you invoke the GUI text editor control in a custom container...?

0 Kudos

Hi thanks for your response, I have not included the specific program I wish to change as it is huge, but my initial representation to ascertain how this would work for me. I have litle 'OO' experience , so I expect glaringly obvious errors but am appreciative of any guidance.

I have posted all of the code, as it is only a small demo.

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

REPORT Z_CF_GUI_TEST.

data: it_mara type table of mara,

wa_mara like line of it_mara.

START-OF-SELECTION.

CALL SCREEN 100.

DATA:

g_editor TYPE REF TO cl_gui_textedit,

g_editor_container TYPE REF TO cl_gui_custom_container,

g_ok_code LIKE sy-ucomm, " return code from screen

g_repid LIKE sy-repid.

CONSTANTS: c_line_length TYPE i VALUE 256.

                      • not sure what this bit is for ?

TYPES: BEGIN OF mytable_line,

line(c_line_length) TYPE c,

END OF mytable_line.

  • table to exchange text

DATA g_mytable TYPE TABLE OF mytable_line.

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

CLASS cl_gui_cfw DEFINITION LOAD.

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

  • P B O

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

MODULE pbo OUTPUT.

                        • simple selection to populate internal table

SELECT MATNR FROM MARA INTO WA_MARA-MATNR

WHERE MATNR = '143793914'.

APPEND WA_MARA TO IT_mara.

endselect.

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

IF g_editor IS INITIAL.

SET PF-STATUS 'MAIN100'.

g_repid = sy-repid.

CREATE OBJECT g_editor_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.

ENDIF.

CREATE OBJECT g_editor

EXPORTING

parent = g_editor_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 = g_repid

txt2 = space

txt1 = text-001.

ENDIF.

ENDIF.

                                              • fails at this point, it_mara not compatible ?

CALL METHOD g_editor->SET_TEXT_AS_R3TABLE

EXPORTING

TABLE = it_mara

EXCEPTIONS

ERROR_DP = 1

ERROR_DP_CREATE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. " PBO

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

  • P A I

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

MODULE pai INPUT.

CASE g_ok_code.

WHEN 'EXIT'.

PERFORM exit_program.

when 'CHANGE'.

call method G_editor->set_readonly_mode

exporting readonly_mode = 0.

call method cl_gui_cfw=>flush.

WHEN 'DISPLAY'.

call method G_editor->set_readonly_mode

exporting readonly_mode = 1.

call method cl_gui_cfw=>flush.

WHEN 'SAVE'.

CALL METHOD g_editor->get_text_as_r3table

IMPORTING

table = g_mytable

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = space

txt1 = text-003.

ENDIF.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = space

txt1 = text-002.

ENDIF.

WHEN 'LOAD'.

CALL METHOD g_editor->set_text_as_r3table

EXPORTING

table = g_mytable

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = space

txt1 = text-004.

ENDIF.

ENDCASE.

CLEAR g_ok_code.

ENDMODULE. " PAI

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

  • F O R M S

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

&----


*& Form EXIT_PROGRAM

&----


FORM exit_program.

IF NOT g_editor IS INITIAL.

CALL METHOD g_editor->free

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = space

txt1 = text-005.

ENDIF.

FREE g_editor.

ENDIF.

IF NOT g_editor_container IS INITIAL.

CALL METHOD g_editor_container->free

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

ENDIF.

FREE g_editor_container.

ENDIF.

CALL METHOD cl_gui_cfw=>flush

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = space

txt1 = text-002.

ENDIF.

LEAVE PROGRAM.

Thanks again

Regards

Chris

0 Kudos

Sorry for slow response - had no system access. Looking at the code, I'd suggest the problem is probably the structure you are passing into the text control - rather than having it_mara like mara, maybe structure it with:

data:
  begin of gs_mara,
    matnr               like mara-matnr,
  end of gs_mara,
  gt_mara               like gs_mara occurs 10.

0 Kudos

Hi many thanks for your response - all works fine until I add a typ P field or decimals - I understand it is because of the unicode conversion - but am still at los as how to resolve it...

Once again thoughts appreciated

regards

chris

0 Kudos

Hi , it may help if I illustrate the changes made :

                                    • data statement

data:

begin of gs_mara,

matnr like mara-matnr,

VOLTO LIKE MARA-VOLTO,

end of gs_mara,

gt_mara like gs_mara occurs 10.

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

selection statement :

SELECT: MATNR VOLTO FROM MARA INTO CORRESPONDING FIELDS OF GS_MARA

WHERE MTART = 'RAW'.

APPEND gS_MARA TO gT_MARA.

ENDSELECT.

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

this works fine but the transfer then fails and message below is received :

For the statement

"SEARCH itab FOR g"

only internal tables with a character-type row type are supported at

the argument position "LINE OF itab". Character-type data types are the types

C,

N, D, T, and String, as well as structures that contain only the types

C, N, D, and T as components. Structures containing strings are not

supported. In the Unicode context, the type 'X', X-strings, or

structures that contain not only character-type components, are

regarded as non-character-type.

In this case, the internal table "LINE OF itab" has the non-character-type row

type "u".

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

Guess I've got some learning to do.

Chris

0 Kudos

I'll take a better look tomorrow when I have a SAP system in front of me, but my suggestion would be that you create your structure with character fields and "write" any other fields into these e.g. something like

begin of gs_data,
  amount_char(20)        type c,
  volta_char(40)         type c,
end of gs_data,
*"... etc
select {some data} into corresponding fields of ls_mara
  from mara
  where mtart = 'RAW'.
write: ls_mara-volta to gs_data-volta_char left-justified. "or whatever
append gs_data to gt_data

endselect.

*"... etc

0 Kudos

Many thanks for your help , using yoursuggestion I have now resolved the problem.

Thanks again.

chris

Former Member
0 Kudos