cancel
Showing results for 
Search instead for 
Did you mean: 

Change Cardinality to enable Input fields mapped to model node

Former Member
0 Kudos

My input fields are disabled in the form. I understand that this is because there are no elements in the node.

I can do a search by passing input parameters and it displays the result and my fields are active.

But when the user opens the form I want it to be enabled so that they create a new entry. From what I read, it appears that I may have to change the cardinality of the node to 1:n.

This is my structure of model node.

ParentNode (0:n)
    ----- TableParameter (0:n)
    ----- Output (0..1)
               ----- TableParameter (0..n)

<b>I can see the property but it does not allow me to change. How do you change the cardinality to 1:n when mapped to model node. Which node should I change.</b>

Is there any other way to initialize to enable input fields, like I can click on Add New record button and it should initialize my fields. This is the code I tried, but it did not work.

	ZTest tableInput = null;
	tableInput = new ZTest();

	Z_Opts_Masterdata_Details_Input input = new Z_Opts_Masterdata_Details_Input();
	wdContext.nodeZ_Opts_Masterdata_Details_Input().bind(input);
	
	input.addDetails(tableInput);
		
	try
	{
		
		wdContext.currentZ_Opts_Masterdata_Details_InputElement().modelObject().execute();	
		wdContext.nodeOpts_Output().invalidate();
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}

Thanks for help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Raghu,

I will admit to not completely understanding all of this stuff.... but, I can say, that have very similar code to yours in one of my apps, but instead of:

input.addDetails(tableInput);

I have:

input.setDetails(tableInput);

Mine works, so perhaps you can try that?

Former Member
0 Kudos

Jennifer,

Thanks for your response. The setDetails has Abstractlist as parameter instead of table object (which is for addDetails). Are you creating AbstractList to use setDetails method.

Thanks

Raghu

Former Member
0 Kudos

Yes, here's exactly what I'm doing, actually.... (and mine's called "Misc" not "Details", obviously

AbstractList rows = new Zcdm_Miscdata.Zcdm_Miscdata_List();

Zcdm_Miscdata miscData = new Zcdm_Miscdata();

rows.add(miscData);

exchangeInput.setMisc(rows);

Former Member
0 Kudos

I tried that..but unfortunatley they screen is still disabled.

AbstractList detailsList = new  ZTest.ZTest_List();
detailsList.add(tableInput);

Z_Opts_Masterdata_Details_Input input = new Z_Opts_Masterdata_Details_Input();
	wdContext.nodeZ_Opts_Masterdata_Details_Input().bind(input);
	
	input.setDetails(tableInput);
		
	try
	{
		
		wdContext.currentZ_Opts_Masterdata_Details_InputElement().modelObject().execute();	
		wdContext.nodeOpts_Output().invalidate();
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}

Do you execute a commit or anything after modelObject.execute() ?

Former Member
0 Kudos

Ok, so I'm assuming that "TableParameter" in this is Details, right?

ParentNode (0:n)
    ----- TableParameter (0:n)
    ----- Output (0..1)
               ----- TableParameter (0..n)

Do you have your input fields bound to the TableParameter directly off the parent node, or the one under the Output?

In my first example, my input fields were bound to the one off of the parent node, but in other part of my code I have Input Fields bound to the ones in the Output node (so confusing, I know!) But they were always disabled for me until I did the following:

Zcdm_Transformerdata newTransOutData = new Zcdm_Transformerdata();
IPrivateMainView.INew_XfmrOutElement outElmt = wdContext.createNew_XfmrOutElement(newTransOutData);
wdContext.nodeNew_XfmrOut().addElement(outElmt);

Former Member
0 Kudos

Jennifer,

You hit it on the nail, what I am trying to do. Yes TableParameter is the details. The one under the Parent node is input and one under the Output is the output (obviously).

I am mapping my input fields to Output table not the input. I had noticed that when I accidentally mapped to Input table under parent node, my fields were active.

It is confusing. When would you map to input table parameter and when would you do to output parameter. I thought you have to do to output table when you are getting data from BAPI.

It appears the sample you gave where you mapped to output table, you were creating new Output element with new table as parameter. How is this mapped to the output table that was originally mapped to input fields. What is the purpose of creating it?

Did you have to do anything like execute() to take effect. I really appreciate your responses. I am new to this. I understand what is happening, but seems little confusing.

Former Member
0 Kudos

Well, typically when I need the user to enter data on the screen I bind my Input Fields to the the node under the Input node - because I want to send the data back to the function module in SAP when the model gets executed.

When I want to display data that was returned from the RFC, I'm not usually using InputFields, but I have a Table UI element where all the elements in the table are TextViews - the user isn't going to edit it at all, I just want to display data to them.

The reason I had to bind an Input Field to the node under the Output node was when I had a table UI element where I wanted the user to be able to enter in a serial number in the first column, hit a button and the rest of the row of that table was populated with all the data about that particular transformer. My table had to be bound to the output node in order to display all the information that was returned, but my first column was an Input Field instead of a Text View. Before I executed, I had to take the value that the user entered in the Serial Number field and copy it from the Output node into the Input node so that it got sent to the function module.

... I'm afraid I'm making this more confusing instead of more simple! The point is, the node directly off the input is for sending data TO your function module and the node off the output is for data come back FROM the function module.

So, in my sample, yes I created a new element (for the node under my Output node), with a new (therefore blank) table as a parameter. The output nodes basically start off with no elements in them - and because there's no elements in them, that's why your fields are disabled - your fields need to have an element that actually exists in order to store the data that the user enters. When I added that blank element to my node, my field became active because there was an empty element that I could store my data in now.

I did not have to do an execute in order for it to take effect.

Former Member
0 Kudos

Thanks Jennifer that helps. I will try what you suggested to create a blank element under node.

Also, it looks like I can map input fields to input table as I want user to enter data and send it to BAPI.

I will try both to see how it works.

Raghu

Former Member
0 Kudos

Hi Raghu,

It is not allowing you to change the cardinality from view as this node is binded to controller so try changing the cardinality from controller of the input node to 1:n and then you will see your InputFields enable on the screen.

Once the cardinality is changed in controller, it will automatically be reflected in the view too that has its mapping.

Regards,

Murtuza

Former Member
0 Kudos

Murtuza,

I went to controller, I was able to change selection, but it still does not allow me to change the cardinality.

What is the significance of the Selection in controller property

Thanks

Former Member
0 Kudos

Hi Raghu,

The selection property indicates the numbers of selections that you can make from your node elements at runtime.

If its not allowing you to change the cardinality in controller too then try to instantiate an object of input node in the wdDoInit() of component controller.

Regards,

Murtuza

Answers (1)

Answers (1)

Former Member
0 Kudos

Just to close the thread, it finally works based on Jennifers suggestion to add a new blank element to outuput node.

Thanks to Jennifer and Murtuza for their valuable input.

FYI for others who may be facing the same issue.

These are the steps I took .

1. Created a new element (blank output) element for parent node.

2. Then added the element for output node

Parent Node
 ---- Output Node
        ---- Table 

I needed to create new blank element under table so it displays enabled fields.

IPrivateEmpMasterDataEntryView.IZ_Emp_Masterdata_Details_InputElement eleModel = wdContext.createZ_Emp_Masterdata_Details_InputElement(new Z_Emp_Masterdata_Details_Input());
wdContext.nodeZ_Emp_Masterdata_Details_Input().addElement(eleModel);
IPrivateEmpMasterDataEntryView.IEmp_OutputElement eleOutput = wdContext.createEmp_OutputElement(new Z_Emp_Masterdata_Details_Output());
wdContext.nodeEmp_Output().addElement(eleOutput);

ZTest tableInput = null;
tableInput = new ZTest();
	
IPrivateEmpMasterDataEntryView.IDetails_OutElement outElement = wdContext.createDetails_OutElement(tableInput);
wdContext.nodeDetails_Out().addElement(outElement);