Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

Filling fields from SAP Table work only at some Fields not at all

Hello,

I have a Table with an edit button per table line. With the Button i go to a Page where are all information (TextFields, RadioButtons, Datepicker, Textarea, etc.) from the chosen record. This fields have a Binding and with ajax i make a select in a method in the classbuilder to fill the fields. 


The problem is 5 textFields and a Datepicker are filled with the right Data from Table. The radiobuttons, textareas and other Textfields were not filled.


Do someone know why the half is filled and the other half isn't filled?

Only when i click on a Radiobutton the remaining data appear at once, but then the RadioButton group no longer works.


Thanks & Regards


Michael


Hi Ole Andre,


now it works thank you !


Regards


Michael

Hi Michael


I can recommend this documentation to understand the model consept:


https://template.neptune-software.com/neptune/sdk/explored#doc00163EDC99661ED4B4C34B6CE4E56F06


The basic

Lets say your table that you use is named oTable and the detail page is called oPageDetail. 


  • You bind the Model Source to the internal table for the oTable object 
  • You bind the Model Source to the structure for the oPageDetail object 

Then Neptune will generate two model object, containing the data: modeloTable and modeloPageDetail .


Test in chrome developer console and write this: 


  • modeloTable.oData 
  • modeloPageDetail.oData 


Then you will see your SAP data and fieldnames for the objects.


To navigate to the detail page you only need this code: 


 

// List Get Selected Row and context
var context = oEvent.oSource.getBindingContext();
  
// Update detail page model (JSON parsing to decouple from context)
modeloPageDetail.setData(JSON.parse(JSON.stringify(context.getObject())));
  
// Navigate
oApp.to("oPageDetail");


Working with the models is my recommendation. It's easy to get values from the model and easy to update data. All UI5 objects that use the model and binded properties will be updated when you change the model data.


Regards

Ole Andre


Hi Ole Andre,


stands the "modelyourObject" for a Objectname , which was defined in the objectlist ? And have i to do this code than for all fields?


For example:


// Update detail page model (JSON parsing to decouple from context)

oTextField1.setData(JSON.parse(JSON.stringify(context.getObject())));


Regards


Michael


Hi Michael


How to do this is more or less like we do in ABAP. The table represents an Internal Table. The detail page will have the work area of the Internal Table. When selecting the Table Row you will "read the internal table into the workarea". The javascript helper for it: sapui5->list/table->Get Selected Row Offline


 

// List Get Selected Row and context
var context = oEvent.oSource.getBindingContext();

// Update detail page model (JSON parsing to decouple from context)
modelyourObject.setData(JSON.parse(JSON.stringify(context.getObject())));

// Navigate
oApp.to("yourPage");

 


Then for all objects like radio buttons, checbox etc they expect true/false as the value. The fastest way to achieve that is by using the data element DDBOOL_D. Then Neptune will auto convert from x/space to true/false. If not you need to send true/false as values to those objects.


If you open your developer console in Chrome (F12) you will probably see some javascript errors now when navigating to the detail page.


Regards

Ole Andre 




Login or Signup to post a comment