Prerequisites
- Products: Liquid UI WS, Liquid UI Server or Local DLL, Client Software
- Commands: set(), del(), pushbutton()
Purpose
This article guides you in generating a list of materials from the List screen and displaying the specified details. Here, we are considering the SAP Easy Access screen to demonstrate the process and walk you through the following steps:
- Delete the unnecessary screen elements
- Add a function to set the screen layout
- Add an input field and push button to generate the list
- Add a functionality to read the list screen data and verify the selection
- Add a box to display the list and push button to view details
User Interface
//Create the SAPLSMTR_NAVIGATION.E0100.sjs file inside your scripts folder for customizing the SAP Easy Access screen
//Now, let's add the Liquid UI script to the above file and save it
Customization
- Delete the image container and other screen controls on the SAP Easy Access screen using del().
//Delete the image container and the screen controls on the SAP screen del("X[IMAGE_CONTAINER]"); del("P[User menu]"); del("P[SAP menu]"); del("P[SAP Business Workplace]"); del("P[Display role menu]"); del("P[Add to Favorites"); del("P[Delete Favorites"); del("P[Delete Favorites"); del("P[Delete Favorites"); del("P[Change Favorites"); del("P[Move Favorites down"); del("P[Move Favorites up"); del("P[Create role");
- Add a function to set the screen layout.
//Function to set the screen layout function fn_navigate(param){ set("V[z_screen]",""); set("V[z_layout]",""); }
- Add an input field labeled Max Entries for required materials, limited to 12 entries, and a push button Get Material to fetch material details.
//Creates a push button and input field to generate the list if(z_screen==undefined || z_screen=="") { pushbutton([3,1], "@12@Generate Material List",{ "process":z_readfromlist}); inputfield([1,1],"Max Entries",[1,12],{"name":"z_max","size":"11"}); }
- Add a function z_readfromlist to read the list screen data
//Function to read the list screen data function z_readfromlist() { title("Generating Material List....") z_material_array = []; lfvrow = 1; onscreen 'SAPLSMTR_NAVIGATION.0100' enter("/NSE16"); onscreen 'SAPLSETB.0230' set('F[table Name]', 'MARA'); enter(); onscreen '/1BCDWB/DBMARA.1000' set("F[MAX_SEL]","&V[z_max]"); enter("/8"); onscreen 'SAPLSETB.0120' SCROLL_NEXT:; enter("/scrolltoline=&V[lfvrow]"); onscreen 'SAPLSETB.0120' enter("/hscrollto=0"); if(z_max=="1"){ goto START; } if(lfvrow >= _listlastvisiblerow){ goto END; } START:; lfvrow = _listfirstvisiblerow; llvrow = _listlastvisiblerow; z_row = 5; LOOP:; set("V[z_matval]","&#["+z_row+",20]"); z_material_array.push(z_matval); lfvrow = lfvrow+1; if(lfvrow <= _listlastvisiblerow){ z_row = z_row+1; goto LOOP; } if(z_max==1){ goto END; } else{ goto SCROLL_NEXT; } END:; for(var col = 0; col < z_material_array.length; col++) { var objReeb = <"#["+row+","+col+"]">; if (objReeb && objReeb.isValid) { var trimmedName = objReeb.name.toString().trim(); if (trimmedName === '5' || trimmedName === '') { retString += value + ' '; value = ""; } else if (trimmedName !== lastReebName) { value = trimmedName; lastReebName = value; } } } set("V[z_layout]","1"); enter("/3"); onscreen 'SAPLSETB.0120' enter("/3"); onscreen '/1BCDWB/DBMARA.1000' enter("/3"); onscreen 'SAPLSETB.0230' enter("/3"); onscreen 'SAPLSMTR_NAVIGATION.0100' enter("?"); set("V[z_screen]","home"); }
- Add a function checkSelection to verify the selection and display the material numbers.
//Function to check the material(s) selection and navigate to MM03 function checkSelection() { selected = []; for (k=0; k<z_material_array.length;k++) { var chkName = "chk"+ (k+1); if (eval(chkName) == 'X') { selected.push(z_material_array[k]); } } if (selected.length > 1) { return("Execute one Material at a Time "); } if (selected.length == 0) { return("No Materials Selected"); } enter("/nmm03") onscreen 'SAPLMGMM.0060' set("F[Material]",selected[0]); enter(); onscreen 'SAPLMGMM.0070' set("cell[Table,0,1]","X"); set("cell[Table,0,2]","X"); set("cell[Table,0,3]","X"); set("cell[Table,0,4]","X"); set("cell[Table,0,5]","X"); set("cell[Table,0,6]","X"); set("cell[Table,0,7]","X"); set("cell[Table,0,8]","X"); set("cell[Table,0,9]","X"); set("cell[Table,0,10]","X"); set("cell[Table,0,11]","X"); enter("/6"); onscreen 'SAPLMGMM.0080' enter(); onscreen 'SAPLMGMM.0080' enter(); onscreen 'SAPMSDYP.0010' enter(); }
- Add a box labeled Material List to display the list of material numbers and a push button labeled Display Material to execute the checkSelection process when clicked.
//Function to check the material(s) selection and navigate to MM03 if(z_layout=="1") { //creates a box and push button to display the list. box([1,0], [z_material_array.length+5,25], "Material List"); pushbutton([z_material_array.length+3,2], "@16@Display Material",{"process":checkSelection,"size":[2,21]}); for(l=0,m=3;l<z_material_array.length;l++,m++) checkbox([m,2], z_material_array[l],{name: "chk"+(l+1)}); }
SAP Process
- Refresh the SAP screen and input the value between 1-12 in the Max Entries field. Click the Get Material List push button to generate a list of material numbers based on the specified quantity.
- This action displays a list of material numbers in the Material List box, as shown below.
- Click Display Material after selecting a material number to view details on the MM03 screen.