cancel
Showing results for 
Search instead for 
Did you mean: 

a question on table update

Former Member
0 Kudos

hi guys,

i'm using controller+view to create BSP application. after read some article here fail to the solution on how to update record to SAP.

attach controller & view source code for reference. please kindly provide idea/solution. thanks.

controller

-


method DO_REQUEST.

*CALL METHOD SUPER->DO_REQUEST

  • .

DATA: result_view TYPE REF TO if_bsp_page.

select * from zpoinfo into table po_items.

dispatch_input( ).

result_view = create_view( view_name = 'poinfo.htm' ).

if po_items[] is not initial.

result_view->set_attribute(

name = 'po_items'

value = me->po_items ).

endif.

call_view( result_view ).

endmethod.

method DO_HANDLE_DATA.

data wa type IHTTPNVP.

data po type ZPOINFO-PONUMBER.

data po_items type table of ZPOINFO.

data w_mandt type sy-mandt.

data updtab type standard table of zpoinfo.

read table form_fields into wa with key name = 'ponumber'.

po = wa-value.

if not po is initial.

select single mandt into w_mandt from zpoinfo

where ponumber = po.

if sy-subrc EQ 0.

select * from zpoinfo

into table po_items

where ponumber = po.

endif.

else.

select * from zpoinfo

into table po_items.

endif.

if sy-subrc = 0.

me->po_items = po_items.

endif.

endmethod.

view

-


<htmlb:tableView id = "result"

design = "ALTERNATING"

headerText = "Header Text"

filter = "SERVER"

sort = "SERVER"

onNavigate = "onMyNavigate"

selectionMode = "lineedit"

emptyTableText = "No records found!"

onRowSelection = "onMyRowSelection"

allRowsEditable = "TRUE"

table = "<%= PO_ITEMS %>"

visibleRowCount = "10" >

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName = "PONUMBER"

width = "70"

horizontalAlignment = "left"

title = "PO"

sort = "TRUE"

wrapping = "TRUE" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "POITEM"

width = "40"

horizontalAlignment = "left"

title = "Item"

wrapping = "TRUE" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "MATERIAL"

width = "80"

horizontalAlignment = "left"

title = "Material"

wrapping = "TRUE"

edit = "TRUE" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "POITEMQTY"

width = "70"

horizontalAlignment = "right"

title = "Order Qty"

wrapping = "TRUE"

edit = "TRUE" >

</htmlb:tableViewColumn>

</htmlb:tableViewColumns>

</htmlb:tableView>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

maybe you should give some more details on the problems you are facing.

If I haven't overlooked something you have no UPDATE or INSERT statements in your code (or a call to a FM or method to update data).

So I suggest reading all the excellent BSP weblogs here on SDN.

You would need to react on the event the user triggered and pass the data to the database (e.g. via UPDATE statement).

As a tip: try to go with MVC design from the beginning. You will have to create a model class holding your data and managing the business functions.

Hope this helps.

Regards,

Alex