Saturday, June 22, 2013
Usage: You can enter and display multi-line text.
Procedure with steps
- Create Web Dynpro Component with Window and View(Automatically View is embedded into Window).
- Go to view ->Context tab
- Change mode .
- Ctreate two attributes STR_TAB_01 and STR_TAB_01 of type STRING_TABLE.
- Go to view ->Layout tab
- Change root UI element ROOTUIELEMENTCONTAINER property LAYOUT = MatrixLayout.
- Insert TextEdit element(txtedit_4_free_txt_01). Change the element properties COLS = 72 and ROWS = 6.
- Bind context attribute str_tab_01 with UI element txtedit_4_free_txt_01.
- Insert Button UI element. Change the element property LAYOUT = MatrixHeadData .
- Insert TextEdit element(txtedit_4_free_txt_02). Change the element properties LAYOUT = MatrixHeadData, COLS = 72 and ROWS = 6.
- Bind context attribute str_tab_02 with UI element txtedit_4_free_txt_02.
- Create onAction event SUBMIT for Button UI element.
- Write the below code for Event Handler method ONACTIONSUBMIT.
METHOD ONACTIONSUBMIT . DATA LO_EL_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT. DATA LS_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT. DATA LV_STR_TAB TYPE WD_THIS->ELEMENT_CONTEXT-STR_TAB. " get element via lead selection LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ). "get single attribute LO_EL_CONTEXT->GET_ATTRIBUTE( EXPORTING NAME = `STR_TAB` IMPORTING VALUE = LV_STR_TAB ). DATA LT_TLINE TYPE ZTLINE. LT_TLINE = WD_THIS->CONVERT_LGTEXTS( STR_TAB = LV_STR_TAB ). DATA LV_STR_TAB02 TYPE WD_THIS->ELEMENT_CONTEXT-STR_TAB02. " get element via lead selection LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ). LV_STR_TAB02 = WD_THIS->GET_LGTEXTS( TEXT_TABLE = LT_TLINE ). " set single attribute LO_EL_CONTEXT->SET_ATTRIBUTE( NAME = `STR_TAB02` VALUE = LV_STR_TAB02 ). ENDMETHOD.
- Method CONVERT_LGTEXTS code.
METHOD CONVERT_LGTEXTS . DATA:LT_STR_TAB TYPE STRING_TABLE, LS_STR TYPE STRING. TYPES: LTY_TDLINE TYPE TLINE-TDLINE, LTY_TLINE TYPE TLINE. DATA: LT_TDLINE TYPE STANDARD TABLE OF LTY_TDLINE. DATA: LS_TDLINE TYPE LTY_TDLINE, LS_TLINE TYPE LTY_TLINE. DATA: LV_TXTSTR TYPE STRING. CHECK STR_TAB IS NOT INITIAL. LT_STR_TAB = STR_TAB. LOOP AT LT_STR_TAB INTO LS_STR. CLEAR LT_TDLINE[]. LV_TXTSTR = LS_STR. "Convert the string to a table CALL FUNCTION 'CONVERT_STRING_TO_TABLE' EXPORTING I_STRING = LV_TXTSTR I_TABLINE_LENGTH = 72 TABLES ET_TABLE = LT_TDLINE. LOOP AT LT_TDLINE INTO LS_TDLINE. MOVE LS_TDLINE TO LS_TLINE-TDLINE. APPEND LS_TLINE TO TEXT_TABLE. ENDLOOP. ENDLOOP. ENDMETHOD.
- Method GET_LGTEXTS code.
- Create Web Dynpro Application.
- Run application
METHOD GET_LGTEXTS . TYPES: LTY_TEXT TYPE TLINE-TDLINE, LTY_TLINE TYPE TLINE, LTY_TSTR TYPE STRING. DATA: LT_TEXT TYPE STANDARD TABLE OF LTY_TEXT, LT_TSTR TYPE STANDARD TABLE OF LTY_TSTR. DATA: LS_TEXT TYPE LTY_TEXT, LS_TLINE TYPE LTY_TLINE, LS_TSTR TYPE LTY_TSTR. LOOP AT TEXT_TABLE INTO LS_TLINE. MOVE LS_TLINE-TDLINE TO LS_TSTR. APPEND LS_TSTR TO LT_TSTR. CLEAR LS_TSTR. ENDLOOP. TEXT_STRING = LT_TSTR. ENDMETHOD.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
Thanks for sharing this Information. SAP Web Dynpro Course in Gurgaon
ReplyDelete