|
Overview
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(): ABAP
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: ABAP
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: ABAP
This attribute is added to the display table in HTML as a hidden column: HTML
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:
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: ABAP
|
|
Components: S10 Framework |