cancel
Showing results for 
Search instead for 
Did you mean: 

Data definition in BSP application

Former Member
0 Kudos

Hi,

Let me brief out the requirement.I am developing an form for data entry with complex condition and logic.

Each row has one checkbox and four inputfield, for e.g.

<htmlb:checkbox id = "RSM_CB_RPS_A2C_AF"

onClick = "HandleRPSA2C_AF"

text = "N/A" />

<htmlb:inputField id = "RSM_RPS_A2C_AF"

type = "STRING"

value = "0"

width = "50"

disabled = "<%= RSM_RPS_A2C_DIS_AF %>"

required = "false" />

When i click the Checkbox the four input fields should be disabled and vice versa.so i handled the disabled attribute of the inputfield in OnInputProcessing Event Handler.

IF RSM_CB_RPS_A2C_AF->checked = 'X'.

RSM_RPS_A2C_DIS_AF = 'TRUE'.

RSM_RPS_A2C_DIS_AL = 'TRUE'.

RSM_RPS_DD_A2C_DIS_AF = 'TRUE'.

RSM_RPS_DD_A2C_DIS_AL = 'TRUE'.

ELSE.

RSM_RPS_A2C_DIS_AF = 'FALSE'.

RSM_RPS_A2C_DIS_AL = 'FALSE'.

RSM_RPS_DD_A2C_DIS_AF = 'FALSE'.

RSM_RPS_DD_A2C_DIS_AL = 'FALSE'.

ENDIF.

The parameters RSM_RPS_A2C_DIS_AF, RSM_RPS_A2C_DIS_AL, RSM_RPS_DD_A2C_DIS_AF, RSM_RPS_DD_A2C_DIS_AL are defined as Page attributes.

I have more than 200 input fields in my form. so i need to define 200 Page attribute for just handling disabled functionality which will be impossible to maintain.

If i define it as

DATA : RSM_RPS_A2C_DIS_AF TYPE STRING,

RSM_RPS_A2C_DIS_AL TYPE STRING,

RSM_RPS_DD_A2C_DIS_AF TYPE STRING,

RSM_RPS_DD_A2C_DIS_AL TYPE STRING.

in OnCreate i am not able to access it in Layout TAB.

Is there any way to handle this functionality with MVC or something else?

Is there something like Main Program in Function modules, where we can define the global definitions?

Thank you

arun

Accepted Solutions (0)

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If I were you, I would structure this as MVC. I would then create an internal table in my model class with one row for each row on your output (one field for checkbox and two for each input field - one to bind to disabled and one to bind to the value).

I would then setup model binding for the checkbox checked value, and the inputfield value and disabled values.

Now in your event handler your processing you disabled logic within an internal table loop. If you wanted to get really fancy you could even dynamically generate your checkboxes and inputfields in your view off of the entries in you Model's internal table. This would simplify you View's coding as well.

If you want a weblog that describes binding to cells in an internal table and dynamically generate view elements from them, have a look at the following:

/people/thomas.jung3/blog/2004/09/24/important-lessons-involving-bsp-model-view-binding-and-a-frozen-burrito

Former Member
0 Kudos

Hi,

Is that possible to Include seperate programs or page fragments in Event handler. My OninputProcessing Event Handler is really long and hard to maintain.

Is that possible to include it as seperate files into Event handler like <%@ Include file="frag1.htm" %> in Layout tab?

Thank you

arun

Former Member
0 Kudos

Hi Arun,

Two checks:

a) Check whether all the processing that you are doing in OnInputProcessing , should be done at <b>serverside</b> ? You can put screen validations at <b>Client side</b>, using <b>OnClientClick</b>. You can write javascript for this and maintain multiple functions, thereby modularizing your code(and easy too look at). It also would save precious <b>server-trip time</b>.

b) If page has complex layout, I am afraid, all your event handlers will be crazy long. I am not aware of any modularisation as you mention in OnInputProcessing, but what you can do is, write <b>Function Modules</b> and do the processing there.

Regards,

Subramanian V.

athavanraja
Active Contributor
0 Kudos

For your data declaration and for forms you can have a include program in your eventhandler.

For layouts you can create a page fragment and include in your layout.

Regards

Raja

Former Member
0 Kudos

MVC works kind of like that with all the variables but you still have to define them in your Page Attributes of your view.

Any chance of a redesign and making your form like a wizard where fill in a few then click next type of thing?

athavanraja
Active Contributor
0 Kudos

Alternatively you could define a structure containing all your required field in type definition and refer it in page attributes.

Then within your layout you can use those fields in the structure. (structure-field)

Regards

Raja

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Model variables don't really have to defined in your Page Attributes. You can always pass the entire model class as a page attribute. From the controller side it looks something like the following:


  data: model2 type ref to zcl_bsp_m_input_help.
  data: view type ref to if_bsp_page.
****Get a pointer to the Model Object.
  model2 ?= get_model( 'MU' ).
****Call our View
  view = create_view( view_name = 'InputHelp.bsp' ).
  view->set_attribute( name = 'model'      value = model2 ).
  call_view( view ).