cancel
Showing results for 
Search instead for 
Did you mean: 

Customize Inventory List in xMAM

chintan_virani
Active Contributor
0 Kudos

Hi,

I am working on customising the Inventory Management Screen in xMAM (version 3.0 SR4 PL0) where I am facing some issues.

The standard Inventory Screen has following fields: Material, Equipment, Serial No, Stge Loc, Qty and Unit as shown [here|http://img512.imageshack.us/my.php?image=capture0103pu5.png]

When I click on the material field information regarding that material pulls up.

We have done the Customer Enhancement (BADI changes) by referring to the xMAM Enhancement guide so the Manuf Part Number gets displayed as shown [here|http://img512.imageshack.us/my.php?image=capture0102no6.png].

This means the complete data is in Inventory SyncBO (Mam070) and Manuf Part NUmber is Mam070Item010.

Now my requirement is to have this field in first Main Inventory List so that users can see first hand and give them alternative so that can search by Manuf part Number as well.

So is it possible to have an Inventory list which displays data from Mam070 and Mam070Item010 at the same time?

Any suggesstions / help will be appreciated.

Chintan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chintan,

there is not a problem to do so. All you need to do is to create the custom controller and View. In the Controller grab MAM70 and MAM70Item010 and in the custom view display that information as well. Be aware that in that case the create of the view takes a little longer, cause you loop over two tables. But yes - no issue with that.

Hope this helps.

Regards,

Oliver

chintan_virani
Active Contributor
0 Kudos

Hey Oliver,

I knew you would respond :-). The solution you have mentioned is vaguely mentioned in pg 22 of [this enhancement guide|https://websmp201.sap-ag.de/~sapdownload/011000358700006470052006E/xMAM_30_EHG_Use_Cases.pdf] as well but I am not able to get it completely. Here is what I have done:-

1) Make changes in ZListdef.xml for new InventoryList and added a column for Manuf Part Num field.

2) Created a view controller ZInventoryList and new BO Class ZInventoryBO as mentioned in guide.

But could you help me like what should be code in the Controller. You say grab Mam070 and Item010 but question is how?

Chintan

chintan_virani
Active Contributor
0 Kudos

Oliver,

Also just one more thing I wanted to make clear is that all the List fields come from TOP when GETLIST is executed and the Customer Enhancement is picked up/shown on next screen when GETDETAIL si fired.

So is it really possible for us to create a single list with values (say Material no) from GETLIST and (Manuf Numer) GETDETAILS. ?

Chintan

Former Member
0 Kudos

Hi,

this I have to play through in detail - to be honest. But in general your solution is correct.

Yes, GETLIST and GETDETAIL are completely on the backend. So these are independend from the client - and on the client you only have the results from a GETDETAIL run. It is strange anyway, that the GETLIST returns so many values - cause for the design of MI it is completely unnecessary. The key of the item would be absolutely enough, cause this is the input paramerter - usually - for the GETDETAIL. So do not worry that the backend delivers a part of the result in the GETLIST handler.

On the client I will read the enhancement guide and check if I can see where you struggle with.

Regard,s

Oliver

chintan_virani
Active Contributor
0 Kudos

Oliver,

Thanks for your help. This is what I have written in controller and I am able to get the MAM070 header list.


	public Forward onLoad(Forwards forwards)
	{
		System.out.println(">>>>>>>> onLoad called <<<<<<<<<<<<<<<");
		InventoryCustomController custom = getInventoryCustomController();
		
		try
		{
			Mam070Manager manager = (Mam070Manager) naming.lookup(Mam070Manager.class.getName());
			BOList temp = manager.getMam070s();
			Mam070 inv = null;
			if (temp != null)
			{
				for (int i = 0; i < temp.size(); i++)
				{
					inv = (Mam070) temp.get(i);
					String strInvKey = inv.getKey();
					System.out.println("Material is "+inv.getMaterial());
				}
			}

			
		}
		catch (BOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

But the problem is when I write a similar code for Mam070Item010 it fails. So any idea on how to call it...?

There seems to be no realtion between Mam070 and Mam070Item010.

Chintan

Former Member
0 Kudos

Hi,

well, that confuses me .... usually it is straight forward from there if you have this approach:

First your code:


...........
try
		{
			Mam070Manager manager = (Mam070Manager) naming.lookup(Mam070Manager.class.getName());
			BOList temp = manager.getMam070s();
			Mam070 inv = null;
			if (temp != null)
			{
				for (int i = 0; i < temp.size(); i++)
				{
					inv = (Mam070) temp.get(i);

Ok, here you have the MAM070 Top item. This we need to get the item structure - so now you can get its childs:


   BOList mam070Item010s = manager.getMam070Item010s(inv); 
   for (int j=0;j<mam070Item010s.size();j++) {
        Mam070Item010 mam070ITem010 = (Mam070Item010) mam070Item010s.elementAt(j);
}

And so you have the items of MAM070. Well, would confuse me a little if that is not working.....

The rest of your code is still the same




					String strInvKey = inv.getKey();
					System.out.println("Material is "+inv.getMaterial());
				}
			}
			}

Well, if it is not working, I need exactly your MAM version and SP level, cause then I think the manager is missing some functionality - but usualy in 90% this code works fine - could be that there are some misstypos, sorry for that, have not checked it agains MAM in Eclipse. :-$

Hope this silves the problem.

Regards,

Oliver

P.s.: There comes a question through my head: Item010 is for customer enhancement as you already mentioned at the beginning. So yre ou sure your data is on the device? Well, you can easily check that: open the start.jsp page in MAM. The URL is:

http://localhost:4444/<MAM-FOLDERNAME>/start.jsp

There you can check the complete MAM data on he device. So you can see if MAM070 is complete on your device.

Hope this switches on some more lights!

Regards,

Oliver

Edited by: Oliver Kaluscha on Feb 18, 2008 9:36 AM

Edited by: Oliver Kaluscha on Feb 18, 2008 9:47 AM

chintan_virani
Active Contributor
0 Kudos

Oliver,

I am using MAM3.0 SR4 and on Patch Level 0.

I am able to get Manuf PArt Num from MAM070Item010 now. There was a typo at my end. All becuase classic Copy-Paste error. I was looping in second for loop with i instead of j and hence the error. I have corrected it and the code is attached.

By the way there is no method elementAt for BOList class hence I am using get(int) method. Here is what I wrote for Controller.

ZInventoryList.java



	public Forward onLoad(Forwards forwards)
	{
		System.out.println(">>>>>>>> ZInventoryList : onLoad called <<<<<<<<<<<<<<<");
		InventoryCustomController custom = getInventoryCustomController();
		
		Context context = getContext();
		
		try
		{
			Mam070Manager manager = (Mam070Manager) naming.lookup(Mam070Manager.class.getName());
			BOList temp = manager.getMam070s();
			Mam070 inv = null;
			if (temp != null)
			{
				for (int i = 0; i < temp.size(); i++)
				{
					inv = (Mam070) temp.get(i);
					String strInvKey = inv.getKey();
					
					custom.setSelectedInventory(strInvKey);
					
					Mam070 inventory = getInventoryCustomController().getSelectedInventory();
					
					
					Mam070Item010 item = null;
					BOList itemList = manager.getMam070Item010s(inventory);
					if (itemList != null)
					{
						for (int j = 0; j < itemList.size(); j++)
						{
							item = (Mam070Item010) itemList.get(j);
							if (inv.getMaterial().equalsIgnoreCase("000000000000000865"))
							{
								System.out.println("ZInventoryList : Material 			: " + inv.getMaterial());
								System.out.println("ZInventoryList : Enhancement Flag 	: " + inventory.getEnhancementFlag());
								System.out.println("ZInventoryList : Mfr Part Num 		: " + item.getFieldValue());
							}
							
							
							ZInventoryListBO bo = new ZInventoryListBO(inventory,item);
							bo.setInventory(inventory);
							bo.setItem(item);
							
							context.setValue("InventoryList", "true");
							context.addValue("inventory", inventory);
							context.addValue("item", item);
							
						}
					}
				}
			}
			
		}
		catch (BOException e)
		{
			e.printStackTrace();
		}
		
		return super.onLoad(forwards);

Well Mam070Item010 is the standard BO class and not just for Customer Enhancement. When the value is displayed on Item Detail screen this class has the Customer Enhancement data I mean.

So now I get to see the data I want to (i.e Manuf Part Number) on System Console.

Next thing was to create a new BO class to hold the data as suggested in the Guide.

Here it is : ZInventoryListBO.java


public class ZInventoryListBO extends AbstractBO implements BusinessObject
{
	public ZInventoryListBO(Mam070 inventory, Mam070Item010 item)
	{
		System.out.println("++++++++++ ZInventoryListBO called ++++++++++ ");
		Hashtable bos = new Hashtable();
		bos.put("inventory",inventory);
		if (item !=null)
		{
			bos.put("item",item);
		}

	}

Am I on right track???? Question is how to show up the values I am getting on System consoles in the Inventory List??

PS: Some screenshots :

[MAM070|http://img162.imageshack.us/my.php?image=capture0103fq3.png]

[MAM070Item010|http://img292.imageshack.us/my.php?image=capture0104zz0.png]

Chintan

Edited by: Chintan Virani on Feb 18, 2008 8:44 PM

Former Member
0 Kudos

Hi Chintan,

well, again we have several options to do that. Lets take thesimplest one:

we create a continer, put the data into it, store the conatiner in the session and on the JSP take the container from the session and display the values.

Straight forward stuff - even not the fanciest one - but it is clear structured and it works fine

Ok, lets start:

First we create a Class called InverntoyDataItem:


class yourclass.inverntory.item;

public class InverntoyDataItem {
	//Inventory data
	private String s_Inventory = "";
	public void setInventory(String value) {
		if (value == null) {
			value = "";
		}
		s_Inventory = value;
	}
	public String getInventory() {
		return s_Inventory;
	}
}

Ok, this container you fill with the usual data in your code:


InverntoyDataItem inventItem = new InverntoyDataItem();
inventItem.setInventory(item);

and then we store it into the session:


SessionUtil.getSession().setAttribute("InventoryItem", inventItem);

so we have the item in the session and can use it form the JSP:

First we need to get the item from the session:


<jsp:useBean id="inventory" scope="session" type="yourclass.inverntory.item.InventoryDataItem"/>

well, and then access the information where we need it:


<%=inventory.getInventory() %>

As I said it is not the fanciest way to send the information, but it should work and.... again, not checked for Typo and syntax - but hope you get the idea from it.

Have a nice time,

Regards,

Oliver

chintan_virani
Active Contributor
0 Kudos

Oliver,

xMAM3.0 does not have the coding like you have mentioned for the JSP. They make use of the Tag libraries and there is differrent approach for rendering the data into a list on screen which I do not want to loose out.

Also I don't want to do things differently other than specified in the guide. Did you had a chance to look at it and if you can suggest me a way from it then it would be great.

You have been a great support to MI forum. Thanks for your co-operation and help.

Chintan

Former Member
0 Kudos

Hi,

well, you could do it liek that even MAM does it not hat way - but I can understand you - I will look into that tomorrow morning and mail you the correct coding for MAM standard - no problem with that.

Regards,

Oliver

chintan_virani
Active Contributor
0 Kudos

Oliver,

Did you get a chance to go thru the guide? Awaiting your inputs on the steps as mentioned in the guide.

Chintan

Former Member
0 Kudos

Hi Chintan,

I had a deeper look into the issue - and I guess I understand now you rissue - and now you can decide what to do.

Well, in MAM it is pretty much always the same: on one page you see only data of one structure. Either the top or the item structure. So this is described in all guides as well. Now you want to display an item on a screen that is from another structure. Here you have a few problems: first it is out of scope of the enhancement guide as such, second it is a little tricky - cause it could be that you have more then one instance you need to display - the reason why we have it in an item structure and not in the top structure.

So, the easiest way: add the value to the context. If you look into all controllers - all of them add values to the context and then display that on the JSP. The problem here: usually we have a SyncBO instance per screen and then we can display the item directly from there - as mentioned in the config guide. Cause we do not have this here, we need to go another route and the one above is the one I would recommend.

Sorry that I can not give you a better option but I must say - I always do it like that if I need to do so.

Regards,

Oliver

chintan_virani
Active Contributor
0 Kudos

Oliver,

Well I was able to display the value on the first screen by modifying the getField method in MAM070Impl file but after making this changes the Search functionality goes for a toss and I have to forcibly close the MAM Window.

Changing the getField was suggested by Narsimha, unfortunately since he has not posted here I can't reward him

Also I will try looking more into your solution. Thanks once again for your help.

Chintan

Answers (0)