Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
SAP Text Edit Control to Db

SAP Text Edit Control to Db



|Views: 1,274|Likes:
Published by hfumey
This example is used to display a custom text-object into a dynpro with a container as text edit control.There it is editable and can be saved without any kind of formatting of the text (except line breaks).
Feel free to comment.
This example is used to display a custom text-object into a dynpro with a container as text edit control.There it is editable and can be saved without any kind of formatting of the text (except line breaks).
Feel free to comment.

More info:

Published by: hfumey on Jul 29, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





*&====================================================================** Z_TEXT_EDIT_CONTROL_TO_DB **=====================================================================** This small program is to demonstrate a rudimentary way to read and ** save entries from the CL_GUI_TEXTEDIT control to a text-object. ** The requirement was a simple possibility of text entry with no text ** formatting (except line breaks) which could be displayed in an ** embedded dynpro. ** ** I found many examples of the EDIT_TEXT functions and how to use the ** CL_GUI_TEXTEDIT class but non in combination. **---------------------------------------------------------------------** AUTHOR: Harry Fumey ** DATE: 29.07.2009 ** **=====================================================================** COMMENTS: ** Create a dynpro 0100 and three push buttons named "PB_EXIT" ** "PB_READ" and "PB_SAVE" as well as a custom container named ** "CONTAINER". ** The push buttons have function code "EXIT", "SAVE" and "READ". ** Create your own text objects and id’s using SE75 to play around **PROGRAM name: *
REPORTz_text_edit_control_to_db.CONSTANTSlengthTYPE i VALUE 132. DATAx_headLIKEthead.
" Header from DB
" Line from DB
" Work area
DATAg_subrcTYPEsubrc. DATAis_modifiedTYPE i. DATA: ok_codeLIKEsy-ucomm. DATA: g_initTYPEchar1.
* Create ref for custom container 
DATA: ccontainerTYPE REF TOcl_gui_custom_container.
* Create ref for text edit control
DATA: editorTYPE REF TOcl_gui_textedit.
*********************************************************************** Transport table for Control to internal table**********************************************************************
TYPES: BEGIN OFty_ttable,  line(length)TYPE c,  END OFty_ttable. DATA:wa_ttableTYPEty_ttable,i_ttableTYPE TABLE OFty_ttable. SELECTION-SCREEN BEGIN OF BLOCKt1WITH FRAME. PARAMETERS:
p_objectLIKEstxh-tdobjectDEFAULT 'ZADM', p_nameLIKEstxh-tdname,p_idLIKEstxh-tdidDEFAULT 'ZAD1', p_sprasLIKEstxh-tdsprasDEFAULTsy-langu. SELECTION-SCREEN END OF BLOCKt1. START-OF-SELECTION. PERFORMread_text_from_db.
*&---------------------------------------------------------------------**& Form READ_TEXT_FROM_DB*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*
* Read the text object from DB into data table
 CALL FUNCTION 'READ_TEXT'  EXPORTING client= sy-mandt id= p_id language= p_sprasname = p_nameobject = p_object IMPORTING header= x_head TABLES lines= xnote EXCEPTIONS id=1  language=2 name =3not_found =4object =5reference_check =6wrong_access_to_archive =7 OTHERS=8.  IFsy-subrc =0.
* Loop over data table and fill internal table for the text edit control* The field for formatting is omitted.
 LOOP ATxnoteINTOwa_xnote. wa_ttable-line= wa_xnote-tdline. APPENDwa_ttableTOi_ttable.  CLEARwa_ttable. ENDLOOP.g_init ='X'. ENDIF.
" read_text_from_db*---------------------------------------------------------------------** MODULE USER_COMMAND_0100 INPUT **---------------------------------------------------------------------*
MODULEuser_command_0100INPUT.  CASEok_code. WHEN 'READ'.  PERFORMread_text_into_control. WHEN 'SAVE'.  PERFORMsave_text_to_db. WHEN 'EXIT'.  LEAVE TO SCREEN 0.  WHEN OTHERS.  ENDCASE.ENDMODULE.
" USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------**& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------*
* Check if control is present
* Make object for the custom container 
 CREATEOBJECT ccontainer EXPORTINGcontainer_name ='CONTAINER' EXCEPTIONScntl_error =1cntl_system_error =2create_error =3lifetime_error =4lifetime_dynpro_dynpro_link =5 OTHERS=6 . IFsy-subrc <>0.  MESSAGE IDsy-msgidTYPE 'I' NUMBERsy-msgno  WITHsy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
* If the container is initial we need to create the control too
 CREATEOBJECT editor EXPORTINGwordwrap_mode =cl_gui_textedit=>wordwrap_at_fixed_positionwordwrap_position = lengthwordwrap_to_linebreak_mode = cl_gui_textedit=>trueparent = ccontainer EXCEPTIONSerror_cntl_create =1error_cntl_init =2error_cntl_link =3error_dp_create =4

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
test_crskoeln liked this
sudeeshravindran liked this
Bou Savong liked this
tejas_2008 liked this
Sandeep Asthana liked this
sandeepbhalla liked this
tohaboy liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->