How to implement a Xalan extension element
I need an extension for Xalan to create URLs and anchors, as for example like:
<link>/this/is/some/url.html</link>
or
<link href="/this/is/some/url.html"><img src="/some/image.jpg"/></link>
Since the link extension should support to have further nodes as it's content, I thought it is a good idea to implement an extension element that returns a Node or an Element.
My problem is that I don't know how to create a new Nodeand add it to the stylesheet.
The Xalan objects throw an UnsupportedOperationException when I call createElement on the context or extension call element. Same for importNode when I create a new Node from another document instead.
What I could also do is to write an extension function that returns a string. But then I dont know how to use context.transformToString properly, because I want the sub-elements to be also transformed.
Any suggestions?
Dominik
Hi Dominik,
I'm not 100% sure, but I think the problem is the following:
According to the XSLT processing model the input document shoud be immulable.
So if you write a Java method which has a Node as a parameter you must not manipulate this node.
To do it nonetheless you might create a new Document and call importNode on the new document (Node editableNode = newDoc.importNode(immutableNode);). Then you can edit the new node and return it as you like.
But I'm afraid it is not possible (again due to the processing model) to have your stylesheet to process this newly created elements in the same transformation.
Best Wishes
esprimo
Edited by: esprimo on Sep 1, 2008 6:17 AM
Similar Messages
-
How to implement the filedownload UI Element as table cell editor
hi guyes,
now i want to add the filedownload ui element in the table. i choose to apply template to insert table and bind the table to a Model Node . should i build a attribute of binary in the model node and bind it to filedownload ui element? when i
do the above , in the "table binding wizard" what should i choose under the colum of " binding property"? can any body send me the same example code to me?
e-mail address:[email protected]
Thanks A Million !Hi
Exactly to your requirement
<b>Tutorial</b> https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982cb83f
<b>Forum Thread</b> 2004s file download (how to not store files in context?)
Regards
Abhijith YS -
Xalan: extension element, evaluating xsl:attribute in an extension
Hi,
Can I evaluate in an extension method of an extension class an <xsl:attribute ... ?
for example in:
<test:layout figure="rectangle" >
<xsl:attribute name="color"><xsl:value-of select="$var1" /></xsl:attribute>
</test:layout>
having Test as the extension class, and "layout" the corresponding method, I need to evaluate attribute "color", I have test it and when Test.layout is called it does'nt has color attribute, is there any way to evaluate the <xsl:attribute ... expression to access the value of color ?
thanks for any help.Hi, I found the answer, and here it is for any body with same dude:
String attrExpr = ((ElemExtensionCall)elem).getAttribute ( "color", context.getContextNode(), context.getTransformer() );
org.apache.xpath.XPathContext xctxt = context.getTransformer().getXPathContext();
XPath myxpath = new XPath(attrExpr, elem, xctxt.getNamespaceContext(), XPath.SELECT);
XObject xobj = myxpath.execute(xctxt, context.getContextNode(), elem);
return xobj.str(); // this is the value of the attribute.
in xslt: <test:entension1 color="@Attr" /> or any other xPath
I found it at Redirect.java
thanks to you all. -
Xalan: nesting transformations via extension element
Hi,
I'm doing XSLT transformations using xalan to get HTML, I have an extension element and a java class to do it, the corresponding method of this class, applies another tranformation and wants to return this result to the transformation result tree, I have this situation several times, in fact I have a tree of nested transformations this way to get a finally HTML. Well, here is the problem:
the methods of the class (of the extension) returns a Document, and the result is so strange (at least for me), it does not include any attributes, just the elements: e.g. when xslt says <table width="100%" border="0" height="100%" cellpadding="0" cellspacing="0">, result only says <table>.
Can anyone help me please?
thanks.here is a short of the context:
//sample xslt.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rwfa="xalan://rwfa.client.NSHandler"
extension-element-prefixes="rwfa" >
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<table width="100%" border="0" height="100%" cellpadding="0" cellspacing="0">
<tr height="100%">
<td width="200" bgcolor="#AE0C0C" valign="top" style="width:200;" nowrap="true">
<rwfa:client />
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
//extension class.
public class NSHandler {
public Document client(org.apache.xalan.extensions.XSLProcessorContext context, org.w3c.dom.Element elem) {
// (1) create a new document
Document doc = newDocument();
// parse an xml document
Source xml = getXML();
// creates a new transformer based on an xslt like the above
// but with another (or just without any) element from the rwfa namespace.
Transformer transformer = getTransformer();
// creates a Result descendent based on the document (1)
Result result = new DOMResult( doc );
// set some output properties
transformer.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "yes" );
transformer.setOutputProperty( OutputKeys.METHOD, "html" );
transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
transformer.setOutputProperty( OutputKeys.ENCODING, "ISO-8859-1" );
//apply the transformation
transformer.transform(xml, result);
//debuging, here de doc is full, e.g. it has all attributes for every element.
return doc;
//but in the whole result, inner tranformation's elements appear without any attribute,
//only the most external tranformation seems to be full. -
How to implement extension for a mara table
Hi All,
Recently we appended mara table with couple of fields. But in order to make use of these two fields in all bapis and other functions how to add these fields to those bapis (i mean how to make extensions). Some where i read that we have to add these fields to BAPIPAREX. Can some body explain how to implement extensions.
ThanksActually i added these two fields to bapi_te_mara. But how this structure will be used in bapis with the help of extension in and extensionX tables in the bapi or example bapi_material_savedata.
-
Howto include external document from Xalan extension?
Hi,
I'm trying to include an external XML document via the document() function,
but I can't seem to get it to work. The catch is that the external document is
created by a Xalan extension function.
My code is as below. The code in the extension class is successfully executed.
However, when I run the transformation, I keep getting a
java.lang.ArrayIndexOutOfBoundsException. Does anyone know what's going
wrong?
Regards, Ronald Wildenberg.
Style sheet:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cpb="builders.CpbBuilderFunctions" extension-element-prefixes="cpb">
<xsl:template match="/">
<xsl:copy-of select="cpb:test()"/>
</xsl:template>
</xsl:stylesheet>Java code:
public class CpbBuilderFunctions {
public static Document test() {
try {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader("")));
System.out.println("Successfully returning!");
return document;
catch (Throwable e) {
e.printStackTrace();
return null;
}Ok, I tried again to implement this after the weekend and now it all works. Very nice of course, but I don't know what went wrong before. But this item can be considered closed :)
-
How do you install JAXP extensions from an applet?
All:
I want to use the JAXP XML parsers and DOM services in an Applet.
How do I get the Java-plugin to download the xerces.jar and xalan.jar files automatically, with my applet jar?
What goes in the applet manifest?
Do I have to alter the xerces and xalan manifests?
BradThanks, but I wish I could report success today.
I believe what I stated before may have been confusing: the extension LIST is, indeed, in the manifest of the applet.jar.
The extension NAMES, and digital signatures, however, are ALSO in the manifest of xerces.jar. I re-read and re-read the documentation and believe I have interpreted it correctly. The xerces.jar is the implementation of the extension, and as such, must pass muster, securitywise, if it is to be allowed to be installed in the jre\lib\ext folder.
You are correct in saying I do not have to unjar the xerces.jar to rebuild it with the correct manifest information. The latest jar tool permits updating an existing jar file. Here is the bat file I currently use to create the installable version of xerces.jar:
copy Original-xerces.jar xerces.jar
jar -ufm xerces.jar manifest.txt
jarsigner -keystore d:\develop\beckrose\java\keystores\underground.keystore xerces.jar underground
(it then prompts for password)
The manifest.txt that is used to update xerces.jar is:
Manifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)
Name: javax/xml/parsers/
Extension-Name: javax.xml.parsers
Specification-Vendor: Sun Microsystems Inc.
Specification-Version: 1.2
Implementation-Vendor: Sun Microsystems Inc.
Implementation-Vendor-Id: com.sun
Implementation-Version: 1.2.0-EA1
Name: org/apache/xerces
Extension-Name: org.apache.xerces
Specification-Vendor: Sun Microsystems Inc.
Specification-Version: 1.2
Implementation-Vendor: Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: Xerces-J_2_0_0_beta3
The manifest file in the applet.jar refers to these extensions, so that the java plugin knows how and where to fetch them:
Extension-List: parsers xerces
parsers-Extension-Name: javax.xml.parsers
parsers-Specification-Version: 1.2
parsers-Implementation-Vendor-Id: com.sun
parsers-Implementation-Version: 1.2.0-EA1
parsers-Implementation-URL: http://beckrose:8080/underground/opt-pkg/xerces.jar
xerces-Extension-Name: org.apache.xerces
xerces-Specification-Version: 1.2
xerces-Implementation-Vendor-Id: org.apache
xerces-Implementation-Version: Xerces-J_2_0_0_beta3
xerces-Implementation-URL: http://beckrose:8080/underground/opt-pkg/xerces.jar
If you look back at the error message, it does appear that the jaxp factory method is looking for a concrete class of the factory implementation. I believe this is where the plug-in is getting confused. The name of the concrete factory classes are in the META-INF/services folder. However, the concrete factory implementation that it is trying to use is the old crimson parser by default.
In other words, the plugin is not allowing the xerces factory method to find the classname to load. As a result, it is falling back to the default, which is not implemented in the jar file.
Now, it could be that the added manifest attributes and signature file are screwing up xerces or it could be a bug in the plugin.
I don't quite know where to take this right now, so I'll monitor the plugin discussions and check out the xml.apache.org discussions.
All I know is, it should NOT be this hard, this many years after Java 2 has been released.
Brad -
Hello!
I'm trying to create a kind of a navigation tree for my application.
It should represent some elements of an XML structure and some other nodes for other options.
The binding with the context is not a problem, I can create the tree up to all the levels I want to.
The problem now is, that I don't know, how to get the "current tree element", when there is any action.
For example:
public void onActionSelect(...) {
String test = wdContext.currentTreeNodeElement().getText();
wdThis.wdGetContext().currentContextElement().setSelectedElement(test);
With this method I can get the text of the "first level nodes". If I want to get the "second level node", I can do
String test = wdContext.currentTreeNodeElement().currentChildElement.getText();
..and for the next levels so on.
Isn't there any general method to get the information of the selected element without knowing before, whether it is a nodeElement or a nodeElement.currentChildElement or a nodeElement.currentChildElement.currentChildElement, ...?
Greetings,
RamóHi,
if you following that pdf ,
i think your not implemented the below code in DomodifyView method
if (firstTime) {
IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TheNode");
/* The following line is necessary to create parameter mapping from parameter "path" to parameter "selectedElement".
Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
that raised the onAction event. Parameter "selectedElement" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
that handles the onAction. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
be accessed within the event handler
treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
/* The following line is necessary to create parameter mapping from parameter "path" to parameter "element".
Parameter "path" is of type string and contains the string representation of the tree element (its corresponding context element to be exact)
that raised the onLoadChildren event. Parameter "element" is of type IWDNodeElement (or extends it) and is defined as parameter in the event handler
that handles the onLoadChildren. The parameter mapping defined here translates the String "path" into the corresponding context element that then can
be accessed within the event handler
treeNode.mappingOfOnLoadChildren().addSourceMapping("path", "element");
please cross check once.
Thanks,
Ramesh -
How to assign and transform or how to deal with xsd:anyType elements in 10g
Hi,
Any Update on this please...
Hi,
we are using canonical model as part of 10g, here I am not able to assign or tranform elements of type xsd:anyType to/from to other type elements. Solution with an example and quick reply is appreciated.
=========================================
Hi,
By using copy-of xslt construct again input element structure is getting copied into the target mapper file, by using value-of xsl:construct just the value is getting assigned. Can you please elaborate on how to use this xsd:anyType elements in assign and tranform activities, overall how to use these elements in 10g, while implementing the canonical model.
ex:
xsl file: by using value-of
<xsl:template match="/">
<ns1:abstractRef>
<ns1:amount>
<xsl:value-of select="/ns1:BPELProcess1ProcessRequest/ns1:input"/>
</ns1:amount>
</ns1:abstractRef>
</xsl:template>
Result:
<abstract1>
-<abstractRef xmlns:ns1="http://xmlns.oracle.com/BPELProcess1" xmlns="http://sample/test">
<ns1:amount>6556</ns1:amount>
</abstractRef>
</abstract1>
Here amount is of type xsd;anyType which is present in the abstract complexType.
xsl file: by using copy-of:
<xsl:template match="/">
<ns1:abstractRef>
<ns1:amount>
<xsl:copy-of select="/ns1:BPELProcess1ProcessRequest/ns1:input"/>
</ns1:amount>
</ns1:abstractRef>
</xsl:template>
Result:
<abstract1>
-<abstractRef xmlns:ns1="http://xmlns.oracle.com/BPELProcess1" xmlns="http://sample/test">
<ns1:amount>
<ns1:input>6556</ns1:input>
</ns1:amount>
</abstractRef>
</abstract1>
and while using it on assign activity, it is not assigning the input value to the xsd:anyType element, please provide an example on how to do this activity along with tranform.
Edited by: user12679330 on Mar 1, 2010 4:46 AM>
Try bpelx:append as a copy rule.
>
Since this thread is over three years old it will be interesting to see if OP is still waiting for a reply. ;) -
How to implement this? please help
In my java class, I have a string array called strarray which hold serveral elements, some of the elements have the same value , for example, the first element is "swimming", the forth element is also swimming. I use a for loop to get each element and give it to arrayHolder which is also a array with the same size as strarray. Now, what I want is: I defined a Vector called element I want this vector to filter out the element from arrayHolder, get the name of non-duplicated name from the arrayHolder, the result should be inside the element vector (swimming,walking,running,dancing), no duplicated name. My code is like follows:
import java.util.*;
import java.io.*;
public class arrayTest{
public static void main(String arg[]){
String[] strarray={"swimming","running","walking","swimming","dancing","running"};
String[] arrayHolder=new String[strarray.size];
Vector element=new Vector();
for(int i=0;i<strarray.length();i++){
arrayHolder[ i ]=strarray[ i ];
/* What should I do next to get the non-duplicated element from arrayHolder and
* add them into the element vector????
I did not finnish it, since I am a little bit confused, how to implement? Need some help. thanks.
Message was edited by:
MellonNot sure if I see the use of strArray & arrayHolder (I've not looked at your code - you might use code tags next time (check the "code" button above the message textarea), but may I suggest using a Map of some sort instead of a Vector? It will prevent duplicates for you.
Good Luck
lee -
How to use the FormDownload UI element?
Hi,
I am a newbie in ABAP Webdynpro and I want to know how to use the FormDownload UI Element. Any hints plz? Thanks in advance.Hi,
I used CONVERT_OTF FM to convert the otf data to pdf data. In my form user has the option to view the smartform (a button) or to directly download the pdf from smartform output without displaying the output. While the former has been taken care of by using InteractiveForm UI element and is displaying the smartform output fine, I am not being able to implement the second option. I have given a supply function to the pdfsource context node but am clueless about what to write to pass pdf data. In the sam WD component WDR_TEST_EVENTS, the FileDownload is used to save a text file with just one line. But how can I save a pdf file? I have assigned mime to application/pdf. How will I proceed now? Please suggest. Thanks in advance. -
How to Implement HTTP Request Status Code Processing
I actually have two questions. First, I wondering how to add multiple status code processing to an http request. Secondly, I was wondering how to go about using alternate http requests to different servers in case the primary server is down. What kind of parameter would the program use to determine that the server is unavailable and switch to another server??
Currently, the program I've written calls an rdf server (http://www.rdfabout.com/sparql) using a sparql query,
the server returns an xml string, the program parses it, and calculates numbers
from the string. The program works, but the problem is that the server is down occasionally.
When the server is down, we need to add calls to another server to
increase reliability. So, the next task is to call this server:
http://www.melissadata.com/lookups/ZipDemo2000.asp
I need to do exactly the same things I did with the rdf server. The
difference will be constructing a request and a bit different parsing of
the response.
current SPARQL query is defined as follows:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX census: <http://www.rdfabout.com/rdf/schema/census/>
PREFIX census1: <tag:govshare.info,2005:rdf/census/details/100pct/>
DESCRIBE ?table WHERE {
<http://www.rdfabout.com/rdf/usgov/geo/census/zcta/90292> census:details
?details .
?details census1:totalPopulation ?table .
?table dc:title "SEX BY AGE (P012001)" .
}current HTTP Request is defined as follows:
import java.net.*;
import java.net.URL;
import java.net.URLConnection;
import java.io.*;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.StringReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Arrays;
public class MyConnection
static Scanner sc = new Scanner(System.in);//allows user to input zipcode
public static void main(String[] args) throws Exception
int zip;//zipcode is declared as integer format
//User defines zip through input
//proceed to put SPARQL query into string, which is then used to call the server
String requestPart1 =
"query=PREFIX+dc%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+%0D%0APREFIX+census%3A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fschema%2Fcensus%2F%3E+%0D%0APREFIX+census1%3A+%3Ctag%3Agovshare.info%2C2005%3Ardf%2Fcensus%2Fdetails%2F100pct%2F%3E+%0D%0A%0D%0ADESCRIBE+%3Ftable+WHERE+%7B+%0D%0A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fusgov%2Fgeo%2Fcensus%2Fzcta%2F";
String requestPart2 = "" + zip; // zipcode is transformed from int to string format and plugged into SPARQL query here
String requestPart3 =
"%3E+census%3Adetails+%3Fdetails+.+%0D%0A+%3Fdetails+census1%3AtotalPopulation+%3Ftable+.+%0D%0A+%3Ftable+dc%3Atitle+%22SEX+BY+AGE+%28P012001%29%22+.+%0D%0A%7D%0D%0A&outputMimeType=text%2Fxml";
String response = "";
URL url = new URL("http://www.rdfabout.com/sparql");//designates server to connect to
URLConnection conn = url.openConnection();//opens connection to server
// Set connection parameters.
conn.setDoInput (true);
conn.setDoOutput (true);
conn.setUseCaches (false);
// Make server believe we are form data
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
DataOutputStream out = new DataOutputStream (conn.getOutputStream ());
// Write out the bytes of the content string to the stream.
out.writeBytes(requestPart1 + requestPart2 + requestPart3);
out.flush ();
out.close ();
// Read response from the input stream.
BufferedReader in = new BufferedReader (new InputStreamReader(conn.getInputStream ()));
String temp;
while ((temp = in.readLine()) != null)
response += temp + "\n";
temp = null;
in.close ();
//parsing stuff is taken care of after here
}What remains now is to:
1) add status code processing: notify if the server is not available, ect.
2) add ability to connect to additional server if primary server is down.
I'm thinking an if/else statement, which I've tried a few different ways,
but I don't quite know how to implement that...Also trying to add the
status code processing/error handling, but I'm not sure how to do that
for multiple/different errors, such as 404, 503, 504, ect.. try/catch statements?
So yeah, just been scratching my head on this trying to figure out how to work it..
If you can help me out on this, I've been going nuts trying to figure this out...I think your issue comes form the fact that you are not casting URLConnection to HttpURLConnection.
Doing the cast would allow you to use getResponseCode() - among other methods - and test for a response different than 200.
Read: [http://mindprod.com/jgloss/urlconnection.html|http://mindprod.com/jgloss/urlconnection.html] -
How to implement wafer mapping using LabVIEW?
Hello LabVIEW Masters!
I am having an incoming project which includes controlling and gathering information from a PROBER. One of the difficulties I am having now is how to implement a WAFER MAP using LabVIEW. According to my customer requirements, the wafer element ranges from 6k to 23k. I guess doing all the element (one die = one led ctl/indicator) will be a hell of a task, especially on how to effectively manipulate each elements. Does anyone have better idea on how to this?
Please, I badly need your help..
Thanks and Regards,
Dennis DG
Solved!
Go to Solution.Hi Dennis,
Is it okay if you send to me the working VI also?
No, it's not ok. I made that program for my customer...
As I am not too familiar in using intensity graph.
That's no reason to hand over programs for free...
My customer also request me that if the cursor hover on the wafer map, he wants the x,y corrdinates to be displayed.
I also have such a feature. Did you notice the little yellow cursor near the center of the wafer? One could easily change that to use a MouseMove event instead...
He also wants to select some elements in the wafer map and come up with the coordinate values to do some testing.
That's related to the cursor thing...
Some points:
- You have a customer that pays you. Why should I offer work for free?
- You can send me contact dates of your customer, I will make him an offer...
- When you take an job to provide software you should be able to code the software...
- The VI(s) are now some years old. I didn't code so well back those days and don't want to hand out those VIs as they are right now.
- I included some "license management" deep inside that program, I would have to remove this and spend time on testing afterwards...
- The VIs are based on the PROBER output format used by the customer. All the file handling has to be changed for/by you...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to implement classes with alv's
hi
how to implement classes with alv'sHi Jyotsna,
check this example codes.
*"Table declarations...................................................
TABLES:
EKKO, " Purchasing Document Header
CDHDR, " Change document header
SSCRFIELDS. " Fields on selection screens
*"Selection screen elements............................................
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
S_EKGRP FOR EKKO-EKGRP, " Purchasing group
S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
S_UDATE FOR CDHDR-UDATE. " Creation date of the change
" document
*" Data declarations...................................................
Field String to hold Purchase Document Number *
DATA:
BEGIN OF FS_EBELN,
EBELN(90) TYPE C, " Purchase Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
" the Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EBELN,
Field String to hold Purchase Document Header *
BEGIN OF FS_EKKO,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
END OF FS_EKKO,
Field String to hold Account Number and name of the Vendor *
BEGIN OF FS_LFA1,
LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
NAME1 TYPE LFA1-NAME1, " Name1
END OF FS_LFA1,
Field String to hold Change date and the name of the user *
BEGIN OF FS_CDHDR,
OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
OBJECTID TYPE CDHDR-OBJECTID, " Object value
CHANGENR TYPE CDHDR-CHANGENR, " Document change number
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
END OF FS_CDHDR,
Field String to hold Change document items *
BEGIN OF FS_CDPOS,
OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
OBJECTID(10) TYPE C, " Object Value
CHANGENR TYPE CDPOS-CHANGENR, " Document change number
TABNAME TYPE CDPOS-TABNAME, " Table Name
FNAME TYPE CDPOS-FNAME, " Field Name
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_CDPOS,
Field String to hold Date Element Name *
BEGIN OF FS_DATAELE,
TABNAME TYPE DD03L-TABNAME, " Table Name
FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
END OF FS_DATAELE,
Field String to hold Short Text of the Date Element *
BEGIN OF FS_TEXT,
ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
END OF FS_TEXT,
Field String to hold data to be displayed on the ALV grid *
BEGIN OF FS_OUTTAB,
EBELN TYPE EKKO-EBELN, " Purchasing Document Number
ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
" Object
LIFNR TYPE EKKO-LIFNR, " Vendor's account number
EKGRP TYPE EKKO-EKGRP, " Purchasing group
BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
WERKS TYPE LFA1-WERKS, " Plant
NAME1 TYPE LFA1-NAME1, " Name1
USERNAME TYPE CDHDR-USERNAME, " User name
UDATE TYPE CDHDR-UDATE, " Creation date of the change
" document
DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
" Repository Objects
VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
END OF FS_OUTTAB,
Internal table to hold Purchase Document Number *
T_EBELN LIKE STANDARD TABLE
OF FS_EBELN,
Internal table to hold Purchase Document Header *
T_EKKO LIKE STANDARD TABLE
OF FS_EKKO,
Temp Internal table to hold Purchase Document Header *
T_EKKO_TEMP LIKE STANDARD TABLE
OF FS_EKKO,
Internal table to hold Account number and Name of the Vendor *
T_LFA1 LIKE STANDARD TABLE
OF FS_LFA1,
Internal Table to hold Change date and the name of the user *
T_CDHDR LIKE STANDARD TABLE
OF FS_CDHDR,
Internal Table to hold Change document items *
T_CDPOS LIKE STANDARD TABLE
OF FS_CDPOS,
Temp. Internal Table to hold Change document items *
T_CDPOS_TEMP LIKE STANDARD TABLE
OF FS_CDPOS,
Internal Table to hold Data Element Name *
T_DATAELE LIKE STANDARD TABLE
OF FS_DATAELE,
Temp. Internal Table to hold Data Element Name *
T_DATAELE_TEMP LIKE STANDARD TABLE
OF FS_DATAELE,
Internal Table to hold Short Text of the Date Element *
T_TEXT LIKE STANDARD TABLE
OF FS_TEXT,
Internal Table to hold data to be displayed on the ALV grid *
T_OUTTAB LIKE STANDARD TABLE
OF FS_OUTTAB.
C L A S S D E F I N I T I O N *
CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
*" Data declarations...................................................
Work variables *
DATA:
W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
W_VALUE TYPE EKKO-EBELN, " Reflected Value
W_SPACE VALUE ' ', " Space
W_FLAG TYPE I, " Flag Variable
W_VARIANT TYPE DISVARIANT, " Variant
ALV Grid
W_GRID TYPE REF TO CL_GUI_ALV_GRID,
Event Handler
W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
Field catalog table
T_FIELDCAT TYPE LVC_T_FCAT.
AT SELECTION-SCREEN EVENT *
AT SELECTION-SCREEN ON S_EBELN.
Subroutine to validate Purchase Document Number.
PERFORM VALIDATE_PD_NUM.
AT SELECTION-SCREEN ON S_LIFNR.
Subroutine to validate Vendor Number.
PERFORM VALIDATE_VEN_NUM.
AT SELECTION-SCREEN ON S_EKGRP.
Subroutine to validate Purchase Group.
PERFORM VALIDATE_PUR_GRP.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
Subroutine to select all Purchase orders.
PERFORM SELECT_PO.
CHECK W_FLAG EQ 0.
Subroutine to select Object values.
PERFORM SELECT_OBJ_ID.
CHECK W_FLAG EQ 0.
Subroutine to select Changed values.
PERFORM SELECT_CHANGED_VALUE.
CHECK W_FLAG EQ 0.
Subroutine to Select Purchase Orders.
PERFORM SELECT_PUR_DOC.
Subroutine to select Vendor Details.
PERFORM SELECT_VENDOR.
Subroutine to select Text for the Changed values.
PERFORM DESCRIPTION.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
IF NOT T_EKKO IS INITIAL.
Subroutine to populate the Output Table.
PERFORM FILL_OUTTAB.
Subroutine to build Field Catalog.
PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
CALL SCREEN 100.
ENDIF. " IF NOT T_EKKO...
CLASS LCL_EVENT_HANDLER DEFINITION
Defining Class which handles events
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION
Implementing the Class which can handle events
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
*---Handle Double Click
METHOD HANDLE_HOTSPOT_CLICK .
Subroutine to get the HotSpot Cell information.
PERFORM GET_CELL_INFO.
SET PARAMETER ID 'BES' FIELD W_VALUE.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. " HANDLE_HOTSPOT_CLICK
ENDCLASS. " LCL_EVENT_HANDLER
*& Module STATUS_0100 OUTPUT
PBO Event
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'OOPS'.
SET TITLEBAR 'TIT'.
Subroutine to fill the Variant Structure
PERFORM FILL_VARIANT.
IF W_GRID IS INITIAL.
CREATE OBJECT W_GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CL_GUI_CONTAINER=>SCREEN0
I_APPL_EVENTS =
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
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. " IF SY-SUBRC 0
CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT = W_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = T_OUTTAB
IT_FIELDCATALOG = T_FIELDCAT
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
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. " IF SY-SUBRC 0.
ENDIF. " IF W_GRID IS INITIAL
CREATE OBJECT W_EVENT_CLICK.
SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
PAI Event
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form PREPARE_FIELD_CATALOG
Subroutine to build the Field catalog
<--P_T_FIELDCAT Field Catalog Table
FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
DATA LS_FCAT TYPE LVC_S_FCAT.
Purchasing group...
LS_FCAT-FIELDNAME = 'EKGRP'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Number...
LS_FCAT-FIELDNAME = 'EBELN'.
LS_FCAT-REF_TABLE = 'EKKO' .
LS_FCAT-EMPHASIZE = 'C411'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-HOTSPOT = 'X'.
APPEND LS_FCAT TO PT_FIELDCAT .
CLEAR LS_FCAT .
Name of Person who Created the Object...
LS_FCAT-FIELDNAME = 'ERNAM'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-OUTPUTLEN = '15' .
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Purchasing Document Date...
LS_FCAT-FIELDNAME = 'BEDAT'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Vendor's account number...
LS_FCAT-FIELDNAME = 'LIFNR'.
LS_FCAT-REF_TABLE = 'EKKO'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Account Number of Vendor or Creditor...
LS_FCAT-FIELDNAME = 'NAME1'.
LS_FCAT-REF_TABLE = 'LFA1'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Vendor Name'(001).
LS_FCAT-SELTEXT = 'Vendor Name'(001).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Creation date of the change document...
LS_FCAT-FIELDNAME = 'UDATE'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Change Date'(002).
LS_FCAT-SELTEXT = 'Change Date'(002).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
User name of the person responsible in change document...
LS_FCAT-FIELDNAME = 'USERNAME'.
LS_FCAT-REF_TABLE = 'CDHDR'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '10'.
LS_FCAT-COLTEXT = 'Modified by'(003).
LS_FCAT-SELTEXT = 'Modified by'(003).
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Short Text Describing R/3 Repository Objects...
LS_FCAT-FIELDNAME = 'DDTEXT'.
LS_FCAT-REF_TABLE = 'DD04T'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '15'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
Old contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_OLD'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
New contents of changed field...
LS_FCAT-FIELDNAME = 'VALUE_NEW'.
LS_FCAT-REF_TABLE = 'CDPOS'.
LS_FCAT-INTTYPE = 'C'.
LS_FCAT-OUTPUTLEN = '12'.
APPEND LS_FCAT TO PT_FIELDCAT.
CLEAR LS_FCAT.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form SELECT_PO
Subroutine to select all the Purchase Orders
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PO .
SELECT EBELN " Purchasing Document Number
ERNAM " Name of Person who Created
" the Object
LIFNR " Vendor's account number
EKGRP " Purchasing group
BEDAT " Purchasing Document Date
FROM EKKO
PACKAGE SIZE 10000
APPENDING TABLE T_EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S401(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDFORM. " SELECT_PO
*& Form SELECT_OBJ_ID
Subroutine to select Object ID
There are no interface parameters to be passed to this subroutine.
FORM SELECT_OBJ_ID .
IF NOT T_EBELN IS INITIAL.
SELECT OBJECTCLAS " Object Class
OBJECTID " Object value
CHANGENR " Document change number
USERNAME " User name
UDATE " Creation date
FROM CDHDR
INTO TABLE T_CDHDR
FOR ALL ENTRIES IN T_EBELN
WHERE OBJECTID EQ T_EBELN-EBELN
AND UDATE IN S_UDATE
AND TCODE IN ('ME21N','ME22N','ME23N').
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Header Not Found'(031).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EBELN IS INITIAL
ENDFORM. " SELECT_OBJ_ID
*& Form SELECT_CHANGED_VALUE
Subroutine to select Changed Values
There are no interface parameters to be passed to this subroutine.
FORM SELECT_CHANGED_VALUE .
IF NOT T_CDHDR IS INITIAL.
SELECT OBJECTCLAS " Object class
OBJECTID " Object value
CHANGENR " Document change number
TABNAME " Table Name
FNAME " Field Name
VALUE_NEW " New contents of changed field
VALUE_OLD " Old contents of changed field
FROM CDPOS
PACKAGE SIZE 10000
APPENDING TABLE T_CDPOS
FOR ALL ENTRIES IN T_CDHDR
WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
AND OBJECTID EQ T_CDHDR-OBJECTID
AND CHANGENR EQ T_CDHDR-CHANGENR.
ENDSELECT.
IF SY-SUBRC NE 0.
W_FLAG = 1.
MESSAGE S833(M8) WITH 'Item Not Found'(032).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_CDHDR IS INITIAL
T_CDPOS_TEMP] = T_CDPOS[.
ENDFORM. " SELECT_CHANGED_VALUE
*& Form SELECT_PUR_DOC
Subroutine to select Purchase Order Details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_PUR_DOC .
IF NOT T_CDPOS IS INITIAL.
SORT T_EBELN BY EBELN.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
FS_CDPOS-OBJECTID BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE TABLE T_EBELN FROM FS_EBELN.
ENDIF. " IF SY-SUBRC NE 0.
ENDLOOP. " LOOP AT T_CDPOS...
LOOP AT T_EBELN INTO FS_EBELN.
MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
APPEND FS_EKKO TO T_EKKO.
ENDLOOP. " LOOP AT T_EBELN...
T_EKKO_TEMP] = T_EKKO[.
ENDIF. " IF NOT T_CDPOS IS INITIAL
ENDFORM. " SELECT_PUR_DOC
*& Form SELECT_VENDOR
Subroutine to select Vendor details
There are no interface parameters to be passed to this subroutine.
FORM SELECT_VENDOR .
IF NOT T_EKKO IS INITIAL.
SORT T_EKKO_TEMP BY LIFNR.
DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
SELECT LIFNR " Account Number of Vendor or
" Creditor
NAME1 " Name 1
FROM LFA1
INTO TABLE T_LFA1
FOR ALL ENTRIES IN T_EKKO_TEMP
WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
IF SY-SUBRC NE 0.
MESSAGE S002(M8) WITH 'Master Details'(033).
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_EKKO IS INITIAL
ENDFORM. " SELECT_VENDOR
*& Form DESCRIPTION
Subroutine to get the description
There are no interface parameters to be passed to this subroutine.
FORM DESCRIPTION .
IF NOT T_CDPOS IS INITIAL.
SORT T_CDPOS_TEMP BY TABNAME FNAME.
DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
SELECT TABNAME " Table Name
FIELDNAME " Field Name
ROLLNAME " Data element
FROM DD03L
INTO TABLE T_DATAELE
FOR ALL ENTRIES IN T_CDPOS_TEMP
WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
IF NOT T_DATAELE IS INITIAL.
T_DATAELE_TEMP] = T_DATAELE[.
SORT T_DATAELE_TEMP BY ROLLNAME.
DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
SELECT ROLLNAME " Data element
DDTEXT " Short Text Describing R/3
" Repository Objects
FROM DD04T
INTO TABLE T_TEXT
FOR ALL ENTRIES IN T_DATAELE_TEMP
WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
AND DDLANGUAGE EQ SY-LANGU.
IF SY-SUBRC NE 0.
EXIT.
ENDIF. " IF SY-SUBRC NE 0.
ENDIF. " IF NOT T_DATAELE IS INITIAL.
ENDIF. " IF NOT T_CDPOS IS INITIAL.
ENDFORM. " DESCRIPTION
*& Form FILL_OUTTAB
Subroutine to populate the Outtab
There are no interface parameters to be passed to this subroutine.
FORM FILL_OUTTAB .
SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
SORT T_EKKO BY EBELN.
SORT T_LFA1 BY LIFNR.
SORT T_DATAELE BY TABNAME FIELDNAME.
SORT T_TEXT BY ROLLNAME.
LOOP AT T_CDPOS INTO FS_CDPOS.
READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
OBJECTCLAS = FS_CDPOS-OBJECTCLAS
OBJECTID = FS_CDPOS-OBJECTID
CHANGENR = FS_CDPOS-CHANGENR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
READ TABLE T_EKKO INTO FS_EKKO WITH KEY
EBELN = FS_CDHDR-OBJECTID
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
LIFNR = FS_EKKO-LIFNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
TABNAME = FS_CDPOS-TABNAME
FIELDNAME = FS_CDPOS-FNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
READ TABLE T_TEXT INTO FS_TEXT WITH KEY
ROLLNAME = FS_DATAELE-ROLLNAME
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF. " IF SY-SUBRC EQ 0.
APPEND FS_OUTTAB TO T_OUTTAB.
CLEAR FS_OUTTAB.
ENDLOOP.
ENDFORM. " FILL_OUTTAB
*& Form GET_CELL_INFO
Subroutine to get the Cell Information
--> W_VALUE Holds the value of Hotspot clicked
FORM GET_CELL_INFO .
CALL METHOD W_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW =
E_VALUE = W_VALUE
E_COL =
ES_ROW_ID =
ES_COL_ID =
ES_ROW_NO =
ENDFORM. " GET_CELL_INFO
*& Form VALIDATE_PD_NUM
Subroutine to validate Purchase Document Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PD_NUM .
IF NOT S_EBELN[] IS INITIAL.
SELECT EBELN " Purchase Document Number
FROM EKKO
INTO W_EBELN
UP TO 1 ROWS
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E717(M8).
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EBELN[]...
ENDFORM. " VALIDATE_PD_NUM
*& Form VALIDATE_VEN_NUM
Subroutine to validate Vendor Number
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_VEN_NUM .
IF NOT S_LIFNR[] IS INITIAL.
SELECT LIFNR " Vendor Number
FROM LFA1
INTO W_LIFNR
UP TO 1 ROWS
WHERE LIFNR IN S_LIFNR.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E002(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_LIFNR[]...
ENDFORM. " VALIDATE_VEN_NUM
*& Form VALIDATE_PUR_GRP
Subroutine to validate the Purchase Group
There are no interface parameters to be passed to this subroutine.
FORM VALIDATE_PUR_GRP .
IF NOT S_EKGRP[] IS INITIAL.
SELECT EKGRP " Purchase Group
FROM T024
INTO W_EKGRP
UP TO 1 ROWS
WHERE EKGRP IN S_EKGRP.
ENDSELECT.
IF SY-SUBRC NE 0.
CLEAR SSCRFIELDS-UCOMM.
MESSAGE E622(M8) WITH W_SPACE.
ENDIF. " IF SY-SUBRC NE 0
ENDIF. " IF NOT S_EKFRP[]...
ENDFORM. " VALIDATE_PUR_GRP
*& Form FILL_VARIANT
Subroutine to fill the Variant Structure
There are no interface parameters to be passed to this subroutine
FORM FILL_VARIANT .
Filling the Variant structure
W_VARIANT-REPORT = SY-REPID.
W_VARIANT-USERNAME = SY-UNAME.
ENDFORM. " FILL_VARIANT
REPORT YMS_HIERSEQLISTDISPLAY .
Program with FM REUSE_ALV_HIERSEQ_LIST_DISPLAY *
Author : Michel PIOUD *
Email : mpioudyahoo.fr HomePage : http://www.geocities.com/mpioud *
TYPE-POOLS: slis. " ALV Global types
CONSTANTS :
c_x VALUE 'X',
c_gt_vbap TYPE SLIS_TABNAME VALUE 'GT_VBAP',
c_gt_vbak TYPE SLIS_TABNAME VALUE 'GT_VBAK'.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_2 FOR FIELD p_expand. "#EC NEEDED
PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.
SELECTION-SCREEN END OF LINE.
TYPES :
1st Table
BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln, " Sales document
kunnr TYPE vbak-kunnr, " Sold-to party
netwr TYPE vbak-netwr, " Net Value of the Sales Order
erdat TYPE vbak-erdat, " Creation date
waerk TYPE vbak-waerk, " SD document currency
expand TYPE xfeld,
END OF ty_vbak,
2nd Table
BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document
matnr TYPE vbap-matnr, " Material number
netwr TYPE vbap-netwr, " Net Value of the Sales Order
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA :
1st Table
gt_vbak TYPE TABLE OF ty_vbak,
2nd Table
gt_vbap TYPE TABLE OF ty_vbap.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
v_2 = 'With ''EXPAND'' field'.
START-OF-SELECTION.
Read Sales Document: Header Data
SELECT vbeln kunnr netwr waerk erdat
FROM vbak
UP TO p_max ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_vbak.
IF NOT gt_vbak[] IS INITIAL.
Read Sales Document: Item Data
SELECT vbeln posnr matnr netwr waerk
FROM vbap
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FOR ALL ENTRIES IN gt_vbak
WHERE vbeln = gt_vbak-vbeln.
ENDIF.
PERFORM f_display.
Form F_DISPLAY
FORM f_display.
Macro definition
DEFINE m_fieldcat.
ls_fieldcat-tabname = &1.
ls_fieldcat-fieldname = &2.
ls_fieldcat-ref_tabname = &3.
ls_fieldcat-cfieldname = &4. " Field with currency unit
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
ls_sort-tabname = &1.
ls_sort-fieldname = &2.
ls_sort-up = c_x.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_layout TYPE slis_layout_alv,
ls_keyinfo TYPE slis_keyinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_sort TYPE slis_t_sortinfo_alv," Sort table
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog
ls_layout-group_change_edit = c_x.
ls_layout-colwidth_optimize = c_x.
ls_layout-zebra = c_x.
ls_layout-detail_popup = c_x.
ls_layout-get_selinfos = c_x.
IF p_expand = c_x.
ls_layout-expand_fieldname = 'EXPAND'.
ENDIF.
Build field catalog and sort table
m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.
m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.
m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.
m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.
m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.
m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.
m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.
m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.
m_sort c_gt_vbak 'KUNNR'.
m_sort c_gt_vbap 'NETWR'.
ls_keyinfo-header01 = 'VBELN'.
ls_keyinfo-item01 = 'VBELN'.
ls_keyinfo-item02 = 'POSNR'.
Dipslay Hierarchical list
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
i_tabname_header = c_gt_vbak
i_tabname_item = c_gt_vbap
is_keyinfo = ls_keyinfo
TABLES
t_outtab_header = gt_vbak
t_outtab_item = gt_vbap
EXCEPTIONS
program_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.
ENDFORM. " F_LIST_DISPLAY
Form USER_COMMAND *
FORM user_command USING i_ucomm TYPE sy-ucomm
is_selfield TYPE slis_selfield. "#EC CALLED
DATA ls_vbak TYPE ty_vbak.
CASE i_ucomm.
WHEN '&IC1'. " Pick
CASE is_selfield-tabname.
WHEN c_gt_vbap.
WHEN c_gt_vbak.
READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.
IF sy-subrc EQ 0.
Sales order number
SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.
Display Sales Order
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. " USER_COMMAND
Kindly Reward Points If You Found The Reply Helpful,
Cheers,
Chaitanya. -
How to implement a Date Picker (Calendar) as a LOV in Portal Form?
I have a form, which will input date from user, and I also have javascript calender.
How to implement a Date Picker (Calendar) as a LOV in Portal Form? Do I need to choose POPUP and LOV for Date?
Instead of typing the Date within a Portal form, a popup Calender that will allow user to Pick a date.
Please help anyone!!Once you have the JavaScript and have added it to your form, you need to the the following. First off, you need to be able to customize the HTML code for the form (i.e. choose custom for form type when creating the form). Once you do that go into the custom layout to customize your HTML code. Find the field you want to add the date picker to. It will be <#your_field_name.ITEM#>
Paste this code after it:
<a href="javascript:show_calendar('forms[0.elements[16');" onmouseover="window.status='Date Picker';return true;" onmouseout="window.status='';return true;"><img src="the source of your image file" width=34 height=21 border=0></a></TD>
You will have to play around with the forms[0].elements[16]. 16 is what date field is set to. However your will differ, so just play with it.
Hope this helps.
Martin
Maybe you are looking for
-
Oracle Server's harddisk out of space. DBCompress in Oracle 9i
My oracle server's PC is running out a harddisk space because of volume of data. I deleted huge data in order to lessen the occupied space but still out and it doubled the occupied. e.g. DELETE FROM TABLE1 WHERE TBLNO > 100000 I am thinking of log fi
-
Managing the Authorization Database in OS X Mavericks
Hi, Since i updated to os 10.9, i had to change my script which helps me to create a powerusers group, which has more rights than a normal user. It was no problem to change in the most rules the group key from admin to powerusers. I did this with the
-
Connection to Internet via Airport snow
Help. For years my airport iMac and MacBook pro worked in harmony but my network was open. When I started any computer including my MacBook pro I was able to join the network without a password. "Foolishly" I decided to add a password. I used the iMa
-
Adding a variable to a class causes a WinRT originate error.
I have a Clock class which causes my game to crash after I add the following line public: int FrameTimeTicks; // this line will cause the crash the error message reads: First-chance exception at 0x74B24598 (KernelBase.dll) in HH.exe: 0x40080201: WinR
-
JavaBean Models, Command Bean and J2EE Design Pattern
Hello, I have read the available "How To", Using EJBs in Web Dynpro Applications where the author mentions that one should use a Command Bean (according to J2EE Design Patterns) so that one can invoke business methods in a Session Bean from our Web