cancel
Showing results for 
Search instead for 
Did you mean: 

Insert data in a table

Former Member
0 Kudos
237

Hello Experts,

I am new to BSP..I am creating a basic application.

The application must provide users capability to insert/update/delete records in a database table ZCRMTEMP...the table is ready and has 4 fields.

So far I have created a basic layout,have add 4 page attribute and oninputprocessing i am doing "navigation->set_parameter( 'Field 1' ).

I am sure most of you guys must have done this before..so can you please help on this....

Points will be rewarded

thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member196065
Participant
0 Kudos

Hi Sushant Naik,

I think you need a table maintanice like insert update and delete

I will give example code through which you can implement as per your requirement.

In this example i am using MVC

If you have any doubts let me know

As you informed me you are new to BSP it is better to use MVC technology rather than Page with flow logic

<b>Applicaiton Details</b>

APPLICATION NAME:ZTABMAINTANCE

DESCRIPTION:Table Maintance

APPLICATION CLASS:

START PAGE:Main.do

STATEFUL APPLICATION

<b>Create the following 2 views</b>

<b>Main.htm</b>

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<%@extension name="xhtmlb" prefix="xhtmlb" %>

<%@extension name="bsp" prefix="bsp" %>

<%@extension name="phtmlb" prefix="phtmlb" %>

<script language = "javascript">

var inputkey_id;

var inputtext_id;

function callF4File_PN(key_id,text_id)

{

inputkey_id = key_id;

inputtext_id = text_id;

eval("var strURL = 'F4Helps.do?CATEGORY_ID=" + inputkey_id.value + "'" );

window.open(strURL,'pn','resizable=yes,height=420,width=350,dependent=yes,status=yes');

}

function returnData(keyData,textData)

{

inputkey_id.value = keyData;

inputtext_id.value = textData;

}

</script>

<htmlb:content design="design2003" >

<htmlb:page title="Main View " >

<htmlb:form>

<htmlb:tray id = "MAINTRAY"

title = "Table Maintance Example"

width = "70%" >

<htmlb:trayBody>

<xhtmlb:toolbar id="TLBR1" >

<xhtmlb:toolbarItem>

<%

if controller->M_SAVE_BUTTON_FLAG is initial.

%>

<xhtmlb:toolbarButton id = "Create"

enabled = "<%= controller->l_attr %>"

onClick = "create"

text = "Create"

tooltip = "Create new S/R records" />

<xhtmlb:toolbarButton id = "modify"

enabled = "<%= controller->l_attr %>"

onClick = "modify"

text = "Modify"

tooltip = "Modify selected S/R records" />

<xhtmlb:toolbarButton id = "delete"

enabled = "<%= controller->l_attr %>"

onClick = "delete"

onClientClick = "var Check = false; Check = confirm('Do you want to delete selected Employee record?');if(Check == false){ htmlbevent.cancelSubmit = true; }"

text = "Delete"

tooltip = "Delete selected S/R record" />

<xhtmlb:toolbarButton id = "sel"

enabled = "<%= controller->l_attr %>"

onClick = "selall"

text = "Select All"

tooltip = "Select All Records" />

<xhtmlb:toolbarButton id = "desel"

enabled = "<%= controller->l_attr %>"

onClick = "deselall"

text = "DeSelect All"

tooltip = "DeSelect All Records" />

<xhtmlb:toolbarButton id = "deselsingle"

enabled = "<%= controller->l_attr %>"

onClick = "deselsingle"

text = "DeSelect Single"

tooltip = "DeSelect Single Row" />

<%

if controller->sel_mode eq 'MULTISELECT'.

%>

<xhtmlb:toolbarButton id = "change"

enabled = "<%= controller->l_attr %>"

onClick = "change"

text = "Change to Single Selection"

tooltip = "Changge to Single Selection" />

<%

endif.

%>

<%

else.

%>

<xhtmlb:toolbarButton id = "save"

enabled = "<%= controller->l_attr %>"

onClick = "save"

text = "<%= controller->M_save_button_text %>"

tooltip = "Save" />

<xhtmlb:toolbarButton id = "cancel"

enabled = "<%= controller->l_attr %>"

onClick = "cancel"

text = "Cancel" />

<%

endif.

%>

</xhtmlb:toolbarItem>

</xhtmlb:toolbar>

<%

DATA : LV_STR TYPE STRING.

CONCATENATE 'Table Selection Mode is ' controller->sel_mode into LV_STR SEPARATED BY SPACE.

%>

<xhtmlb:overflowContainer>

<htmlb:tableView id = "tview"

headerVisible = "true"

headerText = "<%= LV_STR %>Z"

footerVisible = "true"

selectionMode = "<%= controller->sel_mode %>"

filter = "SERVER"

width = "100%"

design = "alternating"

visibleRowCount = "<%= controller->m_visibleRowCount %>"

fillUpEmptyRows = "false"

selectedRowIndex = "<%= controller->m_selectedrowindex %>"

visibleFirstRow = "<%= controller->m_visiblefirstrow %>"

iterator = "<%= controller %>"

table = "<%= controller->IT_EMP %>" />

</xhtmlb:overflowContainer>

</htmlb:trayBody>

</htmlb:tray>

<%

if not controller->m_msgtext is initial.

%>

<phtmlb:messageBar id = "message"

text = "<%= controller->m_msgtext %>"

type = "<%= controller->m_msgtype %>" />

<%

clear controller->m_msgtext.

clear controller->m_msgtype.

endif.

%>

</htmlb:form>

</htmlb:page>

</htmlb:content>

<b>Create Second View

F4HELP.HTM</b>

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<%@extension name="xhtmlb" prefix="xhtmlb" %>

<%@extension name="bsp" prefix="bsp" %>

<%@extension name="phtmlb" prefix="phtmlb" %>

<htmlb:content design="design2003" >

<htmlb:page title="Main View " >

<htmlb:form>

<%

if not controller->sel_empcode is initial.

%>

<script language = "javascript">

window.opener.returnData( <%= controller->sel_empcode %>, <%= controller->sel_empname %> );

self.close( );

</script>

<%

clear : controller->sel_empcode, controller->sel_empname.

endif.

%>

<htmlb:tray id = "MAINTRAY"

title = "Employee Details"

width = "70%" >

<htmlb:trayBody>

<xhtmlb:overflowContainer>

<htmlb:tableView id = "tview_f4"

headerVisible = "true"

headerText = "Select Employee"

footerVisible = "true"

selectionMode = "SINGLESELECT"

filter = "SERVER"

width = "100%"

design = "alternating"

visibleRowCount = "10"

fillUpEmptyRows = "false"

selectedRowIndex = "<%= controller->m_selectedrowindex %>"

visibleFirstRow = "<%= controller->m_visiblefirstrow %>"

iterator = "<%= controller %>"

table = "<%= controller->IT_EMP %>" />

</xhtmlb:overflowContainer>

<xhtmlb:toolbar id="TLBR1" >

<xhtmlb:toolbarItem>

<xhtmlb:toolbarButton id = "copy"

enabled = "X"

onClick = "save"

text = "Copy"

tooltip = "Copy" />

<xhtmlb:toolbarButton id = "cancel"

enabled = "X"

onClientClick = "self.close();return false;"

text = "Cancel" />

</xhtmlb:toolbarItem>

</xhtmlb:toolbar>

</htmlb:trayBody>

</htmlb:tray>

<%

if not controller->m_message is initial.

%>

<phtmlb:messageBar id = "message"

text = "<%= controller->m_message %>"

type = "<%= controller->m_msgtype %>" />

<%

clear controller->m_message.

endif.

%>

</htmlb:form>

</htmlb:page>

</htmlb:content>

You Need to Create 2 Controllers

1.<b> Main.do</b>

<b>Controller Properties</b>

CONTROLLER_NAME:MAIN.DO

ERROR HANDLING:

IS ERROR PAGE?NO

ERROR PAGE:

CONTROLLER CLASS :ZCL_TM_MAIN

STATUS

STATE: UNCHANGED

LIFETIME: UNTIL PAGE CHANGE

CACHING

BROWSER CACHE:0

SERVER CACHE:0

LOG DETAILS

CREATED BY:BCUSER ON20060526

CHANGED BY:BCUSER ON20060526

<b>Controller Class Information</b>

ZCL_TM_MAIN

Controller Class for ZTABMAINTANCE

INHERITED FROM:CL_BSP_CONTROLLER2

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS IMPLEMENTAION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" local class implementation for public class

" use this source file for the implementation part of

" local helper classes

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS TYPES

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" use this source file for any type declarations (class

" definitions, interfaces or data types) you need for method

" implementation or private method's signature

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS MACROS

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" use this source file for any macro definitions you need

" in the implementation part of the class

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

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

ATTRIBUTES

-


IT_EMP INSTANCE ATTRIBUTE PUBLIC TYPE ZEMPLOYEE_T Employee Table Type

L_ATTR INSTANCE ATTRIBUTE PUBLIC TYPE CHAR1 'X' Single-Character Flag

C_MINLINES INSTANCE ATTRIBUTE PUBLIC TYPE I

M_SELECTEDROWINDEX INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_VISIBLEFIRSTROW INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_ROW_REF INSTANCE ATTRIBUTE PRIVATE TYPE REF TO ZEMPLOYEE Employee Details

SEL_MODE INSTANCE ATTRIBUTE PUBLIC TYPE STRING 'SINGLESELECT'

M_SAVE_BUTTON_FLAG INSTANCE ATTRIBUTE PUBLIC TYPE CHAR1 Single-Character Flag

M_SAVE_BUTTON_TEXT INSTANCE ATTRIBUTE PUBLIC TYPE STRING

ADD_FLAG INSTANCE ATTRIBUTE PRIVATE TYPE CHAR1 Single-Character Flag

M_VISIBLEROWCOUNT INSTANCE ATTRIBUTE PUBLIC TYPE I 5

M_TABLENAME INSTANCE ATTRIBUTE PRIVATE TYPE STRING 'ZEMPLOYEE'

M_MSGTEXT INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_MSGTYPE INSTANCE ATTRIBUTE PUBLIC TYPE STRING

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

METHODS

-


INSERT_DATABASE INSTANCE METHOD PRIVATE Inserting the Record the Database

^^^^PARAMETERS

P_ROW_INDEX IMPORTING PASS BY REFERENCE MANDATORY TYPE I

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method INSERT_DATABASE.

data : wa_emp type zemployee.

read table it_emp into wa_emp index p_row_index.

if sy-subrc eq 0.

INSERT INTO ZEMPLOYEE VALUES WA_EMP.

if sy-subrc eq 0.

me->m_msgtext = 'Successfully Inserted Record'.

me->m_msgtype = 'OK'.

else.

me->m_msgtext = 'Problem while inserting to the database table'.

me->m_msgtype = 'ERROR'.

endif.

endif.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

UPDATE_DATABASE INSTANCE METHOD PRIVATE Updating the Database

^^^^PARAMETERS

P_ROW_INDEX IMPORTING PASS BY REFERENCE MANDATORY TYPE I

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method update_database.

data : wa_emp type zemployee.

read table it_emp into wa_emp index p_row_index.

if sy-subrc eq 0.

update zemployee from wa_emp.

if sy-subrc eq 0.

me->m_msgtext = 'Successfully Updated'.

me->m_msgtype = 'OK'.

else.

me->m_msgtext = 'Problem while updating the database table'.

me->m_msgtype = 'ERROR'.

endif.

endif.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

VALIDATE INSTANCE METHOD PRIVATE Data Validation

^^^^PARAMETERS

P_ROW_INDEX IMPORTING PASS BY REFERENCE MANDATORY TYPE I

P_RET RETURNING PASS BY VALUE MANDATORY TYPE STRING

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method VALIDATE.

DATA : WA_EMP TYPE ZEMPLOYEE.

READ TABLE IT_EMP INTO WA_EMP INDEX P_ROW_INDEX.

IF SY-SUBRC EQ 0.

P_RET = 'OK'.

IF wa_emp-empcode IS INITIAL.

P_RET = 'Please enter Employee Code'.

ELSEIF WA_EMP-EMPGROSS IS initial.

P_RET = 'Please enter Employee Gross Salary'.

ELSEIF WA_EMP-EMPGROSS LE 0.

P_RET = 'Employee Gross Salary cannot be less than zero'.

ENDIF.

ENDIF.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

MODIFY_TABLE_ENTRIES_FOR_CELL INSTANCE METHOD PRIVATE

^^^^PARAMETERS

P_REQUEST IMPORTING PASS BY REFERENCE MANDATORY TYPE REF TO IF_HTTP_REQUEST HTTP Framework (iHTTP) HTTP Request

P_COMPONENT_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_ROW_INDEX IMPORTING PASS BY REFERENCE OPTIONAL TYPE I

P_COLUMN_INDEX IMPORTING PASS BY REFERENCE OPTIONAL TYPE I

P_EVENT IMPORTING PASS BY REFERENCE OPTIONAL TYPE REF TO CL_HTMLB_EVENT HTMLB Basic Event

P_TABLEVIEW_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_HITS_PER_PAGE IMPORTING PASS BY REFERENCE MANDATORY TYPE I

TABLE_NAME IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

PT_ITAB CHANGING PASS BY REFERENCE MANDATORY TYPE TABLE

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method MODIFY_TABLE_ENTRIES_FOR_CELL.

DATA: i TYPE i,

visiblerow TYPE i,

l_id TYPE string,

lo_tv_event TYPE REF TO cl_htmlb_event_tableview,

lo_tableview TYPE REF TO cl_htmlb_tableview,

lt_forms TYPE tihttpnvp,

l_str TYPE string,

l_cell_id TYPE string,

l_cell_val TYPE string,

ls_form TYPE ihttpnvp,

lo_record_tab TYPE REF TO data,

lo_record_tab_line TYPE REF TO data,

lo_type_ref TYPE REF TO cl_abap_typedescr,

ls_header TYPE x030l,

l_field TYPE x030l-refname.

FIELD-SYMBOLS: <fs_field> TYPE ANY,

<fs_record_tab> TYPE table,

<fs_record_tab_line> TYPE ANY.

  • get the table view event

TRY.

  • if a table view event

lo_tv_event ?= p_event.

CATCH cx_root.

ENDTRY.

IF NOT lo_tv_event IS BOUND.

TRY.

  • if not tableview event

if p_component_id is not initial.

CONCATENATE p_component_id '_' p_tableview_id INTO l_id.

else.

move p_tableview_id to l_id.

endif.

lo_tableview ?= cl_htmlb_manager=>get_data(

request = p_request

name = 'tableView'

id = l_id ).

lo_tv_event = lo_tableview->data.

CATCH cx_root.

ENDTRY.

ENDIF.

*

CHECK NOT lo_tv_event IS INITIAL.

*

  • get form field table

CALL METHOD p_request->get_form_fields

CHANGING

fields = lt_forms.

  • start of loop for the tableview

  • i = lo_tv_event->visiblefirstrowindex.

            • Note 838397*********

visiblerow = lo_tv_event->visiblefirstrowindex.

i = 1.

            • End of Note 838397*********

*

  • identify the type of the table at runtime and

  • build field symbols for the structure and table

  • CALL METHOD cl_abap_typedescr=>describe_by_data

  • EXPORTING

  • p_data = pt_itab

  • RECEIVING

  • p_descr_ref = lo_type_ref.

  • CALL METHOD lo_type_ref->get_ddic_header

  • RECEIVING

  • p_header = ls_header.

  • l_field = ls_header-refname.

l_field = table_name.

CREATE DATA lo_record_tab_line TYPE (l_field).

ASSIGN lo_record_tab_line->* TO <fs_record_tab_line>.

CREATE DATA lo_record_tab TYPE STANDARD TABLE OF (l_field).

ASSIGN lo_record_tab->* TO <fs_record_tab>.

*

<fs_record_tab> = pt_itab.

*

  • loop through the visible rows

DO p_hits_per_page TIMES.

IF p_row_index IS SUPPLIED.

IF p_row_index NE i.

i = i + 1.

ENDIF.

  • only modify the row in interest if row is supplied

CHECK p_row_index EQ i.

ENDIF.

READ TABLE <fs_record_tab> INTO <fs_record_tab_line> INDEX i.

  • the number of visible entries may be less than the hits per page

IF sy-subrc EQ 0.

  • loop through the columns and modify the corresponding entries in the

  • internal table

LOOP AT lo_tv_event->allcolumnnames INTO l_str.

IF p_column_index IS SUPPLIED.

  • only modify the column in interest if column is supplied

CHECK p_column_index EQ sy-tabix.

ENDIF.

l_cell_id = lo_tv_event->get_cell_id( row_index = p_row_index

column_index = sy-tabix ).

READ TABLE lt_forms INTO ls_form WITH KEY name = l_cell_id.

IF sy-subrc EQ 0.

MOVE ls_form-value TO l_cell_val.

ELSE.

CLEAR l_cell_val.

ENDIF.

CONCATENATE '<fs_record_tab_line>-' l_str INTO l_str.

ASSIGN (l_str) TO <fs_field>.

CHECK sy-subrc EQ 0.

MOVE l_cell_val TO <fs_field>.

ENDLOOP.

MODIFY <fs_record_tab> FROM <fs_record_tab_line> INDEX i.

ENDIF.

i = i + 1.

  • ****** Note 838397*********

visiblerow = visiblerow + 1.

ENDDO.

pt_itab = <fs_record_tab>.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

SET_VISIBLE_ROW INSTANCE METHOD PRIVATE

^^^^PARAMETERS

PT_ITAB IMPORTING PASS BY REFERENCE MANDATORY TYPE TABLE

P_TABLEVIEW_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_HITS_PER_PAGE IMPORTING PASS BY REFERENCE MANDATORY TYPE I

VISIBLE_ROW_INDEX EXPORTING PASS BY REFERENCE MANDATORY TYPE STRING

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method SET_VISIBLE_ROW.

    • Set the visiblerow to display the new record on the visible page of

    • the tableview.

data : tablines(5) type C,

count(7) type p decimals 2.

describe table PT_ITAB lines tablines.

tablines = tablines - 1.

count = tablines / P_HITS_PER_PAGE.

if count ge 1.

tablines = tablines div P_HITS_PER_PAGE.

VISIBLE_ROW_INDEX = tablines * P_HITS_PER_PAGE + 1.

else.

VISIBLE_ROW_INDEX = 1.

endif.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

GET_TV_ATTRIBUTES INSTANCE METHOD PRIVATE

^^^^PARAMETERS

P_TV_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_COMPONENT_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

PO_REQUEST IMPORTING PASS BY REFERENCE MANDATORY TYPE REF TO IF_HTTP_REQUEST HTTP Framework (iHTTP) HTTP Request

P_VISIBLE_FIRST_INDEX EXPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_SELECTED_INDEX EXPORTING PASS BY REFERENCE MANDATORY TYPE STRING

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method GET_TV_ATTRIBUTES.

DATA:

lo_tableview TYPE REF TO cl_htmlb_tableview,

lo_tv_event TYPE REF TO cl_htmlb_event_tableview,

lv_id TYPE string.

data : p_visible_first_key type string,

ps_selected_key type string,

pt_selected_indices type int4_table,

pt_selected_keys type string_table.

*-- Construct tableview id

IF NOT p_component_id IS INITIAL.

CONCATENATE p_component_id '_' p_tv_id INTO lv_id.

ELSE.

lv_id = p_tv_id.

ENDIF.

  • get tableview

TRY.

lo_tableview ?= cl_htmlb_manager=>get_data(

request = po_request

name = 'tableView'

id = lv_id ).

CATCH cx_root.

*-- nothing happens

ENDTRY.

  • get tableview event data

CHECK lo_tableview IS BOUND.

lo_tv_event = lo_tableview->data.

CHECK lo_tv_event IS BOUND.

CLEAR: p_visible_first_key, p_visible_first_index,

p_selected_index, ps_selected_key,

pt_selected_indices[], pt_selected_keys[].

p_visible_first_index = lo_tv_event->visiblefirstrowindex.

p_visible_first_key = lo_tv_event->visiblefirstrowkey.

p_selected_index = lo_tv_event->selectedrowindex.

IF lo_tv_event->selectedrowindex <> 0.

ps_selected_key = lo_tv_event->selectedrowkey.

ENDIF.

pt_selected_indices[] = lo_tv_event->prevselectedrowindextable[].

pt_selected_keys[] = lo_tv_event->prevselectedrowkeytable[].

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

ADD_TABLE_ENTRY INSTANCE METHOD PRIVATE Adding Table Entry to Internal Table

^^^^PARAMETERS

P_REQUEST IMPORTING PASS BY REFERENCE MANDATORY TYPE REF TO IF_HTTP_REQUEST HTTP Framework (iHTTP) HTTP Request

P_COMPONENT_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_ROW_INDEX IMPORTING PASS BY REFERENCE OPTIONAL TYPE I

P_COLUMN_INDEX IMPORTING PASS BY REFERENCE OPTIONAL TYPE I

P_EVENT IMPORTING PASS BY REFERENCE OPTIONAL TYPE REF TO CL_HTMLB_EVENT HTMLB Basic Event

P_TABLEVIEW_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

TABLE_NAME IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

PT_ITAB CHANGING PASS BY REFERENCE MANDATORY TYPE TABLE

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method ADD_TABLE_ENTRY.

DATA: l_id TYPE string,

lo_tv_event TYPE REF TO cl_htmlb_event_tableview,

lo_tableview TYPE REF TO cl_htmlb_tableview,

lt_forms TYPE tihttpnvp,

l_str TYPE string,

l_cell_id TYPE string,

l_cell_val TYPE string,

ls_form TYPE ihttpnvp,

lo_record_tab TYPE REF TO data,

lo_record_tab_line TYPE REF TO data,

lo_type_ref TYPE REF TO cl_abap_typedescr,

ls_header TYPE x030l,

l_field TYPE x030l-refname.

FIELD-SYMBOLS: <fs_field> TYPE ANY,

<fs_record_tab> TYPE table,

<fs_record_tab_line> TYPE ANY.

  • get the table view event

TRY.

  • if a table view event

lo_tv_event ?= p_event.

CATCH cx_root.

ENDTRY.

IF NOT lo_tv_event IS BOUND.

TRY.

  • if not tableview event

if p_component_id is not initial.

CONCATENATE p_component_id '_' p_tableview_id INTO l_id.

else.

move p_tableview_id to l_id.

endif.

lo_tableview ?= cl_htmlb_manager=>get_data(

request = p_request

name = 'tableView'

id = l_id ).

lo_tv_event = lo_tableview->data.

CATCH cx_root.

ENDTRY.

ENDIF.

*

CHECK NOT lo_tv_event IS INITIAL.

*

  • get form field table

CALL METHOD p_request->get_form_fields

CHANGING

fields = lt_forms.

l_field = table_name.

CREATE DATA lo_record_tab_line TYPE (l_field).

ASSIGN lo_record_tab_line->* TO <fs_record_tab_line>.

CREATE DATA lo_record_tab TYPE STANDARD TABLE OF (l_field).

ASSIGN lo_record_tab->* TO <fs_record_tab>.

*

<fs_record_tab> = pt_itab.

*

IF p_row_index IS SUPPLIED.

READ TABLE <fs_record_tab> INTO <fs_record_tab_line>

INDEX P_ROW_INDEX.

  • the number of visible entries may be less than the hits per page

IF sy-subrc EQ 0.

  • loop through the columns and modify the corresponding entries in the

  • internal table

LOOP AT lo_tv_event->allcolumnnames INTO l_str.

IF p_column_index IS SUPPLIED.

  • only modify the column in interest if column is supplied

CHECK p_column_index EQ sy-tabix.

ENDIF.

l_cell_id = lo_tv_event->get_cell_id( row_index = p_row_index

column_index = sy-tabix ).

READ TABLE lt_forms INTO ls_form WITH KEY name = l_cell_id.

IF sy-subrc EQ 0.

MOVE ls_form-value TO l_cell_val.

ELSE.

CLEAR l_cell_val.

ENDIF.

CONCATENATE '<fs_record_tab_line>-' l_str INTO l_str.

ASSIGN (l_str) TO <fs_field>.

CHECK sy-subrc EQ 0.

MOVE l_cell_val TO <fs_field>.

ENDLOOP.

MODIFY <fs_record_tab> FROM <fs_record_tab_line>

INDEX p_row_indEX.

ENDIF.

ENDIF.

pt_itab = <fs_record_tab>.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method do_handle_event.

data : wa type zemployee,

lv_lines type i,

lv_count type i,

lv_sel_index type i,

lv_r_msg type string.

call method me->get_tv_attributes

exporting

p_tv_id = 'tview'

p_component_id = me->component_id

po_request = me->request

importing

p_visible_first_index = me->m_visiblefirstrow

p_selected_index = me->m_selectedrowindex.

case event.

when 'modify'.

me->sel_mode = 'LINEEDIT'.

me->m_save_button_flag = 'X'.

m_save_button_text = 'Update'.

me->add_flag = 'M'.

when 'create'.

me->sel_mode = 'LINEEDIT'.

me->add_flag = 'A'.

me->m_save_button_flag = 'X'.

m_save_button_text = 'Save'.

append wa to it_emp.

describe table it_emp lines lv_lines.

me->m_selectedrowindex = lv_lines.

call method set_visible_row

exporting

p_tableview_id = 'tview'

pt_itab = me->it_emp

p_hits_per_page = me->m_visiblerowcount

importing

visible_row_index = me->m_visiblefirstrow.

when 'cancel'.

clear m_save_button_flag.

me->sel_mode = 'SINGLESELECT'.

if me->add_flag eq 'A'.

clear lv_lines.

describe table it_emp lines lv_lines.

delete it_emp from lv_lines.

clear :me->m_selectedrowindex.

endif.

  • Update/Save Details.

when 'save'.

  • Updating the Modified Details

if add_flag = 'M'.

  • Moving the Selected row Index into Local Variable type I

lv_sel_index = me->m_selectedrowindex.

  • Update the selected Row

call method me->modify_table_entries_for_cell

exporting

p_request = me->request

p_component_id = me->component_id

p_tableview_id = 'tview'

p_row_index = lv_sel_index

p_hits_per_page = me->m_visiblerowcount

table_name = me->m_tablename

changing

pt_itab = me->it_emp.

  • Data Validation Here we need to pass Row Index

clear lv_r_msg.

lv_r_msg = me->validate( p_row_index = lv_sel_index ).

if lv_r_msg eq 'OK'.

  • updating the Dtatabase

me->update_database( p_row_index = lv_sel_index ).

  • Clear and Setting the Default Values After Updataion

clear m_save_button_flag.

me->sel_mode = 'SINGLESELECT'.

clear :me->m_selectedrowindex.

else.

me->m_msgtext = lv_r_msg.

me->m_msgtype = 'ERROR'.

endif.

  • Saving the New Record Details into Internal Table

elseif add_flag = 'A'.

  • Get the Intenal table Record Count as New Record was added at end.

clear lv_lines.

describe table it_emp lines lv_lines.

  • Add/Update the entry into Internal table

call method me->add_table_entry

exporting

p_request = me->request

p_component_id = me->component_id

p_row_index = lv_lines

p_tableview_id = 'tview'

table_name = me->m_tablename

changing

pt_itab = me->it_emp.

  • Deselect the selected Row

call method cl_htmlb_manager=>check_tableview_row

exporting

mode = me->sel_mode

row = lv_lines

request = request

id = 'tview'

check = space.

  • Data Validation Here we need to pass Row Index

clear lv_r_msg.

lv_r_msg = me->validate( p_row_index = lv_lines ).

if lv_r_msg eq 'OK'.

  • Insert to the Dtatabase

me->insert_database( p_row_index = lv_lines ).

  • Clear and Setting the Default Values After Updataion

clear m_save_button_flag.

me->sel_mode = 'SINGLESELECT'.

clear :me->m_selectedrowindex.

else.

me->m_msgtext = lv_r_msg.

me->m_msgtype = 'ERROR'.

endif.

endif.

  • Select all the row for this Selection Mode should be MultiSelect

when 'sel'.

me->sel_mode = 'MULTISELECT'.

describe table me->it_emp lines lv_count.

call method cl_htmlb_manager=>check_tableview_all_rows

exporting

rowcount = lv_count

request = request

id = 'tview'

check = 'X'.

  • DeSelect all the row for this Selection Mode should be MultiSelect

when 'desel'.

me->sel_mode = 'MULTISELECT'.

call method cl_htmlb_manager=>check_tableview_all_rows

exporting

rowcount = lv_count

request = request

id = 'tview'

check = space.

  • DeSelect the selected row for this Selection Mode should be SINGLESELECT

when 'deselsingle'.

me->sel_mode = 'SINGLESELECT'.

data : lv_temp type int4.

move me->m_selectedrowindex to lv_temp.

call method cl_htmlb_manager=>check_tableview_row

exporting

mode = me->sel_mode

row = lv_temp

request = request

id = 'tview'

check = space.

endcase.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method DO_INIT.

clear it_emp[].

select * from zemployee up to 50 rows into table it_emp.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method DO_REQUEST.

DATA : MY_VIEW TYPE REF TO IF_BSP_PAGE.

class cl_htmlb_manager definition load.

MY_VIEW ?= CREATE_VIEW( VIEW_NAME = 'Main.htm' ).

dispatch_input( ).

CALL_VIEW( MY_VIEW ).

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

INTERFACE

-


Interface Name :IF_HTMLB_TABLEVIEW_ITERATOR

Interface Description :For Table Looping and Filtering

-


Interface Methods

-


GET_COLUMN_DEFINITIONS Column Definitions Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_COLUMN_DEFINITIONS Changing Type TABLEVIEWCONTROLTAB

P_OVERWRITES Changing Type TABLEVIEWOVERWRITETAB

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.

FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.

<def>-COLUMNNAME = 'EMPCODE'.

<def>-TITLE = 'Employee Code'.

<def>-WIDTH = '30%'.

<def>-SORT = 'X'.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.

<def>-COLUMNNAME = 'EMPNAME'.

<def>-TITLE = 'Employee Name'.

<def>-WIDTH = '60%'.

<def>-SORT = 'X'.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.

<def>-COLUMNNAME = 'EMPGROSS'.

<def>-TITLE = 'Gross Salary'.

<def>-WIDTH = '10%'.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

RENDER_ROW_START New row Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_ROW_INDEX Importing Type I

P_ROW_KEY Importing Type STRING

P_ROW_DATA_REF Importing DATA

P_EDIT_MODE Importing Type XFELD ' '

P_SKIP_ROW Returning Type XFELD

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.

m_row_ref ?= p_row_data_ref.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

RENDER_CELL_START New Column in Row Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_CELL_ID Importing Type STRING

P_CELL_BINDING Importing Type STRING

P_ROW_INDEX Importing Type I

P_ROW_KEY Importing Type STRING

P_COLUMN_INDEX Importing Type I

P_COLUMN_KEY Importing Type STRING

P_ROW_DATA_REF Importing DATA

P_EDIT_MODE Importing Type XFELD

P_REPLACEMENT_BEE Exporting IF_BSP_BEE

P_STYLE Changing Type STRING

P_CLASS Changing Type STRING

P_ISREADONLY Changing Type XFELD

P_ISHIERCELL Changing Type XFELD

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.

data: name type string,

str type string,

len type i,

columnid type n,

cell1 type string.

case p_column_index.

when 1.

if p_edit_mode is not initial.

clear p_style.

data : col1_input_field type ref to cl_htmlb_inputfield.

create object col1_input_field.

col1_input_field->id = p_cell_id.

col1_input_field->width = '95%'.

col1_input_field->type = 'STRING'.

col1_input_field->value = m_row_ref->empcode.

col1_input_field->style = 'height:100%'.

p_style = 'font-size:1.0em'.

col1_input_field->cellvalue = ' '.

col1_input_field->disabled = 'FALSE'.

name = p_cell_id.

len = strlen( name ) - 1 .

columnid = name+len(1) + 1.

name = name+0(len).

concatenate name columnid into name.

concatenate 'document.forms[0].' p_cell_id into cell1.

concatenate 'document.forms[0].' name into name.

concatenate 'javascript:callF4File_PN('

cell1

','

name

'); '

into str.

data col1_image type ref to cl_htmlb_image.

create object col1_image.

col1_image->id = 'img_partner'.

col1_image->src = 'ICON_ALERT'.

col1_image->onClientClick = str.

data: col1_bee_table type ref to cl_bsp_bee_table.

create object col1_bee_table.

col1_bee_table->add_html(

html = `<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap width="100%">` ).

col1_bee_table->add( element = col1_input_field ).

col1_bee_table->add_html( html = `</td><td align="right" style="padding-right:2px">` ).

col1_bee_table->add( element = col1_image ).

col1_bee_table->add_html( html = `</td></tr></table>` ).

p_isreadonly = 'X'.

p_replacement_bee = col1_bee_table.

endif.

when 2.

if p_edit_mode is not initial.

clear p_style.

data : col2_input_field type ref to cl_htmlb_inputfield.

create object col2_input_field.

col2_input_field->id = p_cell_id.

col2_input_field->width = '95%'.

col2_input_field->type = 'STRING'.

col2_input_field->disabled = 'X'.

col2_input_field->value = m_row_ref->empname.

col2_input_field->style = 'height:100%'.

p_style = 'font-size:1.0em'.

p_replacement_bee = col2_input_field.

endif.

when 3.

if p_edit_mode is not initial.

clear p_style.

data : col3_input_field type ref to cl_htmlb_inputfield.

create object col3_input_field.

col3_input_field->id = p_cell_id.

col3_input_field->width = '95%'.

col3_input_field->type = 'STRING'.

col3_input_field->value = m_row_ref->empgross.

col3_input_field->style = 'height:100%'.

p_style = 'font-size:1.0em'.

p_replacement_bee = col3_input_field.

endif.

endcase.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

EVENTS

-


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

TYPE-GROUPS

-


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

INTERNAL TYPES

-


<b>Second Controller : F4Helps.do</b>

CONTROLLER_NAME:F4HELPS.DO

ERROR HANDLING:

IS ERROR PAGE?NO

ERROR PAGE:

CONTROLLER CLASS :ZCL_TM_F4HELPS

STATUS

STATE: UNCHANGED

LIFETIME: UNTIL PAGE CHANGE

CACHING

BROWSER CACHE:0

SERVER CACHE:0

LOG DETAILS

CREATED BY:BCUSER ON20060527

CHANGED BY:BCUSER ON20060527

<b>Second Class Information</b>

ZCL_TM_F4HELPS

Controller Class for ZTABMAINTANCE

INHERITED FROM:CL_BSP_CONTROLLER2

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS IMPLEMENTAION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" local class implementation for public class

" use this source file for the implementation part of

" local helper classes

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS TYPES

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" use this source file for any type declarations (class

" definitions, interfaces or data types) you need for method

" implementation or private method's signature

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

CLASS MACROS

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

" use this source file for any macro definitions you need

" in the implementation part of the class

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

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

ATTRIBUTES

-


IT_EMP INSTANCE ATTRIBUTE PUBLIC TYPE ZEMPMASTER_T Table type for Employee Master Table

M_SELECTEDROWINDEX INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_VISIBLEFIRSTROW INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_ROW_REF INSTANCE ATTRIBUTE PRIVATE TYPE REF TO ZEMPMASTER Employee Master Table

SEL_EMPCODE INSTANCE ATTRIBUTE PUBLIC TYPE STRING

SEL_EMPNAME INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_MESSAGE INSTANCE ATTRIBUTE PUBLIC TYPE STRING

M_MSGTYPE INSTANCE ATTRIBUTE PUBLIC TYPE STRING

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

METHODS

-


GET_TV_ATTRIBUTES INSTANCE METHOD PRIVATE

^^^^PARAMETERS

P_TV_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_COMPONENT_ID IMPORTING PASS BY REFERENCE MANDATORY TYPE STRING

PO_REQUEST IMPORTING PASS BY REFERENCE MANDATORY TYPE REF TO IF_HTTP_REQUEST HTTP Framework (iHTTP) HTTP Request

P_VISIBLE_FIRST_INDEX EXPORTING PASS BY REFERENCE MANDATORY TYPE STRING

P_SELECTED_INDEX EXPORTING PASS BY REFERENCE MANDATORY TYPE STRING

^^^^EXCEPTION

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method GET_TV_ATTRIBUTES.

DATA:

lo_tableview TYPE REF TO cl_htmlb_tableview,

lo_tv_event TYPE REF TO cl_htmlb_event_tableview,

lv_id TYPE string.

data : p_visible_first_key type string,

ps_selected_key type string,

pt_selected_indices type int4_table,

pt_selected_keys type string_table.

*-- Construct tableview id

IF NOT p_component_id IS INITIAL.

CONCATENATE p_component_id '_' p_tv_id INTO lv_id.

ELSE.

lv_id = p_tv_id.

ENDIF.

  • get tableview

TRY.

lo_tableview ?= cl_htmlb_manager=>get_data(

request = po_request

name = 'tableView'

id = lv_id ).

CATCH cx_root.

*-- nothing happens

ENDTRY.

  • get tableview event data

CHECK lo_tableview IS BOUND.

lo_tv_event = lo_tableview->data.

CHECK lo_tv_event IS BOUND.

CLEAR: p_visible_first_key, p_visible_first_index,

p_selected_index, ps_selected_key,

pt_selected_indices[], pt_selected_keys[].

p_visible_first_index = lo_tv_event->visiblefirstrowindex.

p_visible_first_key = lo_tv_event->visiblefirstrowkey.

p_selected_index = lo_tv_event->selectedrowindex.

IF lo_tv_event->selectedrowindex <> 0.

ps_selected_key = lo_tv_event->selectedrowkey.

ENDIF.

pt_selected_indices[] = lo_tv_event->prevselectedrowindextable[].

pt_selected_keys[] = lo_tv_event->prevselectedrowkeytable[].

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method DO_HANDLE_EVENT.

DATA : WA TYPE ZEMPMASTER.

DATA : LV_INDEX TYPE I.

CALL METHOD ME->GET_TV_ATTRIBUTES

EXPORTING

P_TV_ID = 'tview_f4'

P_COMPONENT_ID = me->component_id

PO_REQUEST = me->request

IMPORTING

P_VISIBLE_FIRST_INDEX = me->m_visiblefirstrow

P_SELECTED_INDEX = me->m_selectedrowindex.

CASE EVENT.

WHEN 'copy'.

if not me->M_SELECTEDROWINDEX is initial.

LV_INDEX = me->M_SELECTEDROWINDEX.

READ TABLE IT_EMP INTO WA INDEX LV_INDEX.

IF SY-SUBRC EQ 0.

ME->SEL_EMPCODE = WA-EMPCODE.

CONCATENATE '''' WA-EMPNAME '''' INTO ME->SEL_EMPNAME.

ENDIF.

else.

me->m_message = 'Select at least one record'.

me->m_msgtype = 'WARNING'.

endif.

ENDCASE.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method DO_INIT.

SELECT * FROM ZEMPMASTER INTO TABLE IT_EMP.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method DO_REQUEST.

DATA : MY_VIEW TYPE REF TO IF_BSP_PAGE.

MY_VIEW ?= CREATE_VIEW( VIEW_NAME = 'F4Help.htm' ).

dispatch_input( ).

CALL_VIEW( MY_VIEW ).

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

INTERFACE

-


Interface Name :IF_HTMLB_TABLEVIEW_ITERATOR

Interface Description :For Table Looping and Filtering

-


Interface Methods

-


GET_COLUMN_DEFINITIONS Column Definitions Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_COLUMN_DEFINITIONS Changing Type TABLEVIEWCONTROLTAB

P_OVERWRITES Changing Type TABLEVIEWOVERWRITETAB

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.

FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.

<def>-COLUMNNAME = 'EMPCODE'.

<def>-TITLE = 'Employee Code'.

<def>-WIDTH = '40%'.

<def>-SORT = 'X'.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.

<def>-COLUMNNAME = 'EMPNAME'.

<def>-TITLE = 'Employee Name'.

<def>-WIDTH = '60%'.

<def>-SORT = 'X'.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

RENDER_ROW_START New row Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_ROW_INDEX Importing Type I

P_ROW_KEY Importing Type STRING

P_ROW_DATA_REF Importing DATA

P_EDIT_MODE Importing Type XFELD ' '

P_SKIP_ROW Returning Type XFELD

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.

m_row_ref ?= p_row_data_ref.

endmethod.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

RENDER_CELL_START New Column in Row Instance Method PUBLIC

^^^^PARAMETERS

P_TABLEVIEW_ID Importing Type STRING

P_CELL_ID Importing Type STRING

P_CELL_BINDING Importing Type STRING

P_ROW_INDEX Importing Type I

P_ROW_KEY Importing Type STRING

P_COLUMN_INDEX Importing Type I

P_COLUMN_KEY Importing Type STRING

P_ROW_DATA_REF Importing DATA

P_EDIT_MODE Importing Type XFELD

P_REPLACEMENT_BEE Exporting IF_BSP_BEE

P_STYLE Changing Type STRING

P_CLASS Changing Type STRING

P_ISREADONLY Changing Type XFELD

P_ISHIERCELL Changing Type XFELD

EVENTS

-


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

TYPE-GROUPS

-


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

INTERNAL TYPES

-


Former Member
0 Kudos

Hi all...Thank you for taking your time. I hope you guys won't mind guiding me for a while to solve this issue.

My requirement is to use page with flowlogic and Insert data with layout as i explained eariler...another requirement is not to use <b>treeview</b>.... so can someone help me out with this Insert.

Points will be rewareded

Thanks

Former Member
0 Kudos

<b>Here's the requirement, i am posting it one more time...</b>

Its a straignt database insert.....Database table (ZCRMTEST) has 5 fields, but user only has to enter in 1st 3 fields....Product, Release-version and Start date..last two fields go blank

-


heres how layout should look----


<b>Product</b> --> Its the a dropdown..which can be hardcoded eg: value1, value2

<b>Relese-version</b>--> user enters in format: Y-2006.06 but it should go in dbase as: 06/2006

<b>Start date</b>--> user can choose from calender, but it should go in dbase in format: 20030428

<b>Save</b>--> click to enter data in database.

How should i go about Can anyone please help with layout,attribut and code.

Points will be rewarded.

Thanks.

Former Member
0 Kudos

Oops Problem solved...Just went through BSP tutorials and i am now able to this task...anyways thankyou guys for your help.

Answers (2)

Answers (2)

jaideeps
Advisor
Advisor
0 Kudos

hi,

chk out this link

thanks

jaideep

*reward points if useful.

raja_thangamani
Active Contributor
0 Kudos

Look at the below thread..It will solve your issue.

<i>*Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi Raja,

Thanks for your reply...but i doubt using treeview here..there is slight change in the requirement..

Database table (ZCRMTEST) has 5 fields, but user only has to enter in 1st 3 fields....product, release-version and start date..last two are blank

-


heres how layout should look----


<b>Product</b> --> Its the a dropdown..which can be hardcoded eg: value1, value2

<b>Relese-version</b>--> user enters in format: Y-2006.06 but it should go in dbase as: 06/2006

<b>Start date</b>--> user can choose from calender, but it should go in dbase in format: 20030428

finally click <b>Save</b> to enter data in database.

How should i go about Can anyone please help with layout,attribut and code.

<i>Points will be rewarded.

Thanks.</i>