Monday 25 July 2016

UI5 SplitApp Container

Excellent jsbin here that explains how to have multiple views in a splitapp... 

http://jsbin.com/aku_switch_views/1/edit?html,output

The bit I'd been missing for a day or two was:

app.toDetail which includes the natty UI5 swishy animation for no extra development effort from myself! :D

Whilst we're here, we should probably shout out jsbin for their excellent crowd-sourced examples library, which also include an online editor (like the w3schools example). Super tool!

Monday 11 July 2016

Test data table randomiser

Okay, so I need to populate some interesting test data in a Z-table I'm supposed to be reading. I could be really boring and set up a bunch of sequential data, which all drops out of the table in a boring organised way. This is right out, it'll just look really contrived.

I could set up a number of itabs, each with lists of possible data, then randomly attack each of them, getting me an interesting set of data. I've done this in the past, and it looked fine, just took a while.

I could just populate the table whilly-nilly. This works fine, again, takes a while, and doesn't get the computer to do the work...

The method I've just employed, I'm happy with; populate a small table, whilly-nilly, then randomly attack that table to make the data you send to the database. This has the required combination of randomness, interestingness, and capacity to create lots of data all at the once. (I'm only doing 20 here, but could just as easily be 200!).

define getRand .


  CALL FUNCTION 'QF05_RANDOM_INTEGER'
  EXPORTING
    RAN_INT_MAX         5
    RAN_INT_MIN         1
  IMPORTING
    RAN_INT             l_rndInt.

READ TABLE t_zpd_rh2 INDEX l_rndINt into &1.

end-OF-DEFINITION.


REPORT ZPD_POP_RH2.

"Dataset to randomise out of...

datat_ZPD_RH2 type TABLE OF ZPD_RH2.


datal_ZPD_RH2 type ZPD_RH2,
      l_ZPD_RH2_feeder type ZPD_RH2,
      l_rndInt type QF00-RAN_INT.

*(operation/workcentre/plant/description)
l_zpd_rh2-property 1.
l_zpd_rh2-work_centre 'WC1'.
l_zpd_rh2-plant '1000'.
l_zpd_rh2-description 'Replace boiler'.
append l_zpd_rh2 to t_zpd_rh2.

l_zpd_rh2-property 2.
l_zpd_rh2-work_centre 'WC2'.
l_zpd_rh2-plant '2000'.
l_zpd_rh2-description 'Renovate Bathroom'.
append l_zpd_rh2 to t_zpd_rh2.

l_zpd_rh2-property 3.
l_zpd_rh2-work_centre 'WC3'.
l_zpd_rh2-plant '3000'.
l_zpd_rh2-description 'Replace kitchen sink'.
append l_zpd_rh2 to t_zpd_rh2.

l_zpd_rh2-property 4.
l_zpd_rh2-work_centre 'WC4'.
l_zpd_rh2-plant '4000'.
l_zpd_rh2-description 'Fix leaky tap'.
append l_zpd_rh2 to t_zpd_rh2.

l_zpd_rh2-property 5.
l_zpd_rh2-work_centre 'WC5'.
l_zpd_rh2-plant '5000'.
l_zpd_rh2-description 'Diagnose bad smell'.
append l_zpd_rh2 to t_zpd_rh2.

datal_operation type int4.


do 20 times.
  clear l_zpd_rh2.

  l_operation l_operation + 1.
  l_zpd_rh2-operation l_operation.

  getRand l_ZPD_RH2_feeder.
  l_zpd_rh2-work_centre l_ZPD_RH2_feeder-work_centre.

  getRand l_ZPD_RH2_feeder.
  l_zpd_rh2-plant l_ZPD_RH2_feeder-plant.

  getRand l_ZPD_RH2_feeder.
  l_zpd_rh2-description l_ZPD_RH2_feeder-description.

  getRand l_ZPD_RH2_feeder.
  l_zpd_rh2-property l_ZPD_RH2_feeder-property.


  append l_zpd_rh2 to t_zpd_rh2.

enddo.

MODIFY zpd_rh2 from TABLE t_zpd_rh2.

commit work and wait.