cancel
Showing results for 
Search instead for 
Did you mean: 

How to use getEquipmentStatusCondition() ?

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

I would like to use the function getEquipmentStatusCondition to filter mly equipment list.

But, during the process an exception is launch. After debug, i've seen it is at this point (in the UIHelperImpl.java):


if (parent == null) {
---> size = ((BOManager) manager).size(rowdesc, condition);
} else {
      size = ((BOManager) manager).size((RowBO) parent, rowdesc, condition);
}

Here is my implementation :


Condition condition = null;
com.sap.mbs.tools.list.ListHeader equipmentListHeader = com.sap.mbs.tools.list.ListParser
					   .getHeader(MAMViewListControllerInterface.TECHOBJ_EQUIP_HEADER_LIST_ATH);
		
Mam031QueryBuilder queryBuilder = (Mam031QueryBuilder) naming.lookup(Mam031QueryBuilder.class.getName());

condition = queryBuilder.getEquipmentStatusCondition("STATUS", RelationalOperatorType.SQL_LIKE, "AREC");  
		
setListAttributes(context, equipmentListHeader, condition, null, null, null, "onNavigate");

Could you explain me what's appening ?

Kind Regards

Joseph,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

getEquipmentStatusCondition gives you a condition on 031Item130 node and you try to execute this upon the 031ItemTOP node.

You should use getEquipmentSimpleCondition to make a condition on the top node. If you want to select the TOP node from its child, you have to build a condition on the child and another condition liking that child to the top node. Refer to MI doc at this point for more complete example.

Thank you,

Julien.

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

Thanks for your answer.

I would like to know which document explain what you said. bBcause in the document that I have (I mean : Enhancelebt Guide Frond-end and User Interface), I don't see any information about TOP node or something like that.

Regards,

Former Member
0 Kudos

Hello,

I am talking about general MI document and also the MI SDK (MDK) that have information on how to create queries.

I don't have the links but I guess you can find it in SMP or next to the software you already have.

Thank you,

Julien.

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

I get the documentation about the query, but I don't get the TOP node machanisme with the getEquipmentStatusCondition function.

Thank you

Joseph

Former Member
0 Kudos

Hello,

Each SyncBO is composed of nodes: header and child. The node are assembled using foreign key relations.

The header node is called the TOP node and the child node are usually referred as 010, 020, etc. Each node is a table on the device and they have foreign relations to their TOP node.

If you create a query on one of the child node and expect the query to return the TOP node, then it won't work. If you query the TOP node, then you will have a result. When you want the result of a query to be the TOP node but you want to query the child node (your case), you have to follow the relationship child to TOP using the parent key.

I hope I am clear this time!

Thank you,

Julien.

Former Member
0 Kudos

note: getEquipmentStatusCondition is not part of the MI API.

rather it is a MAM specific implementation.

since Item130 (Status) is the child item of SyncBo Mam031, this method

will return a condition for querying Item130 and not the top or header rows.

if you want to query the header, try using getEquipmentSimpleCondition.

regards

jo

Joseph_BERTHE
Active Contributor
0 Kudos

Hello Julien,

So you were clear I'm working on it.

I keep you informed, with the answer if I find it

Thanks you

Joseph_BERTHE
Active Contributor
0 Kudos

Julien,

Even after searching information thanks to your help, I really don't know how to reach my goal :(.

I get that I have to create two queries. That somehow I have to combine those queries in one to get the TOP node result. But How ???

I lost my mind in it !!

Thank you

Joseph

Former Member
0 Kudos

Hello,

If I remember correctly there is no such things as join query in MI 7.0 and older. You have to query for all the Status items, then get the parent key for each and query the Equipment TOP for that key to get the equipment itself.

You are better constructing a query with all unique parent key with a OR between them then querying them each after the other.

Thank you,

Julien.

Joseph_BERTHE
Active Contributor
0 Kudos

Hello Julien,

I have solved my problem not using queries. The following snippet code show my solution :


ListHeader equipmentListHeader = com.sap.mbs.tools.list.ListParser.getHeader(MAMViewListControllerInterface.TECHOBJ_EQUIP_HEADER_LIST_ATH);

BOList mam031List = mam031Manager.getMam031s();
BOList myOutputList = (BOList) naming.create(BOList.class.getName());
Mam031Impl myEquipment = null;
Mam031Item130Impl equipmentSatus = null;

for (int i = 0; i < mam031List.size(); i++) {
	myEquipment = (Mam031Impl) mam031List.get(i);
	BOList mam031Item130List = Mam031Manager.getMam031Item130s(myEquipment);

	if (mam031Item130List.size() != 0) {
		for (int idx = 0; idx < mam031Item130List.size(); idx++) {
			equipmentSatus = (Mam031Item130Impl) mam031Item130List.get(idx);
			if (equipmentSatus.getInact().equals("") && equipmentSatus.getStatus().equalsIgnoreCase("E0008")) {
				myOutputList.add(myEquipment);
			}
		}
	}
}


setListAttributes(context, equipmentListHeader, myOutputList, null, null, "onNavigate");

If you have any suggestion feel free.

I give you points anyway

Kind regards

Joseph

Answers (1)

Answers (1)

former_member304703
Contributor
0 Kudos

Hi Berthe,

Classes in cam.sap.mbs.mam.bo.query (where all XXXConditions are residing) are internal MAM classes. There is no generic documentation on them except java docs generated in MAM.

They are created by MAM developers for specific MAM processes, naming conventions are as judged by a developer.

So every time you use it you should look in the code or java doc what is one or the other condition is meant for.

If it does not match your spec you can either extend MAM condition classes and add you condition builders or use generic methods from AbstractQueryBuilder (which are used in condition classes as well).

Regards,

Larissa Limarova