Overview 
If the user calls up a dialogue for changing data from a table and returns to the table display after the change, his changes should be immediately visible in the table display. An additional detail display for the active table row should also show the new values. Both can be realised with the S10 Framework without much effort.


Example
We start in a list with offers, where the details of an offer are shown (click on the table row):



The user presses the "Change" button and gets to a dialogue screen for changing the offer. There we add a new item (material TG12), select "complete delivery" and set "Sales call" as the order reason:



We save our changes and go back to the list. All changes are now visible there:



Implementation

In order for the changes to be visible in the table row itself, it is sufficient to set the new values in the row object at ABAP level. The transport into the display is then done automatically by the S10 framework.
It is usually easiest to read the new values directly from the database. After all, the user can cancel the dialogue after entering new values instead of saving them, and in this case the values entered but not saved should not be transferred to the list.
In the example above, the table consists of objects of the class "offerinfo", which contains the information about the offer needed in the table display, i.e. offer number, date, validity, net value, currency, status and customer reference. The class "offerinfo" does not contain the other information displayed in the detail area, especially not the offer items. These are only read after clicking on a line in a separate object of the class "offerdetails" and displayed in the expanded area.

A total of three different classes are involved here:

Class "offerinfo"
It contains only the information about the offer displayed in the table. The database then only has to evaluate a few columns of the table VBAK for reading in, so that even very many offers can be read in quickly.

Class "offerdetails"
All information needed for the detailed display. It also contains a table of the positions of the respective offer (database table VBAP). Access to it is made for a single offer at a time.

Class "offer
The comprehensive dialogue object to which the HTML pages with the table display are assigned. Here the table "taboffers" is created, whose lines are "offerinfo" objects, as well as a single object "myofferdetails" of the class "offerdetails".

It is also possibIe to work with only a single class, but this reduces performance and makes the coding more confusing. It is recommended to work from the beginning with two classes analogous to "offerinfo" and "offer" for table-like displays, and with a separate detail class "offerdetails" when implementing a detail view (expanding rows). Now let's implement the update of the displayed table row as well as the expanded detail area. We first get the current "offerinfo" object in the "onchange" method. The number of the row that the user has selected is provided by the S10 framework in the context object s10contextinfo():

   data:
      
rownumber type i.

    
rownumber s10contextinfo( )->rownumber.

current offerinfo object
    
datamyofferinfo type ref to offerinfo.
    
read table taboffers index rownumber into myofferinfo.

This works if the button pressed is either in the table row itself or in the expanded detail area. From "offerinfo" we transfer the offer number into the manager object "offer" and call up the change dialogue.

After the change dialog, we read the current data from the database into the "offerinfo" object again:


    myoffer->vbeln = myofferinfo->vbeln.
    myoffer->read(  ).


    myoffer
->s10dialog'change' ).


read updated values into current offer object
    
myofferinfo->read( ).

This means that the changed values appear in the table display after returning from the "change" dialogue.

In the expanded detail area, however, the old values are still displayed. To make the new values appear here as well, we have to do something more:

In the class "offerinfo" we include an attribute with the predefined name "s10detailview":

     data:
      s10detailview     
type string.

This attribute is added to the display table in HTML as a hidden column:

<input type="hidden" class="inputcell" name="s10detailview" />

By setting the value "X" in "s10detailview" in the called method, the S10 Framework transfers the new values to the expanded detail area. In the ABAP method we need the following steps:

(1) Read in the changed detail data of the quotation.

(2) Set an indicator "s10detailview" in the table to 'X'. In the example, the details of the offer are contained in class "offerdetails", which also contains all offer items as a table. The corresponding object is "myorderdetails".

We therefore add the following coding:

*  (1) read offer details
    
myofferdetails->vbeln =  myofferinfo->vbeln.
    
myofferdetails->read( ).


(2) indicate: table detail area needs an update
    
myofferinfo->s10detailview 'X'.

 In step (2), note that the indicator is in "myofferinfo" (table object, not detail object).

Here now is the entire method, whereby for the sake of completeness the SAP-side blocking of the offer is also implemented:

method.
    data:
     rownumber type i.
     rownumber = s10contextinfo( )->rownumber.

* offerinfo object (table object)
    data: myofferinfo type ref to offerinfo.
    read table taboffers index rownumber into myofferinfo.

* enqueue offer
    call function 'ENQUEUE_EVVBAKE'
      exporting
        vbeln  = myofferinfo->vbeln
      exceptions
        others = 1.

* offer currently in work? then error message
    if sy-subrc > 0.
      data: msgline type string.

      call function 'MESSAGE_TEXT_BUILD'
        exporting
          msgid               = sy-msgid
          msgnr               = sy-msgno
          msgv1               = sy-msgv1
          msgv2               = sy-msgv2
          msgv3               = sy-msgv2
          msgv4               = sy-msgv2
        importing
          message_text_output = msgline.

      s10errormessage( msgline ).
    endif.


* after enqueue, read the offer from the database
    myoffer->vbeln = myofferinfo->vbeln.
    myoffer->read(  ).

* start the "change" dialog
    myoffer->s10dialog( 'change' ).

* dequeue offer after the change dialog
    call function 'DEQUEUE_EVVBAKE'
      exporting
        vbeln = myoffer->vbeln.


* read updated values into current offerinfo object
    myofferinfo->read( ).

* read offer details
    myofferdetails->vbeln = myofferinfo->vbeln.
    myofferdetails->read(  ).

* indicate: table detail area needs an update
    myofferinfo->s10detailview = 'X'.
 
  endmethod.  

 

Components: S10 Framework