cancel
Showing results for 
Search instead for 
Did you mean: 

BSP lost data in the events

clayton_barbosa
Participant
0 Kudos
94

Hi

I have 1 internal table on the page of the bsp, and a pushbotton (GeraProj) to execute a code with some commands.

The internal table is filled with a select on the OnCreat and it is shown allowing to change some cells of the grid.

But now the problem was that the user needs to click on the pushbotton (GeraProj) to execute the command by the 'OnInputProcessing' event, the internal table is empty. All the data that he changed is lost.

Can someone suggest me how to trigger the events to avoid this problem?

OnCreate:
SELECT * FROM ZPST00001_PERTMP

THE SCREEN:

clayton_barbosa_0-1742570305932.png

 


INTO TABLE gt_zpst00001_pertmp
WHERE project_definition = gs_tmp-project_definition
AND uname = gs_tmp-uname.

OnInputProcessing:
...
CASE event_id.
WHEN 'proj'.
gv_perproj = perproj.
SELECT SINGLE * FROM TCJ41 TO @DATA(LS_TCJ41)
WHERE PROFIDPROJ = @GV_perproj.
IF sy-subrc = 0.
MOVE-MATCHING LS_TCJ41 TO gs_zpst00001_proj.
gs_zpst00001_proj-zpspid = project.
gs_zpst00001_proj-pspid = project.
gs_zpst00001_proj-profl = gv_perproj.
gs_zpst00001_proj-pwhie = ls_tcj41-waers.
....

Attribute:
gt_zpst00001_pertmp TYPE ZPSTT00001_PERTMP

Layout:
<input type="submit" value="GeraProj" name="oninputprocessing(proj)"
style="border: 1px solid #000000; width:150px; height:30px; font-size:15px;"
onclick="Save();"/>
.....
<%
data : ref iterator type for ZCL_ITERATOR_PST.
create iterator object.
%>
<htmlb:gridLayout columnSize = "10"
rowSize = "2"
cellSpacing = "5"
width = "70%"
style = "TRANSPARENT" />
<%-- <htmlb:document disableBackspaceNavigation = "TRUE" />--%>
<htmlb:tableView id = "tv1"
visibleRowCount = "10"
selectionMode = "MULTILINEEDIT"
allRowsEditable = "true"
design = "ALTERNATING"
onRowSelection = "MyEventRowSelection"
table = "<%=gt_zpst00001_pertmp%>"
width = "100%"
iterator = "<%=iterator%>"
onHeaderClick = "onHeaderClick" />

</htmlb:form>

View Entire Topic
clayton_barbosa
Participant
0 Kudos

Hi! I solved the problem.

Creating a Subclass of CL_HTMLB_TEXTVIEW
Since CL_HTMLB_TEXTVIEW is an SAP class, you cannot create a new one with the same name.
What you can do is create a subclass to extend functionality.

DATA: lo_textview TYPE REF TO zcl_htmlb_textview,
lt_formfields TYPE tihttpnvp.

Steps
Create the ZCL_HTMLB_TEXTVIEW class inheriting from CL_HTMLB_TEXTVIEW.
Add custom methods if necessary.
Use FACTORY to instantiate TEXTVIEW.

Example: Creating ZCL_HTMLB_TEXTVIEW

CLASS zcl_htmlb_textview DEFINITION INHERITING FROM cl_htmlb_textview.
PUBLIC SECTION.
METHODS get_formfields RETURNING VALUE(rt_fields) TYPE tihttpnvp.
ENDCLASS.

CLASS zcl_htmlb_textview IMPLEMENTATION.

METHOD get_formfields.
rt_fields = me->mc_formfields. " Permite acessar os campos do formulário
ENDMETHOD.

ENDCLASS.

Now ZCL_HTMLB TEXTVIEW can be used to access MC_FORMFIELDS and customize TEXTVIEW.

In the CLASS ZCL_ITERATOR_PST

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
DATA: lo_textview TYPE REF TO zcl_htmlb_textview2,
lt_formfields TYPE tihttpnvp.

CASE p_column_key.
WHEN 'XXXXX'.
" Criar objeto do TextView customizado
CREATE OBJECT lo_textview.
" Obter campos do formulário
lt_formfields = lo_textview->get_formfields( ).
READ TABLE lt_formfields INTO DATA(ls_formfields)
WITH KEY name = p_cell_id.