Dynamic call of a static method of an static attribute
Hi all,
is it possible to call dynamically a static method of a static attribute of a class.
The statement without dynamic call would look like this:
cl_test_class=>static_attribute=>static_method( ).
I would like to do it like this:
('CL_TEST_CLASS')=>static_attribute=>static_method( ).
Netiher the one nor the other way works for me - I'm getting the error "The notation used is reserved for business object classes".
Regards, Stefan
I guess, it is not possible to call method using the short form (parameters in brackets) is not possible in Dynamic Access. You may need to get the attribute first and then call the method.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: o_same TYPE REF TO lcl_main.
METHODS: run.
ENDCLASS. "lcl_main DEFINITION
CLASS lcl_main IMPLEMENTATION.
METHOD run.
WRITE: 'success'.
ENDMETHOD. "run
ENDCLASS. "lcl_main IMPLEMENTATION
START-OF-SELECTION.
DATA: lo_same TYPE REF TO lcl_main.
CREATE OBJECT lcl_main=>o_same.
* lcl_main=>o_same=>run( ).
TRY.
FIELD-SYMBOLS: <fs> TYPE REF TO lcl_main.
ASSIGN ('LCL_MAIN')=>('O_SAME') TO <fs>.
CALL METHOD <fs>->('RUN').
CATCH cx_root.
ENDTRY.
Regards,
Naimesh Patel
Similar Messages
-
How to dynamically call and order program modules
Hey guys,
I have ‘x’ pieces of code (x could be 10’s or 100’s of modules).
I need to be able to dynamically call and run ‘y’ of them, but I need to be able to do it in parallel, and some of them might be in order.
For instance ‘A’, ‘B’ and ‘C’ need to run in parallel,
but 'D' needs data from 'A' and will run after 'A',
and 'E' needs to run after ‘D’,
and ‘F’ needs data from 'C' and will to run after ‘C’
So I have two questions.
How should I organize and order these dynamic calls?
and What method should I use to pass data along from one VI to another?jcyth wrote:
[...]But when you thought of Teststand, did you have a specific feature of Teststand that you thought it would be a viable solution?
Since we will probably have the end user choose the modules required in this module operation, having a premade sequence editor might be nice
My point mentioning TestStand is that my feeling tells me that you are going to re-implement some very basic functions which are already included in TestStand.
To be honest: TestStand adds additional costs. You have to purchase licenses, you should get some training which takes time until getting payed off.
But on the other hand: You also need time to implement and test your self-made approach. Also: Does this project grow in the future? Do you need additional features in the (near) future?
Going into this will result in a break even in costs where you can say: if i take more time in my self-made approach, it is cheaper to go for TestStand right from the beginning.
TestStand is designed to be VERY flexible. But you have to get familiar to this flexibiity in order to get where you want. Therefore, i recommend you to collect some information before making the decision. Maybe you want to invite some sales guy from NI in order to present TestStand to you....
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
Can we call same VI statically and dynamically in same application ?
Hi,
I am having an application where i call a VI dynamically using VI server. However at some other place in the same application, i call the VI statically (i.e. the VI icon is placed in the block diagram of parent VI). But when i run the application i get following error message:
"Possible reason(s):
LabVIEW: The VI is not in a state compatible with this operation."
Why is it so ?. Can we not call the same VI dynamically and statically at two differenct locations in the main program ?.
Thanks for any inputs.If a VI is statically in a running hierarchy, it can be also called dynamically using "Call by Reference" node after opening it with a its type specifier refnum. However, you can't invoke the Run VI method, the same way you can't run it using the Run arrow.
LabVIEW, C'est LabVIEW -
Calling a java static method from javascript
I am running into issue while calling a java static method with a parameter from javascript. I am getting the following error. Any help is greatly appreciated.
Thx
An error occurred at line: 103 in the jsp file: /jnlpLaunch.jsp
pfProjectId cannot be resolved to a variable
=================================================
// Java static method with one parameter
<%!
public static void CreateJnlpFile(String pfProjectId)
%>
//Script that calls java static method
<script language="javascript" type="text/javascript">
var pfProjectId = "proj1057";
// Here I am calling java method
<%CreateJnlpFile(pfProjectId);%>
</script>
===================================================
Edited by: 878645 on Mar 6, 2012 11:30 PMThanks, Got what you are telling. Right now I have one jsp file which is setting the parameter 'pfProjectId' and in another .jsp I am retrieving it. But I am getting null valuue
for the variable. I am wondering why I am getting null value in the second jsp page?.
Thx
====================================================================
<script language="javascript" type="text/javascript">
// Setting parameter pfProjectId
var pfProjectId = "proj1057";
request.setParameter("pfProjectId", "pfProjectId");
</script>
// Using Button post to call a .jsp that creates jnlp file
<form method=post action="CreateJnlpFile.jsp">
<input type="submit" value="Create JNLP File">
</form>
//Contents of second .jsp file CreateJNLPFile.jsp
String pfProjectId = request.getParameter("pfProjectId ");
System.out.println( "In CreateJnlpFile.jsp pfProjectId " + pfProjectId );
======================================================= -
Dynamically call a getter method with reflection?
I have a page that prints out some report info, but only for the group of columns requested. What I need to do, based upon a String containing a column name that is passed in as input, is call that column's getter method dynamically...
Does anyone have any good examples of doing this?
Thanks,
MikeNot sure if dynamic replacement of the property name works, but you could try
<jsp:getProperty name="myBean" property="<%=request.getParameter("col1")%>"/>
Where myBean is the name of your object and col1 is the name of your property, not the function name. So, if you have a function named getType(), then your variable is named type. So you would pass type as the property, like
<jsp:getProperty name="myBean" property="type"/>
This dynamically calls the getType() method on your object myBean. -
Dynamically Calling a built-in API Class
Ok...
Scenario:
I'd like to pick between an internal pdf viewer and an external using the java.awt.Desktop class.
Unfortunately, for development purposes, I need the code to compile on Java 1.5 (1.5 doesn't have java.awt.Desktop)
Eventually we'll move to 1.6, but until we do, the other contributors don't want to be bothered with commenting out the 1.6 code.
I figured I could dynamically load the class with:
Class.forName("java.awt.Desktop")or perhaps
Class.forName("java.awt.Desktop").newInstance()The Desktop class complains about modifiers "private".
I tried calling the Desktop.open method directly with:
Class.forName("java.awt.Desktop").getDeclaredMethod("open", new Class[]{java.io.File.class};).invoke(null, pdfFile);With no luck either.
I'm compiling on Java 1.6, with the hopes that the 1.5 compilers won't complain. Is this possible, or am I trying to do something outside the scope of Java?
-FBLHey guys, this WORKS! Infact, the compiled Java 1.5 version flawlessly opens the application with our 1.6 clients!
I'm pretty impressed that java has this flexibility! Thanks all!
Here's my exact code. I had to remove a few nulls to supress warnings.
try {
desktopCall("open", new File("C:\samplefile.pdf"));
catch (Exception e) {
// Open w/ internal viewer
public static void desktopCall(String call, Object o) throws Exception {
Class[] f = new Class[]{java.io.File.class};
Object obj = Class.forName("java.awt.Desktop").getDeclaredMethod("getDesktop").invoke(null);
Class.forName("java.awt.Desktop").getDeclaredMethod(call,f).invoke(obj,o);
}-FBL
Message was edited by:
FBL -
Hello,
I'm reasonably new to working with EJBs so perhaps this isnt possible... Can you dynamically call an EJB at runtime ie like reflection.
I know once the bean has been created I can use reflection to call the method but how can I create the bean from the beans remote home interface?
Many thanks
MichaelGot it
EJBMetaData md = theHome.getEJBMetaData();
Class homeClass = md.getHomeInterfaceClass();
EJBObject theRemote = (EJBObject)invoke(homeClass,theHome,"create");
static Object invoke(Class c,Object obj,String mname){
Method[] methods = c.getMethods();
String name=null;
Object r= null;
try {
for(int i = 0; i<methods.length ;i++) {
name = methods.getName();
if(name.startsWith(mname)) {
r = methods[i].invoke(obj,null);
} catch(Exception e){
e.printStackTrace();
return r; -
Calling a backing bean method after load of fragment in adf
I needed to call a backing bean method after page load of fragment in adf.
I used the method suggested in:
https://community.oracle.com/message/11044570
only difference is im giving the if clause as:
if (refreshFlag == RegionBinding.RENDER_MODEL ) {
instead of
if (refreshFlag == RegionBinding.PREPARE_MODEL)
It was working fine, but page was not getting refreshed so used the code as mentioned in example:
public void refresh() {
FacesContext facesContext = FacesContext.getCurrentInstance();
String refreshpage = facesContext.getViewRoot().getViewId();
ViewHandler viewHandler =facesContext.getApplication().getViewHandler();
UIViewRoot viewroot = viewHandler.createView( facesContext, refreshpage);
viewroot.setViewId(refreshpage);
facesContext.setViewRoot(viewroot);
Now issue is once page is loaded and backing bean method is called, the refresh code refreshes the page and upon page load, refresh method is called again in recursive fashion.
please advise what to do in such scenario?
I tried to do selective refresh using some variable(also with static) but it does not help as page wont be refresh at all or page will keep refreshing recursively.Use clientListener on the page load event
<af:document id=”d1″>
<af:serverListener type=”onloadEvent”
method=”#{<managedbean name>.<method name>}”/>
<af:clientListener method=”onLoadClient” type=”load”/>
<af:resource type=”javascript”>
function onLoadClient(event) {
AdfCustomEvent.queue(event.getSource(),”onloadEvent”,{},false);
return true;
</af:resource> -
Calling a class's method from another class
Hi, i would like to know if it's possible to call a Class's method and get it's return from another Class. This first Class doesn't extend the second. I've got a Choice on this first class and depending on what is selected, i want to draw a image on the second class witch is a Panel extended. I put the control "if" on the paint() method of the second class witch is called from the first by the repaint() (first_class.repaint()) on itemStateChanged(). Thankx 4 your help. I'm stuck with this.This program is for my postgraduation final project and i'm very late....
import java.awt.*;
import java.sql.*;
* This type was generated by a SmartGuide.
class Test extends Frame {
private java.awt.Panel ivjComboPane = null;
private java.awt.Panel ivjContentsPane = null;
IvjEventHandler ivjEventHandler = new IvjEventHandler();
private Combobox ivjCombobox1 = null;
class IvjEventHandler implements java.awt.event.WindowListener {
public void windowActivated(java.awt.event.WindowEvent e) {};
public void windowClosed(java.awt.event.WindowEvent e) {};
public void windowClosing(java.awt.event.WindowEvent e) {
if (e.getSource() == Test.this)
connEtoC1(e);
public void windowDeactivated(java.awt.event.WindowEvent e) {};
public void windowDeiconified(java.awt.event.WindowEvent e) {};
public void windowIconified(java.awt.event.WindowEvent e) {};
public void windowOpened(java.awt.event.WindowEvent e) {};
private Panel ivjPanel1 = null;
* Combo constructor comment.
public Test() {
super();
initialize();
* Combo constructor comment.
* @param title java.lang.String
public Test(String title) {
super(title);
* Insert the method's description here.
* Creation date: (11/16/2001 7:48:51 PM)
* @param s java.lang.String
public void conexao(String s) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:system/[email protected]:1521:puc";
Connection db = DriverManager.getConnection(url);
//String sql_str = "SELECT * FROM referencia";
Statement sq_stmt = db.createStatement();
ResultSet rs = sq_stmt.executeQuery(s);
ivjCombobox1.addItem("");
while (rs.next()) {
String dt = rs.getString(1);
ivjCombobox1.addItem(dt);
db.close();
} catch (SQLException e) {
System.out.println("Erro sql" + e);
} catch (ClassNotFoundException cnf) {
* connEtoC1: (Combo.window.windowClosing(java.awt.event.WindowEvent) --> Combo.dispose()V)
* @param arg1 java.awt.event.WindowEvent
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void connEtoC1(java.awt.event.WindowEvent arg1) {
try {
// user code begin {1}
// user code end
this.dispose();
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
* Return the Combobox1 property value.
* @return Combobox
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private Combobox getCombobox1() {
if (ivjCombobox1 == null) {
try {
ivjCombobox1 = new Combobox();
ivjCombobox1.setName("Combobox1");
ivjCombobox1.setLocation(30, 30);
// user code begin {1}
this.conexao("select * from referencia");
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
return ivjCombobox1;
* Return the ComboPane property value.
* @return java.awt.Panel
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Panel getComboPane() {
if (ivjComboPane == null) {
try {
ivjComboPane = new java.awt.Panel();
ivjComboPane.setName("ComboPane");
ivjComboPane.setLayout(null);
getComboPane().add(getCombobox1(), getCombobox1().getName());
getComboPane().add(getPanel1(), getPanel1().getName());
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
return ivjComboPane;
* Return the ContentsPane property value.
* @return java.awt.Panel
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Panel getContentsPane() {
if (ivjContentsPane == null) {
try {
ivjContentsPane = new java.awt.Panel();
ivjContentsPane.setName("ContentsPane");
ivjContentsPane.setLayout(new java.awt.BorderLayout());
getContentsPane().add(getComboPane(), "Center");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
return ivjContentsPane;
* Return the Panel1 property value.
* @return Panel
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private Panel getPanel1() {
if (ivjPanel1 == null) {
try {
ivjPanel1 = new Panel();
ivjPanel1.setName("Panel1");
ivjPanel1.setBackground(java.awt.SystemColor.scrollbar);
ivjPanel1.setBounds(24, 118, 244, 154);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
return ivjPanel1;
* Called whenever the part throws an exception.
* @param exception java.lang.Throwable
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
* Initializes connections
* @exception java.lang.Exception The exception description.
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
this.addWindowListener(ivjEventHandler);
* Initialize the class.
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("Combo");
setLayout(new java.awt.BorderLayout());
setSize(460, 300);
setTitle("Combo");
add(getContentsPane(), "Center");
initConnections();
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
// user code begin {2}
// user code end
* Insert the method's description here.
* Creation date: (11/17/2001 2:02:58 PM)
* @return java.lang.String
public String readCombo() {
String dado = ivjCombobox1.getSelectedItem();
return dado;
* Starts the application.
* @param args an array of command-line arguments
public static void main(java.lang.String[] args) {
try {
/* Create the frame */
Test aTest = new Test();
/* Add a windowListener for the windowClosedEvent */
aTest.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent e) {
System.exit(0);
aTest.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of Test");
exception.printStackTrace(System.out);
* Insert the type's description here.
* Creation date: (11/17/2001 1:59:15 PM)
* @author:
class Combobox extends java.awt.Choice {
public java.lang.String dado;
* Combobox constructor comment.
public Combobox() {
super();
initialize();
* Called whenever the part throws an exception.
* @param exception java.lang.Throwable
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
* Initialize the class.
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("Combobox");
setSize(133, 23);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
// user code begin {2}
// user code end
* main entrypoint - starts the part when it is run as an application
* @param args java.lang.String[]
public static void main(java.lang.String[] args) {
try {
java.awt.Frame frame = new java.awt.Frame();
Combobox aCombobox;
aCombobox = new Combobox();
frame.add("Center", aCombobox);
frame.setSize(aCombobox.getSize());
frame.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
frame.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of Combobox");
exception.printStackTrace(System.out);
* Insert the type's description here.
* Creation date: (11/17/2001 2:16:11 PM)
* @author:
class Panel extends java.awt.Panel {
* Panel constructor comment.
public Panel() {
super();
initialize();
* Panel constructor comment.
* @param layout java.awt.LayoutManager
public Panel(java.awt.LayoutManager layout) {
super(layout);
* Called whenever the part throws an exception.
* @param exception java.lang.Throwable
private void handleException(java.lang.Throwable exception) {
/* Uncomment the following lines to print uncaught exceptions to stdout */
// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
// exception.printStackTrace(System.out);
* Initialize the class.
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
try {
// user code begin {1}
// user code end
setName("Panel");
setLayout(null);
setSize(260, 127);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
// user code begin {2}
// user code end
* main entrypoint - starts the part when it is run as an application
* @param args java.lang.String[]
public static void main(java.lang.String[] args) {
try {
java.awt.Frame frame = new java.awt.Frame();
Panel aPanel;
aPanel = new Panel();
frame.add("Center", aPanel);
frame.setSize(aPanel.getSize());
frame.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
frame.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of java.awt.Panel");
exception.printStackTrace(System.out);
* Insert the method's description here.
* Creation date: (11/17/2001 2:18:36 PM)
public void paint(Graphics g) {
/* Here's the error:
C:\Test.java:389: non-static method readCombo() cannot be referenced from a static context
System.out.println(Test.lerCombo());*/
System.out.println(Test.readCombo()); -
How to dynamically call image in PDF for Acrobat ver 8.1 onwards?
Hi Experts,
I am using Web Dynpro Java. My requirement is to call the images dynamically on a PDF form. There are no of company code. I have to call different logos for different company codes/
We are now using Acrobat 8.1.1. Please refer following thread.
http://kb2.adobe.com/cps/405/kb405270.html
From Acrobat 8.*, we have to use some different method for dynamically calling the images. Earlier we were using the concept mentioned below to dynamically call images.
However this method is not applicable for Acrobat Reader 8.* onwards due to security reasons.
Click on the Layout tab and choose None for the Caption position.
u2022 Click on the Object, then the Binding tab and choose None for Default Binding.
u2022 Click on the Field tab, enter $record.SapOnlineShopUrl for the URL entry, and select Use Image Size for the Sizing field.
u2022 Click on the script editor and enter the following FormCalc script statement, which enables the dynamic integration of the image. Show: initialize Script: this.value.image.href = xfa.resolveNode(this.value.image.href).value; Language: FormCalc Run At: Client
write following code in wddoinit
try { String url = WDURLGenerator.getAbsoluteWebResourceURL( wdComponentAPI.getDeployableObjectPart(), "sap_online_shop.jpg"); wdContext.currentDataSourceElement().setSapOnlineShopUrl(url); } catch(Exception e) { throw new WDRuntimeException(e); }
Please let me know what is the alternate method for Adope ver 8.1.1
Regards,
GaryHi Gary,
First you upload the image in SAP through se78.then write the below code in your adobe form interface.
data : v_object type TDOBJECTGR value 'GRAPHICS',
v_id type TDIDGR value 'BMAP',
v_btype type TDBTYPE value 'BCOL',
V_FIELD TYPE XSTRING.
V_NAME = 'ZW_DEVMAN_LOGO'.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = v_object " 'GRAPHICS'
p_name = v_name " Name of the logo as in se78
p_id = v_id " 'BMAP'
p_btype = v_btype " 'BCOL' ( whether the image is in color or black and white )
RECEIVING
p_bmp = v_field
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
g_logo = v_field.
Declare g_logo as xstring in global data.
In context of the form make one graphic element with field g_logo and mime type BMP.It will work.
Regards,
Simi A M
Edited by: amsimi on Jan 26, 2011 5:30 AM -
Calling a external Java method from JSP - using Tomcat server
Hi all,
I am trying to call a method in an external Java file from my JSP. I am using Tomcat server.
I have my class within the package package "mypackage" and it is called myclass.class. It has only one static method mymethod() which reads from a file and writes to a file.
I compiled the java class and I put the class file under webapps/ROOT/web-inf/classes/mypackage/myclass.class
I am trying to say something like this from my JSP file(which is under webapps/ROOT) :
<%@ page import = "mypackage.myclass"%>
<% myclass.mymethod(); %>
I am not instatiating the class as its a static method.
This is what I get while accessing my jsp file :
javax.servlet.ServletException: try to access class mypackage.myclass from class org.apache.jsp.index_005ftest_jsp
To put my problem in a nutshell, Can someone guide me how to access a method of an external class from a JSP page? I have a bunch of pages doing the same operation so I thought I would have it in a method and call it from every page. Even though I tried to put the file under web-inf/classes, The JSP is not able to see the class.
Please help.
Thanks
-UdayI have a situation that is a bit similar. I have successfully used beans for storing methods used in JSPs and used by other methods in the same class as was suggested above. Now I would like to break some methods into another (utility) class since they are lower level and can be used by lots of things. They are for database operations (given a String query and String dbname, it queries and returns ResultSet for example). I want to have them in a separate class for reusability and OOP.
I am having problems calling those public static methods in the public class from my bean that communicates with the JSP. I can't compile the class that calls the method in the database ops class. I get an error like :
loginHelper.java:45: cannot find symbol
symbol : variable sqlHelper
location: class dbHelperBean.loginHelper
and when I include the package name in the call I get
loginHelper.java:45: cannot find symbol
symbol : class sqlHelper
location: package dbHelperBean
That's strange since the package of both classes is dbHelperBean and the class is indeed called sqlHelper. I tried to compile it in the same directory as sqlHelper as well. What am I doing wrong?
Thanks for any help. -
Unexpected delay when dynamically called VI closes
LV10.0 / WXP
A VI is called dynamically by Run VI Method (Wait Until Done = FALSE, Auto Dispose Ref = TRUE).
Queues are used to exchange data with the main VI.
When this VI closes ("stop" message from the main VI), LabVIEW hangs for about 25 seconds (!) with one of the CPUs of the dual core machine at 100%.
Has anyone else encountered this strange behaviour ? Any ideas ?
Many thanks in advance
Solved!
Go to Solution.Norbert B a écrit :
Can you give us a small picture of the way you are calling and releasing the subVIs?
As mentionned in my first message : Run VI Method (Wait Until Done = FALSE, Auto Dispose Ref = TRUE) is used to call the VIs.
Release : after reception of a "close" message (queue), the dynamic VIs terminate their execution
If called with Auto Dispose Ref = FALSE, the freeze appears when Close Reference is executed in the calling VI (after reception of a "I'm closing" message from the dynamic called VI).
If loading the VI takes only a short time but unloading takes long, it seems to me that those subVIs allocate many new handles/memory spaces during runtime. Is that the case?
As mentionned in a previous message : The memory usage changes from about 687 to 676 MB when the four
instances are closed. The number of handles decreases from about 272k to
61k.
This sounds like the whole application freezes for the time being. Is it a single loop architecture?
No. It is a rather big application with several VIs running independently and exchanging data through queues.
In addition: You call those subVIs dynamical with reentrant execution (at least some of them). So they should run in parallel.
Yes, they run in parallel.
Did you configure different preferred execution systems for your different subVIs?
Yes, I have tried several combinations and also changed the Priority. I also tried to replace the While Loop of the VI which communicates with the PLC by a Timed Loop in order to specify the processor. Unfortunately all my trials ended without any succes.
Did you check for reference leaks using the Execution Trace Toolkit?
Yes. There are none.
Norbert
Thank you very much for your help -
When to call a BAPI inputexecute method from webdynpro-java?
Hello... I'm a little concerned about a situation I'm having. The thing is that I'm trying to use the Bapi_Qualiprof_Change bapi with some test and hard coded data for a future application. It works fine if I fill the input profile_add table in the init() method of my view and then directly call the onActionModifyQualification method (inside the same init() where i filled the parameters).
On the contrary, if I change the code that intializes the data to the onActionModifyQualification or create an special method to initialize it wich is called later with an action button, then it doesn't work.
After many test I noticed that i have to call the bapi execute method right in the init... is there something I can do to fix it? or is it that i must do it in order to make it work?
I have my controller's context mapped to the bapi's model and the view context mapped to the controller's one.... is it good or do i have to build a similar structure to capture the parameters before and then copy the values into the controller's context??
Thanks a lot!!Thanks for your answer, but it doesn't let me do that because wdModifyView is static. Therefore if 2 people are trying to use it, it's goning to be all mixed up, isn't it?
Anyway, what I really want is executing the bapi when I press the button (that's when it should call the action that calls the bapi). But it only works if I call the action in the init method. -
Regarding call transaction and session method???
HI All,
Cud u pls let me know
1. differences between call transaction and session???
2. Is it possible to schedule call transaction in background?? ( all are saying MODE N = background scheduling in call transaction.......but i dont think so)
3. Is it posible to handle multiple transactions in call transaction ? if so,how?
4. Is it posible to handle multiple transactions in session ? if so,how?
5. How can we see the log in session method????Hi ,
Check this documentation.
About Session method
In this method you transfer data from internal table to database table through sessions.
In this method, an ABAP/4 program reads the external data that is to be entered in the SAP System and stores the data in session. A session stores the actions that are required to enter your data using normal SAP transaction i.e., Data is transferred to session which in turn transfers data to database table.
Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
When the program has finished generating the session, you can run the session to execute the SAP transactions in it. You can either explicitly start and monitor a session or have the session run in the background processing system.
Unless session is processed, the data is not transferred to database table.
BDC_OPEN_GROUP
You create the session through program by BDC_OPEN_GROUP function.
Parameters to this function are:
User Name: User name
Group: Name of the session
Lock Date: The date on which you want to process the session.
Keep: This parameter is passed as X when you want to retain session after
processing it or to delete it after processing.
BDC_INSERT
This function creates the session & data is transferred to Session.
Parameters to this function are:
Tcode: Transaction Name
Dynprotab: BDC Data
BDC_CLOSE_GROUP
This function closes the BDC Group. No Parameters.
Some additional information for session processing
When the session is generated using the KEEP option within the BDC_OPEN_GROUP, the system always keeps the sessions in the queue, whether it has been processed successfully or not.
However, if the session is processed, you have to delete it manually. When session processing is completed successfully while KEEP option was not set, it will be removed automatically from the session queue. Log is not removed for that session.
If the batch-input session is terminated with errors, then it appears in the list of INCORRECT session and it can be processed again. To correct incorrect session, you can analyze the session. The Analysis function allows to determine which screen and value has produced the error. If you find small errors in data, you can correct them interactively, otherwise you need to modify batch input program, which has generated the session or many times even the data file.
CALL TRANSACTION
About CALL TRANSACTION
A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program by
Call transaction <tcode> using <BDCTAB>
Mode <A/N/E>
Update <S/A>
Messages into <MSGTAB>.
Parameter 1 is transaction code.
Parameter 2 is name of BDCTAB table.
Parameter 3 here you are specifying mode in which you execute transaction
A is all screen mode. All the screen of transaction are displayed.
N is no screen mode. No screen is displayed when you execute the transaction.
E is error screen. Only those screens are displayed wherein you have error record.
Parameter 4 here you are specifying update type by which database table is updated.
S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.
A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).
Parameter 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:
1. Tcode: Transaction code
2. Dyname: Batch point module name
3. Dynumb: Batch input Dyn number
4. Msgtyp: Batch input message type (A/E/W/I/S)
5. Msgspra: Batch input Lang, id of message
6. Msgid: Message id
7. MsgvN: Message variables (N = 1 - 4)
For each entry, which is updated in database, table message is available in BDCMSGCOLL. As BDCMSGCOLL is structure, you need to declare a internal table which can contain multiple records (unlike structure).
Steps for CALL TRANSACTION method
1. Internal table for the data (structure similar to your local file)
2. BDCTAB like BDCDATA
3. UPLOAD or WS_UPLOAD function to upload the data from local file to itab. (Considering file is local file)
4. Loop at itab.
Populate BDCTAB table.
Call transaction <tcode> using <BDCTAB>
Mode <A/N/E>
Update <S/A>.
Refresh BDCTAB.
Endloop.
(To populate BDCTAB, You need to transfer each and every field)
The major differences between Session method and Call transaction are as follows:
SESSION METHOD CALL TRANSACTION
1. Data is not updated in database table unless Session is processed. Immediate updation in database table.
2. No sy-subrc is returned. Sy-subrc is returned.
3. Error log is created for error records. Errors need to be handled explicitly
4. Updation in database table is always synchronous Updation in database table can be synchronous Or Asynchronous.
Error Handling in CALL TRANSACTION
When Session Method updates the records in database table, error records are stored in the log file. In Call transaction there is no such log file available and error record is lost unless handled. Usually you need to give report of all the error records i.e., records which are not inserted or updated in the database table. This can be done by the following method:
Steps for the error handling in CALL TRANSACTION
1. Internal table for the data (structure similar to your local file)
2. BDCTAB like BDCDATA
3. Internal table BDCMSG like BDCMSGCOLL
4. Internal table similar to Ist internal table
(Third and fourth steps are for error handling)
5. UPLOAD or WS_UPLOAD function to upload the data from the local file to itab. (Considering file is local file)
6. Loop at itab.
Populate BDCTAB table.
Call transaction <tr.code> using <Bdctab>
Mode <A/N/E>
Update <S/A>
Messages <BDCMSG>.
Perform check.
Refresh BDCTAB.
Endloop.
7 Form check.
IF sy-subrc <> 0. (Call transaction returns the sy-subrc if updating is not successful).
Call function Format_message.
(This function is called to store the message given by system and to display it along with record)
Append itab2.
Display the record and message.
Check this program for session method using multiple transactions.
Have one BDC_OPEN_GROUP, multiple BDC_INSERT s and one BDC_CLOSE_GROUP.
You should have multiple BDC_INSERT s for multiple transactions.
call function BDC_OPENGROUP.
Build BDC data and cal lBDC_INSERT for transaction 1
Build BDC data and cal lBDC_INSERT for transaction 2
Build BDC data and cal lBDC_INSERT for transaction 3
call function BDC_CLOSE_GROUP.
Check out this sample program
REPORT ztest_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_FFCUST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC = 0.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop
Hope this resolves your query.
Reward all the helpful answers.
Regards -
Dynamical Call of ALV - No data update
Hi,
I tried to use use the ALV dynamically. With dynamically I mean that I that I have diffrent data structures, depending what was selected by the user. The first call of the program is always correct. The data is displayed correctly. But when the data structure is changing, the ALV display is not updated. For a better understanding I post a extract of my coding:
<b>1. Creation of Container</b>
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'PARENT_CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
<b>2.Creation of splitter container</b>
CREATE OBJECT splitter
EXPORTING
parent = g_custom_container
rows = 2
columns = 2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
container_2 = splitter->get_container(
row = 1
column = 2 ).
<b>3.Dynamic Creation of alv object</b>
CREATE OBJECT go_grid
EXPORTING
i_parent = container_2.
<b>4. Get Fieldcatalogue</b>
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = lv_structure_name
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
<b>5. Set table for first display</b>
CALL METHOD go_grid->set_table_for_first_display
* EXPORTING
* i_structure_name = lv_structure_name
CHANGING
it_fieldcatalog = lt_fieldcat
it_outtab = <lt_out_data>.
CALL METHOD ls_alv_ref-alv_ref->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
Perhaps someone could help.....
Best Regards, EdgarHello Edgar
The following sample report <b>ZUS_SDN_TWO_ALV_GRIDS_8</b> shows how to solve your problem. Please note that for the sake of simplicity I replaced the tree containing the structure names with an ALV list. However, the switch between the different structures is triggered by the <b>DOUBLE_CLICK</b> event.
I like to add that the integration of the first displayed ALV list (DD02L) into GT_OUTTAB is not really elegant. In addition, with <b>$TMP</b> I marked a problematic part of the coding with respect to your requirement to have the right layout for each displayed ALV list:
If you have a <b>fixed </b>assignment of <i>tabname -> 4-digit handle</i> then it is ok. I my sample report the layouts only work if you select the tabnames in the very same order.
Before showing the entire coding I describe crucial parts of the coding:
[code]TYPES: BEGIN OF ty_s_outtab.
TYPES: tabname TYPE tabname.
TYPES: layout TYPE lvc_s_layo.
TYPES: variant TYPE disvariant.
TYPES: fcat TYPE lvc_t_fcat.
TYPES: data TYPE REF TO data.
TYPES: END OF ty_s_outtab.[/code]
Every time a new structure is selected the corresponding ALV data are stored as new record in GT_OUTTAB which is of line type TY_S_OUTTAB.
[code] READ TABLE gt_outtab INTO gs_outtab INDEX 2.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.[/code]
Since the ALV list data and the fieldcatalog are fully dynamic I use global field-symbols for these data.
[code]&----
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
SET TITLEBAR 'xxx'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT[/code]
The second ALV list which displays the table records is always newly displayed in the PBO module.
In the event handler method <b>HANDLE_DOUBLE_CLICK</b> we need to do two things:
- store the current fieldcatalog back to GT_OUTTAB
- store the name of the new selected table/structure -> trigger PAI
In routine <b>HANDLE_DB_CLICK</b> we create a new entry for GT_OUTTAB if it does not yet exist. Next we select this entry and display it again as second ALV list.
[code]
*& Report ZUS_SDN_TWO_ALV_GRIDS_8
*& Description: Display two ALV lists in splitter container (left/right)
*& Left ALV list contains DB table names,
*& right ALV list displays entries of selected DB table
*& SDN thread: Dynamical Call of ALV - No data update
*& Link: https:||Dynamical Call of ALV - No data update
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids_8.
TYPE-POOLS: abap.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
TYPES: BEGIN OF ty_s_outtab.
TYPES: tabname TYPE tabname.
TYPES: layout TYPE lvc_s_layo.
TYPES: variant TYPE disvariant.
TYPES: fcat TYPE lvc_t_fcat.
TYPES: data TYPE REF TO data.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gt_dd02l TYPE STANDARD TABLE OF dd02l,
gs_outtab TYPE ty_s_outtab,
gt_outtab TYPE ty_t_outtab.
FIELD-SYMBOLS:
<gt_fcat> TYPE lvc_t_fcat,
<gt_outtab> TYPE table.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_tabname_selected TYPE tabname READ-ONLY.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
define local data
DATA:
ls_dd02l TYPE dd02l,
ls_outtab TYPE ty_s_outtab.
CHECK ( sender = go_grid1 ).
READ TABLE gt_dd02l INTO ls_dd02l INDEX e_row-index.
" Store data of currently displayed ALV list (except for DD02L)
IF ( md_tabname_selected = space ).
ELSE.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY tabname = md_tabname_selected. " old
CALL METHOD go_grid2->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = ls_outtab-fcat.
MODIFY gt_outtab FROM ls_outtab INDEX syst-tabix.
ENDIF.
md_tabname_selected = ls_dd02l-tabname. " new selected DB table
Triggers PAI of the dynpro with the specified ok-code
cl_gui_cfw=>set_new_ok_code( 'HANDLE_DB_CLICK' ). " not 4.6c
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'HANDLE_DB_CLICK'
IMPORTING
RC =
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
gd_repid = syst-repid.
SELECT * FROM dd02l INTO TABLE gt_dd02l
WHERE tabname LIKE 'KN%1' OR
tabname LIKE 'LF%1' OR
tabname LIKE 'VB%' OR
tabname LIKE 'MAR%' OR
tabname LIKE 'E07%'
AND tabclass = 'TRANSP'. " transparent table
SORT gt_dd02l BY tabname.
PERFORM init_controls.
PERFORM add_first_table.
Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
READ TABLE gt_outtab INTO gs_outtab INDEX 1.
Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
CHANGING
it_outtab = gt_dd02l
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE gt_outtab INTO gs_outtab INDEX 2.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.
NOTE: method called in PBO module
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
SET TITLEBAR 'xxx'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = gs_outtab-tabname
is_layout = gs_outtab-layout
is_variant = gs_outtab-variant
i_save = 'A'
CHANGING
it_outtab = <gt_outtab>
it_fieldcatalog = <gt_fcat>
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
User has pushed button "Display Details"
WHEN 'HANDLE_DB_CLICK'.
PERFORM handle_db_click.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form HANDLE_DB_CLICK
text
--> p1 text
<-- p2 text
FORM handle_db_click.
define local data
DATA:
ld_handle(4) TYPE n,
ls_outtab TYPE ty_s_outtab.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
IF ( syst-subrc NE 0 ).
CLEAR: ls_outtab.
ls_outtab-tabname = lcl_eventhandler=>md_tabname_selected.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = ls_outtab-tabname
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = ls_outtab-fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE DATA ls_outtab-data TYPE TABLE OF (ls_outtab-tabname).
ASSIGN ls_outtab-data->* TO <gt_outtab>.
SELECT * FROM (ls_outtab-tabname) UP TO 50 ROWS
INTO TABLE <gt_outtab>.
ls_outtab-layout-no_toolbar = abap_false.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
CONCATENATE ls_outtab-tabname ':'
INTO ls_outtab-layout-grid_title.
CONCATENATE ls_outtab-layout-grid_title 'Table Records'
INTO ls_outtab-layout-grid_title
SEPARATED BY space.
ls_outtab-variant-report = gd_repid.
DESCRIBE TABLE gt_outtab.
ld_handle = syst-tfill + 1.
WRITE ld_handle TO ls_outtab-variant-handle. " $TMP: Problem!!!
APPEND ls_outtab TO gt_outtab.
ENDIF.
" NOTE: read into GLOBAL variable gs_outtab !!!!
READ TABLE gt_outtab INTO gs_outtab
WITH KEY tabname = lcl_eventhandler=>md_tabname_selected.
ASSIGN gs_outtab-fcat TO <gt_fcat>.
ASSIGN gs_outtab-data->* TO <gt_outtab>.
ENDFORM. " HANDLE_DB_CLICK
*& Form INIT_CONTROLS
text
--> p1 text
<-- p2 text
FORM init_controls .
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999 " full-size screen
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 2
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
CALL METHOD go_splitter->set_column_mode
EXPORTING
mode = cl_gui_splitter_container=>mode_relative
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_splitter->set_column_width
EXPORTING
id = 1
width = 25
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_splitter->set_column_sash
EXPORTING
id = 1
type = cl_gui_splitter_container=>type_movable
value = cl_gui_splitter_container=>false
IMPORTING
RESULT =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_left
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form ADD_FIRST_TABLE
text
--> p1 text
<-- p2 text
FORM add_first_table .
define local data
DATA:
ls_outtab TYPE ty_s_outtab.
ls_outtab-tabname = 'DD02L'.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = ls_outtab-tabname
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = ls_outtab-fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GET REFERENCE OF gt_dd02l INTO ls_outtab-data.
ls_outtab-layout-no_toolbar = abap_false.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
CONCATENATE ls_outtab-tabname ':'
INTO ls_outtab-layout-grid_title.
CONCATENATE ls_outtab-layout-grid_title 'Table Records'
INTO ls_outtab-layout-grid_title
SEPARATED BY space.
ls_outtab-variant-report = gd_repid.
ls_outtab-variant-handle = '0002'.
INSERT ls_outtab INTO gt_outtab INDEX 1.
ls_outtab-layout-no_toolbar = abap_true.
ls_outtab-layout-zebra = abap_true.
ls_outtab-layout-smalltitle = abap_true.
ls_outtab-layout-grid_title = 'DB Tables'.
ls_outtab-variant-report = gd_repid.
ls_outtab-variant-handle = '0001'.
DELETE ls_outtab-fcat WHERE ( fieldname NE 'TABNAME' ).
INSERT ls_outtab INTO gt_outtab INDEX 1.
ENDFORM. " ADD_FIRST_TABLE[/code]
Regards,
Uwe
Maybe you are looking for
-
Adobe premiere CS6 error The application was unable to start correctly (0xc000007b)
I've googled this problem and followed instructions that I've found online as far as uninstalling and re-installing I've also cleaned the registry but this problem persists.
-
Stop Sharing Process And Restart Final Cut Pro X
Hello, i am pretty new to Final Cut Pro X. I have created and edited a video file in it. Now i am going to share it using Master File option. My question is that when the sharing process starts, which i can see in the background tasks option, is ther
-
Redetermine the VAT rate after item copy
Hello everyone, [Background] I am in a project which is for VAT rate change. We implement a new condition BADI to reset Price_date in the communication structure to change the tax date. In the BADI we mapped varies date types(Such as Sales date) to P
-
Hi Friends, Iam uploading xml data file. For xml data uplodation we need info cube or not? If no info cube means from where data store? In info package iam not getting data selection path. How to upload xml file?plz help me Thanks&Regards RaMya
-
After uodating Phtoshop yesterday, it does not work anymore. Program does not respomd