cancel
Showing results for 
Search instead for 
Did you mean: 

Generate TextBox's Dinamically

Former Member
0 Kudos

Hello All, I have a problem and I'd like to ask for your help, what I want to do is to create TextBox's in a dinamically way by analizing a String, this is my use case:

I have a BO, called "Structure", this BO have just 2 elements: Name and Structure, this elements will be filled with something like this:

name.- myStructure1

structure.-   <Version'>

                         </Version>

                         <Key>

                         </Key>

Now, I have another BO with screens and stuff let's call it "Consumer" , what I want to do is, in the QA of the Consumer BO, I want to add a button, that we can call "Retreive Structure", with this, I should open a new window where I can select an instance of the Structure BO, when I select "myStructure1", I want to generate in this case 2 textbox's. one called "Version" and another called "Key".

Then, in this textBox's I can enter information, for example, I want "Version" have a value of 2.

After all, I need to save the modification, but not in the Structure BO, insted of that, "Consumer" will have a element called "structure", where, after I finish my work I should have something like:


Consumer.structure = <Version Value='2'></Version><Key Value = 'Something'></Key>

I really hope you have any Idea about how can I do this. I know I need a way to analize content of Structure.structure in runtime, and also to generate the fields. But I'm not shure about how to do it.

Thanks a lot in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Arnulfo,

you would probably need to use front-end scripting to solve your issue.

In the Studio documentation there is a section "Define Dynamic Behavior of a Field" (path within the documentation is "SAP Solutions OnDemand Studio" -> "User Interface Designer" -> "Modify Your Floorplans" -> "Tasks" -> "Define Dynamic Behaviour of a Field").

It describes how you can implement logic to influence the "Visible" property of a field with a small example. For more complex coding, there is a link within that documentation section that guides you to the syntax of frontend scripts.

Hope this helps.

Best regards,

Kornelia

Former Member
0 Kudos

Hi Kornelia, thanks a lot for your answer, the problem is that I need to create the fields, not to make them visible, and the reason for this is that what I wrote was a short example, in the Structure.structure field I going to store bigger structures, with around 20 o 30 tags, so, I going to need to create that number of fields, and also, this structure will change in each customer, I mean, if I want to sold something to the client C1, I'll probably need fields like Country, State, City, but if I work with the customer C2, I probably need fields like, "Seller", "Sales Order", "Invoice ID", etc.

So, this fields will change radically, and there is a lot of them.

Again, thanks for your help, and I'll really appreciate if you have any idea to solve it considering this.

Best regards.

Former Member
0 Kudos

Hi Arnulfo,

The Structure.structure field is filled with the tags randomly with some code? Or you would know the number of tags for each customer and store it accordingly?

Former Member
0 Kudos

Dude, its little confusing for me.

Can you explain your scenario with multiplicities? and process happening if it is Ok!

Former Member
0 Kudos

Hi Arnulfo,

I got your point - with a big number (of varying) tags, the only feasible way is to create the text boxes dynamically.

But unfortunately the features of the front-end scripting laguage, at least as far as I know, do only allow you to influence the behaviour of an existing field. The only context where something like an "Add()" method is available, is for adding rows to a table/list.

Best regards,

Kornelia

Former Member
0 Kudos

Hi Sathianarayanan.

No, I have no way to know the tags number for each customer, I just store the xml that they provides, and this xml can change when the customer require it.

Former Member
0 Kudos

Hi Kornelia, I think you are right, I couldn't find any way to solve it, I think I'll have to solve it with an external development.

Thanks a lot for your help.

Former Member
0 Kudos

Hi Srivatsava, thanks for your answer, well, I also think it's kind of confusing jeje, and also I think there's no way to solve it, so I'm going to think in another approach and when I solve it I will publish the way I use, it maybe helps someone.

Regards.

Former Member
0 Kudos

Hi Arnulfo,

I saw in 1 of the SAP standard screen Product Model QAF, There they are generating the textbox dynamically.

What I did is, I tried to extend that screen so that it become part of my solution. After that I opened its backend XML file stored in the local disk. There I saw some valuable XML code which has tags as <Matrix layout>. I think if you are able to copy that code into backend xml file of your custom UI, You should be able to achieve it by hit and trial.

I am not sure, it is just an idea, that may help you.