Override vs. Overrides
In JDK 1.5 Beta 1, there was a new annotation type, @java.lang.Overrides. In Beta 2, this has changed to @java.lang.Override. Will this change be permament, or will it be changed back? Also, why was it changed?
Maybe because C# uses override:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_10_5_4.asp
As a matter of grammar, 'overrides' would make more sense since it's adjectival, and modifiers like public, final, static are adjectives.
Similar Messages
-
Flash Builder - RDS - LCDS - 1020: Method marked override must override another method
I'm using RDS data modeller, the RDS fml file is working okay,
I can work with the tables, use services
but when I try to run the application I get prolems, and the problem states:
Description
Resource
Path
Location
Type
1020: Method marked override must override another method.
_CityEntityMetadata.as
/xoffer/src/xoffer
line 219
Flex Problem
This issue extract is: for example: _CityEntityMetadata.as
override public function getPropertyType(propertyName:String):String
if (model_internal::allProperties.indexOf(propertyName) == -1)
throw new Error(propertyName + " is not a property of City");
return model_internal::propertyTypeMap[propertyName];
this for some tables
how does this present, I didn't do sth special, followed the how to online, already reinstalled the whole thing (flash builder 4.5.1, modeller 3.1.1)
workflow:
-> created in MySQL the Database
-> used the RDS config (this works)
-> generate the code and push to the server
-> make a datagrid and link it to a service
-> play => errors get detected
ps when I delete the override it is ok, but I don't think this should be the case....I'm also experiencing this problem. It's a real pain in the neck to have to do extended search / replace on certain method signatures to remove the override.
Anyone have a solution?
Thanks in advance! -
Can't override Button component methods
I've got a custom class that extends the Button UIComponent. I'm trying to override the drawEmphasized() function and a few public get/set functions. I get "1020: Method marked override must override another method." for each thing I try to override. The SWF that uses the custom button will compile and work, but I don't know if the failure is creating some of the strange behavior I see. The errors appear when I drag a component onstage, or save the FLA. This seems related: http://bugs.adobe.com/jira/browse/SDK-13877 but I don't know, I can't understand the fix. Any ideas? Thanks.
I found a workaround. Do not use the same class for Component Definition. Make a different class for use as a Component Definition. Make sure the same Inspectable tag and var declaration are in each class. So for the above extended button class, if you wanted to add a "myvar" inspectable variable, the code would be in another class as follows.
package
import fl.controls.Button;
public class testButtonDEF extends Button
[Inspectable(name="myvar", variable="myvar", type="String", defaultValue="")]
public var myvar:String = "";
Also see my related thread about Inspectable properties: http://forums.adobe.com/thread/453659 -
Well it's me again, having inheritance problems..
I'm trying to override from one of the flexlib classes
(ColoredScheduleEntry) and I notice that it's got two methods...
override public function copy() : IScheduleEntry
and
override public function copyFrom(entry : IScheduleEntry) :
void
Now, I'm extending this class, and implementing
IScheduleEntry but when I try to override the above functions, I
get...
"Method marked override must override another method" for
both methods...which is kinda obvious, but there is a method that
it's overriding from, and it's public too...
Any ideas?
ThanksHi mac,
did you mean this
class
ColoredScheduleEntry?
The documentation and the code didn´t note any function
copy or copyfrom. Are sure you that this is the right class ?
kcell -
Configuring "Generic File Loading Overrides" in Weblogic 9.2
I'm having difficulties utilizing file overrides for applications in weblogic 9.2.
To test I created a test war file, packaged in an ear file.
All that's in the war are files: index.jsp and a test.properties
index.jsp just displays a variable from the properties file:
<body>
<%
Properties myAppProps = new Properties();
InputStream iostream =Thread.currentThread().getContextClassLoader().getResourceAsStream("test.properties");
myAppProps.load(iostream);
%>
<%= myAppProps.getProperty("test")%>
</body>
As packaged in the war, the "test" property is set to "original"
I created the following directories:
c:\test\app\test.ear
c:\test\plan\Plan.xml
c:\test\plan\AppFileOverrides\test.properties
This properties file has the "test" property set to "override"
When I deploy this in WL 9.2 the JSP always displays "original". I've tried various other directory structures, tried it outside of the ear as just a war file, and other guesses as to what might be going wrong, but can't get the test.properties file override to work.
I am using XSD deployment descriptors (not DTD files). I changed the Session Invalidation Interval value through the Plan.xml to verify that it is being recognized by Weblogic, and the new value is displayed through the console. My Plan.xml file has the config-root set: <config-root>c:\test\plan</config-root>
Any ideas on what else I can try or can someone post a complete example that works for me to play with?
Thanks!Thanks for the response, but I'm still getting the "original" value from the packaged properties file instead of the "override"
I've also noticed that if I change a value through the console (just updated the Session Invalidation Interval) weblogic saves the new value to the plan.xml file, but changes my config-root to: *<config-root xsi:nil="true"></config-root>*
I deleted the deployment, changed the config-root back to the directory, and deployed the application again. It does use the value for the Session invalidation but still doesn't use the override test.properties file. Is it not recognizing the config-root property correctly?
Current directory structure:*
c:\test\
c:\test\app\
c:\test\app\test.ear
c:\test\plan\
c:\test\plan\plan.xml
c:\test\plan\AppFileOverrides\
c:\test\plan\AppFileOverrides\test.war\ (directory, not file)
c:\test\plan\AppFileOverrides\test.war\test.properties
Deployment*
Attempted through the console to deploy c:\test
Attempted through the console to deploy c:\test\app\test.ear
Attempted the command line:
java weblogic.Deployer -user weblogic -password weblogic -deploy -name test -source /test/app/test.ear -plan /test/plan/plan.xml
All attempts read the original properties file, not the override.
File Contents*
c:\test\plan\AppFileOverrides\test.war\test.properties
test=override
c:\test\plan\plan.xml
<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd" global-variables="false">
<application-name>test.ear</application-name>
<variable-definition>
<variable>
<name>SessionDescriptor_invalidationIntervalSecs_12744548675600</name>
<value>77</value>
</variable>
</variable-definition>
<module-override>
<module-name>test.ear</module-name>
<module-type>ear</module-type>
<module-descriptor external="false">
<root-element>weblogic-application</root-element>
<uri>META-INF/weblogic-application.xml</uri>
<variable-assignment>
<name>SessionDescriptor_invalidationIntervalSecs_12744548675600</name>
<xpath>/weblogic-application/session-descriptor/invalidation-interval-secs</xpath>
</variable-assignment>
</module-descriptor>
<module-descriptor external="false">
<root-element>application</root-element>
<uri>META-INF/application.xml</uri>
</module-descriptor>
</module-override>
<module-override>
<module-name>test.war</module-name>
<module-type>war</module-type>
<module-descriptor external="false">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
</module-descriptor>
<module-descriptor external="false">
<root-element>web-app</root-element>
<uri>WEB-INF/web.xml</uri>
</module-descriptor>
</module-override>
<config-root>C:\test\plan</config-root>
</deployment-plan>
c:\test\app\test.ear
APP-INF\
APP-INF\classes\
APP-INF\lib\
META-INF\
META-INF\MANIFEST.MF
META-INF\weblogic-application.xml
META-INF\application.xml
test.war
test.war (inside test.ear)
META-INF\
META-INF\MANIFEST.MF
WEB-INF\
WEB-INF\classes\
WEB-INF\classes\test.properties (+test=override+)
WEB-INF\lib\
WEB-INF\web.xml
WEB-INF\weblogic.xml
** all the .xml files except the plan.xml above were generated by eclipse using the defaults and have very little in them, but I can post those too if you think the problem might be in them. -
IconItemRenderer does not override getCurrentRendererState()
I have an ItemRenderer that I've been using for a web app's List, now I need to convert that app into a Mobile App. I am trying to use the optimized IconItemRenderer to display that same item. My Previous Code has:
override public function set data(value:Object):void {
super.data = value;
value_ti.text = value.ProdValue;
invalidateProperties();
override protected function commitProperties():void {
setCurrentState(getCurrentRendererState(), (mx_internal::playTransitions as Boolean));
super.commitProperties();
override protected function getCurrentRendererState():String {
var state:String = super.getCurrentRendererState();
if (state == 'normal') {
if (data.date_purchased != null) {
state = 'sold';
} else {
state = 'normal';
} else if (state == 'sold') {
this.mouseEnabled = false;
this.mouseChildren = false;
return state;
With the code above, I figured I would simply change the ItemRenderer to an IconItemRenderer, and would solve the problem... though... Flash Builder gave me the Error: 1020: Method marked override must override another method. Refering to the method: getCurrentRendererState();
I figure getCurrentRendererState() does not exist in the IconItemRenderer...
Is it possible to achieve the code above through the IconItemRenderer?Short answer: You'll have to reimplement your itemRenderer. It is unclear from your code snippet how you have implemented states.
Longer story:
The IconItemRenderer extends LabelItemRenderer which extends UIComponent.
Mobile ItemRenderers are implemented differently than MXML ItemRenderers. They are more like Mobile Skins than Spark components, or Spark ItemRenderers. States are really just a fantasy; and you implement states by making changes to children, colors, or other visual elements manually in updateDisplayList(); or if you follow the MobileSkin conventions, in layoutContents() and drawBackground().
The method you're looking for is implemented in the itemRenderer class, which Mobile ItemRenderers do not implement. These are some blog posts I wrote on building Mobile itemRenderers:
https://www.flextras.com/blog/index.cfm/2011/6/17/Mobile-itemRenderers--6172011---Episode- 103--Flextras-Friday-Lunch
https://www.flextras.com/blog/index.cfm/2011/6/23/Understanding-Mobile-itemRenderers
https://www.flextras.com/blog/index.cfm/2011/6/24/Building-a-Mobile-ItemRenderer-in-Flex
I have one coming soon on implementing states in Mobile Skins; which will apply equally to itemRenderers. I'll go over most of the content in tomorrow's Flextras Friday Lunch episode -
DynamicStream class play2 function and error overriding it
Adobe made a "DynamicStream" class that looks pretty cool. I'd like to use it. The class contains the following code:
override public function play2(param:NetStreamPlayOptions):void {
throw new Error( "The play2() method has been disabled for this class. Please create a separate NetStream object to use play2()." );
The compiler complains about this function. Says "the method marked override must override another method". It doesn't complain about it if I instantiate class in my main application file. That's what the sample code in the Adobe productivity tools suite does - uses the class in the main application file.
If I use it in a custom component file though the compiler complains.
What do I do with this function if I intend to instantiate the DynamicStream class in a custom component file?I too ran into this problem, if you are using the Flex SDK you must set the target flash player version to at least 10.0.0 otherwise the error occurs because play2() is not available in 9. By default the target version for all Flex 3.4 is 9.x, so you must change the target to 10. Let me know if you have anymore problems.
-
Using sprite for itemRenderer what other method than set data needs override
I get the following error: 1020 Method Marked override must override another method. Complier marks the error at the start of my set data method:
code is here:
http://pastie.org/497786
any input would be welcome.
Thanks
JedI think Natasha said that you don't need the override on your set data() method. You shouldn't need to implement IFactory either. I think your code should look like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent
xmlns:mx="http://www.adobe.com/2006/mxml"
width="160"
height="120"
implements="mx.controls.listClasses.IListItemRenderer"
>
<mx:Style source="QtVideo.css"/>
<mx:Script>
<![CDATA[
private var repImageSource:String = "";
private var movieSource:String = "";
private var _data:Object;
public function get data():Object
return _data;
setting data
public function set data(value:Object):void
_data = value;
repImageSource = value.representativeImage as String;
movieSource = value.source as String;
]]>
</mx:Script>
<mx:Image
id="repImage"
width="160"
height="120"
source = ""
horizontalAlign="center"
x="0"
y="0"
>
</mx:Image>
<mx:Button styleName="playStopStyle"
id="playBtn"
x="{repImage.width/2 - 22.5}"
y="{repImage.height/2 -22.5}"
/>
</mx:UIComponent >
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Difference between OVERLOADING and OVERRIDING??
Hi guys,
can you please exaplain me difference between Overloading & Overriding with example?
Thanks,
JaxNaHere is the example of overriding :
/* PARENT CLASS */
package com.example.supreclass {
public class parentClass {
public function parentClass() {
public function fromParent(myString:String):void {
trace("Output :", myString);
/* DERIVED CLASS */
package com.example.supreclass {
public class myExample extends parentClass {
public function myExample() {
/* Override the method */
override public function fromParent(outputStr:String):void {
super.fromParent(outputString);
trace("Override example");
Overriding means redefining the inherited method (the parent method still can be invoked using 'super', as shown in example )
These links should give you some idea on these :
Overriding : http://www.kirupa.com/forum/showthread.php?p=1896981
Overloading means having many functions with same name but each differs by parameters it takes (either by data type or number of parameters passed) and return value.
Overloading : http://www.techper.net/2008/07/08/missing-method-overloading-in-as3/ -
After reading many posts on different forums, I have found that overriding Chromium's internal protocol handlers is notoriously difficult. Some, like mailto:, use a hardcoded command name like xdg-email which doesn't work very well when not using one of the major desktops, while others don't work as expected for any number of reasons.
Which is why I've come up with a way to add any user-defined protocol that Chromium doesn't already handle using xdg-open.
The following example deals with adding an override for the mailto: protocol handler, to have it use xdg-open instead of xdg-email to start the email client.
The process is in 3 steps:
1. Add a .desktop file for the protocol handler override
2. Tell the system to use the protocol handler override
3. Tell Chromium to use the protocol handler override
Step 1: Create the file $HOME/.local/share/applications/chromium-mailto.desktop with the following contents:
[Desktop Entry]
Version=1.0
Name=Chromium mailto: override
Comment=Override the Chromium mailto: protocol handler
GenericName=Override the Chromium mailto: protocol handler
Exec=xdg-open $(echo %u|perl -pe 's/^x-chromium-mailto://; tr/+/ /; s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;')
Terminal=false
Type=Application
MimeType=x-scheme-handler/x-chromium-mailto
NoDisplay=true
Step 2: Tell the system about the new MIME type
In a terminal, execute the following command:
$ xdg-mime default chromium-mailto.desktop x-scheme-handler/x-chromium-mailto
Note: the path to the .desktop file must be relative to $HOME/.local/share/applications !
Step 3: Tell Chromium to use the protocol handler override
First, close all open Chromium windows. This is very important for the following changes to 'take'!
Assuming you use the Default profile in Chromium, open the following file in an editor: $HOME/.config/chromium/Default/Preferences
Within the curly braces, for example under the lines:
"cloud_print": {
"email": ""
add the following:
"custom_handlers": {
"enabled": true,
"registered_protocol_handlers": [ {
"default": true,
"protocol": "mailto",
"title": "mailto: override",
"url": "x-chromium-mailto:%s"
Test that everything works by starting Chromium, then clicking on a mailto: link, for example the Contact link at the bottom of http://oswatershed.org.
The first time you click the link, Chromium will ask for permission to run the command, so you can check that it is correct. Check the checkbox to have Chromium remember your choice.
Comments and suggestions are very welcome.
Last edited by ackalker (2012-12-04 04:08:32)The Preferences file has changed since Dec. 2012. The "cloud_print" input has changed. Adding your mod input to the Preferences file induced a Google warning--I undid. It seems that the previous mods prove sufficient. Thanks!
Last edited by rbrband (2014-04-23 20:13:40) -
Overriding parameterized methods
I have a class hierarchy like the following:
class A {
Super f() { ... }
class B extends A {
Sub f() { ... }
}B.f() overrides A.f(), because the methods have the same signature and covariant return types.
A ref = new B();
ref.f(); // calls B.f (as expected)I changed the subclass to
class B extends A {
<T extends Sub> T f();
}and had expected that this modification would not have any adverse effect on any existing piece of Java code in my program,
because the modification does not change the signature of B.f(). After type erasure B.f() still has the signature "Sub
f()".
To my surprise I noticed that the using piece of code
A ref = new B();
ref.f(); // now calls A.f (surprise !!!)had silently changed its behavior: it now calls A.f() where it used to call B.f(). Seemingly B.f() no longer overrides
A.f().
Why is this?A parameterized method cannot override a nonparameterized method. When overriding, the overriding method must have the same number of parameters and type parameters as the method being overridden, otherwise there is no overriding relationship between the methods. This is spelled out in sections 3.1 and 3.2 of the jsr14 spec included with the prototype.
-
How to set the return language? i read the api already
import java.io.*;
import java.util.*;
class Listing_Available_Locales
public static void main(String args[])
Locale[] locales = Locale.ENGLISH(); //error is here
//Locale[] locales = Locale.getAvailableLocales(); //this line no error
for (int i=0; i<locales.length; i++) {
// Get the 2-letter language code
String language = locales.getLanguage();
// Get the 2-letter country code; may be equal to ""
String country = locales[i].getCountry();
// Get localized name suitable for display to the user
String locName = locales[i].getDisplayName();
System.out.println(language+" "+country+" "+locName);
local api is like below
java.util
Class Locale
java.lang.Object
java.util.Locale
All Implemented Interfaces:
Cloneable, Serializable
public final class Locale
extends Object
implements Cloneable, Serializable
A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation--the number should be formatted according to the customs/conventions of the user's native country, region, or culture.
Create a Locale object using the constructors in this class:
Locale(String language)
Locale(String language, String country)
Locale(String language, String country, String variant)
The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
The variant argument is a vendor or browser-specific code. For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most important one first. For example, a Traditional Spanish collation might construct a locale with parameters for language, country and variant as: "es", "ES", "Traditional_WIN".
Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale. If you want to see whether particular resources are available for the Locale you construct, you must query those resources. For example, ask the NumberFormat for the locales it supports using its getAvailableLocales method.
Note: When you ask for a resource for a particular locale, you get back the best available match, not necessarily precisely what you asked for. For more information, look at ResourceBundle.
The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the United States:
Locale.US
Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code. You can use getDisplayCountry to get the name of the country suitable for displaying to the user. Similarly, you can use getDisplayLanguage to get the name of the language suitable for displaying to the user. Interestingly, the getDisplayXXX methods are themselves locale-sensitive and have two versions: one that uses the default locale and one that uses the locale specified as an argument.
The Java 2 platform provides a number of classes that perform locale-sensitive operations. For example, the NumberFormat class formats numbers, currency, or percentages in a locale-sensitive manner. Classes such as NumberFormat have a number of convenience methods for creating a default object of that type. For example, the NumberFormat class provides these three convenience methods for creating a default NumberFormat object:
NumberFormat.getInstance()
NumberFormat.getCurrencyInstance()
NumberFormat.getPercentInstance()
These methods have two variants; one with an explicit locale and one without; the latter using the default locale.
NumberFormat.getInstance(myLocale)
NumberFormat.getCurrencyInstance(myLocale)
NumberFormat.getPercentInstance(myLocale)
A Locale is the mechanism for identifying the kind of object (NumberFormat) that you would like to get. The locale is just a mechanism for identifying objects, not a container for the objects themselves.
Each class that performs locale-sensitive operations allows you to get all the available objects of that type. You can sift through these objects by language, country, or variant, and use the display names to present a menu to the user. For example, you can create a menu of all the collation objects suitable for a given language. Such classes must implement these three class methods:
public static Locale[] getAvailableLocales()
public static String getDisplayName(Locale objectLocale,
Locale displayLocale)
public static final String getDisplayName(Locale objectLocale)
// getDisplayName will throw MissingResourceException if the locale
// is not one of the available locales.
Since:
1.1
See Also:
ResourceBundle, Format, NumberFormat, Collator, Serialized Form
Field Summary
static Locale CANADA
Useful constant for country.
static Locale CANADA_FRENCH
Useful constant for country.
static Locale CHINA
Useful constant for country.
static Locale CHINESE
Useful constant for language.
static Locale ENGLISH
Useful constant for language.
static Locale FRANCE
Useful constant for country.
static Locale FRENCH
Useful constant for language.
static Locale GERMAN
Useful constant for language.
static Locale GERMANY
Useful constant for country.
static Locale ITALIAN
Useful constant for language.
static Locale ITALY
Useful constant for country.
static Locale JAPAN
Useful constant for country.
static Locale JAPANESE
Useful constant for language.
static Locale KOREA
Useful constant for country.
static Locale KOREAN
Useful constant for language.
static Locale PRC
Useful constant for country.
static Locale SIMPLIFIED_CHINESE
Useful constant for language.
static Locale TAIWAN
Useful constant for country.
static Locale TRADITIONAL_CHINESE
Useful constant for language.
static Locale UK
Useful constant for country.
static Locale US
Useful constant for country.
Constructor Summary
Locale(String language)
Construct a locale from a language code.
Locale(String language, String country)
Construct a locale from language, country.
Locale(String language, String country, String variant)
Construct a locale from language, country, variant.
Method Summary
Object clone()
Overrides Cloneable
boolean equals(Object obj)
Returns true if this Locale is equal to another object.
static Locale[] getAvailableLocales()
Returns a list of all installed locales.
String getCountry()
Returns the country/region code for this locale, which will either be the empty string or an upercase ISO 3166 2-letter code.
static Locale getDefault()
Gets the current value of the default locale for this instance of the Java Virtual Machine.
String getDisplayCountry()
Returns a name for the locale's country that is appropriate for display to the user.
String getDisplayCountry(Locale inLocale)
Returns a name for the locale's country that is appropriate for display to the user.
String getDisplayLanguage()
Returns a name for the locale's language that is appropriate for display to the user.
String getDisplayLanguage(Locale inLocale)
Returns a name for the locale's language that is appropriate for display to the user.
String getDisplayName()
Returns a name for the locale that is appropriate for display to the user.
String getDisplayName(Locale inLocale)
Returns a name for the locale that is appropriate for display to the user.
String getDisplayVariant()
Returns a name for the locale's variant code that is appropriate for display to the user.
String getDisplayVariant(Locale inLocale)
Returns a name for the locale's variant code that is appropriate for display to the user.
String getISO3Country()
Returns a three-letter abbreviation for this locale's country.
String getISO3Language()
Returns a three-letter abbreviation for this locale's language.
static String[] getISOCountries()
Returns a list of all 2-letter country codes defined in ISO 3166.
static String[] getISOLanguages()
Returns a list of all 2-letter language codes defined in ISO 639.
String getLanguage()
Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
String getVariant()
Returns the variant code for this locale.
int hashCode()
Override hashCode.
static void setDefault(Locale newLocale)
Sets the default locale for this instance of the Java Virtual Machine.
String toString()
Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Field Detail
ENGLISH
public static final Locale ENGLISHUseful constant for language.
FRENCH
public static final Locale FRENCHUseful constant for language.
GERMAN
public static final Locale GERMANUseful constant for language.
ITALIAN
public static final Locale ITALIANUseful constant for language.
JAPANESE
public static final Locale JAPANESEUseful constant for language.
KOREAN
public static final Locale KOREANUseful constant for language.
CHINESE
public static final Locale CHINESEUseful constant for language.
SIMPLIFIED_CHINESE
public static final Locale SIMPLIFIED_CHINESEUseful constant for language.
TRADITIONAL_CHINESE
public static final Locale TRADITIONAL_CHINESEUseful constant for language.
FRANCE
public static final Locale FRANCEUseful constant for country.
GERMANY
public static final Locale GERMANYUseful constant for country.
ITALY
public static final Locale ITALYUseful constant for country.
JAPAN
public static final Locale JAPANUseful constant for country.
KOREA
public static final Locale KOREAUseful constant for country.
CHINA
public static final Locale CHINAUseful constant for country.
PRC
public static final Locale PRCUseful constant for country.
TAIWAN
public static final Locale TAIWANUseful constant for country.
UK
public static final Locale UKUseful constant for country.
US
public static final Locale USUseful constant for country.
CANADA
public static final Locale CANADAUseful constant for country.
CANADA_FRENCH
public static final Locale CANADA_FRENCHUseful constant for country.
Constructor Detail
Locale
public Locale(String language,
String country,
String variant)Construct a locale from language, country, variant. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
country - uppercase two-letter ISO-3166 code.
variant - vendor and browser specific code. See class description.
Throws:
NullPointerException - thrown if any argument is null.
Locale
public Locale(String language,
String country)Construct a locale from language, country. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
country - uppercase two-letter ISO-3166 code.
Throws:
NullPointerException - thrown if either argument is null.
Locale
public Locale(String language)Construct a locale from a language code. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
Throws:
NullPointerException - thrown if argument is null.
Since:
1.4
Method Detail
getDefault
public static Locale getDefault()Gets the current value of the default locale for this instance of the Java Virtual Machine.
The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified. It can be changed using the setDefault method.
Returns:
the default locale for this instance of the Java Virtual Machine
setDefault
public static void setDefault(Locale newLocale)Sets the default locale for this instance of the Java Virtual Machine. This does not affect the host locale.
If there is a security manager, its checkPermission method is called with a PropertyPermission("user.language", "write") permission before the default locale is changed.
The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified.
Since changing the default locale may affect many different areas of functionality, this method should only be used if the caller is prepared to reinitialize locale-sensitive code running within the same Java Virtual Machine, such as the user interface.
Parameters:
newLocale - the new default locale
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
NullPointerException - if newLocale is null
See Also:
SecurityManager.checkPermission(java.security.Permission), PropertyPermission
getAvailableLocales
public static Locale[] getAvailableLocales()Returns a list of all installed locales.
getISOCountries
public static String[] getISOCountries()Returns a list of all 2-letter country codes defined in ISO 3166. Can be used to create Locales.
getISOLanguages
public static String[] getISOLanguages()Returns a list of all 2-letter language codes defined in ISO 639. Can be used to create Locales. [NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. The list this function returns includes both the new and the old codes for the languages whose codes have changed.]
getLanguage
public String getLanguage()Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. Locale's constructor recognizes both the new and the old codes for the languages whose codes have changed, but this function always returns the old code. If you want to check for a specific language whose code has changed, don't do
if (locale.getLanguage().equals("he")
Instead, do
if (locale.getLanguage().equals(new Locale("he", "", "").getLanguage())
See Also:
getDisplayLanguage()
getCountry
public String getCountry()Returns the country/region code for this locale, which will either be the empty string or an upercase ISO 3166 2-letter code.
See Also:
getDisplayCountry()
getVariant
public String getVariant()Returns the variant code for this locale.
See Also:
getDisplayVariant()
toString
public final String toString()Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars. Language is always lower case, and country is always upper case. If the language is missing, the string will begin with an underbar. If both the language and country fields are missing, this function will return the empty string, even if the variant field is filled in (you can't have a locale with just a variant-- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
Overrides:
toString in class Object
Returns:
a string representation of the object.
See Also:
getDisplayName()
getISO3Language
public String getISO3Language()
throws MissingResourceExceptionReturns a three-letter abbreviation for this locale's language. If the locale doesn't specify a language, this will be the empty string. Otherwise, this will be a lowercase ISO 639-2/T language code. The ISO 639-2 language codes can be found on-line at ftp://dkuug.dk/i18n/iso-639-2.txt
Throws:
MissingResourceException - Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.
getISO3Country
public String getISO3Country()
throws MissingResourceExceptionReturns a three-letter abbreviation for this locale's country. If the locale doesn't specify a country, this will be tbe the empty string. Otherwise, this will be an uppercase ISO 3166 3-letter country code.
Throws:
MissingResourceException - Throws MissingResourceException if the three-letter country abbreviation is not available for this locale.
getDisplayLanguage
public final String getDisplayLanguage()Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatian), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
getDisplayLanguage
public String getDisplayLanguage(Locale inLocale)Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized according to inLocale, (say, we don't have a Japanese name for Croatian), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
getDisplayCountry
public final String getDisplayCountry()Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatia), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
getDisplayCountry
public String getDisplayCountry(Locale inLocale)Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized according to inLocale. (say, we don't have a Japanese name for Croatia), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
getDisplayVariant
public final String getDisplayVariant()Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for the default locale. If the locale doesn't specify a variant code, this function returns the empty string.
getDisplayVariant
public String getDisplayVariant(Locale inLocale)Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for inLocale. If the locale doesn't specify a variant code, this function returns the empty string.
getDisplayName
public final String getDisplayName()Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:
language (country, variant)
language (country)
language (variant)
country (variant)
language
country
variant
depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
getDisplayName
public String getDisplayName(Locale inLocale)Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:
language (country, variant)
language (country)
language (variant)
country (variant)
language
country
variant
depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
clone
public Object clone()Overrides Cloneable
Overrides:
clone in class Object
Returns:
a clone of this instance.
See Also:
Cloneable
hashCode
public int hashCode()Override hashCode. Since Locales are often used in hashtables, caches the value for speed.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
equals
public boolean equals(Object obj)Returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, country, and variant, and unequal to all other objects.
Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this Locale is equal to the specified object.
See Also:
Object.hashCode(), Hashtable
Overview Package Class Use Tree Deprecated Index Help
JavaTM 2 Platform
Std. Ed. v1.4.2
PREV CLASS NEXT CLASS FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.Was it really necessary to post the whole API description?!?
Locale[] locales = Locale.ENGLISH();ENGLISH is not a method in class Locale, so do not add the braces "( );".
Also, the constant ENGLISH is not an array, but just a single Locale object.
You didn't say what your problem was. What do you want to achieve with your program and what is it that you don't understand? -
We've been getting the following error for some time now.
An error occurred on line 105 while executing script 'MOM Backward Compatibility Service State Monitoring Script'
Source: Microsoft VBScript runtime error
Description: The remote server machine does not exist or is unavailable: 'GetObject'
One or more workflows were affected by this.
Workflow name: System.Mom.BackwardCompatibility.ServiceStateMonitoring
Instance name: server.domain.local
Instance ID: {INSTANCE}
Management group: GROUP
Unfortunately the instance in question has since been decommissioned and simply does not exist any more.
We're currently on a repeat count of over 350,000 and I would REALLY like to get it stopped. I've had a look at adding an override but that points to the management server rather than the instance itself.
Does anyone have any suggestions?
thanks in advance!Hi Steven,
There are for option for us to override a monitor ot rule:
For all objects of class:
Class
When you select this option for your override, the override settings apply to all objects in the class at which the rule or monitor is targeted.
For a group
When you select this option for your override, the override settings apply only to members of the group. The rule or monitor without the override settings continues to apply to all objects in the targeted class except for those objects that are also members
of the group used for the override.
When you create a group, you save it to an unsealed management pack. However, an element in an unsealed management pack, such as an override, cannot reference an element in a different unsealed management pack, such as a group. If you are going to use a group
to limit the application of an override, you must either save the group to the same unsealed management pack as the override, or you must seal the management pack that contains the group.
For a specific object of class:
Class
When you select this option for your override, the override settings apply only to the specified object. The rule or monitor without the override settings continues to apply to all other objects in the targeted class.
For all objects of another class
When you select this option for your override, the override settings apply only to objects of a class other than the targeted class. The rule or monitor without the override settings continues to apply to all objects in the targeted class.
Did you try to override it for a specific object of class?
Regards,
Yan Li
Regards, Yan Li -
I have a requirement to print <attribute-override> and <column> in a spreadsheet.
My xml file is as
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd">
<entity class="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetails">
<table name="FLX_AC_ACCT_CREDIT_MATRIX_DTLS"/>
<attributes>
<embedded-id attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetailsKey" name="key">
<attribute-override name="accountId">
<column name="ACCOUNT_ID"/>
</attribute-override>
<attribute-override name="accountType">
<column name="ACCOUNT_TYPE"/>
</attribute-override>
<attribute-override name="effectiveDate">
<column name="EFFECTIVE_DATE"/>
</attribute-override>
<attribute-override name="matrixIdvalue">
<column name="MATRIX_ID_VALUE"/>
</attribute-override>
<attribute-override name="classification">
<column name="Classification"/>
</attribute-override>
</embedded-id>
<embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetric" name="creditMetric">
<attribute-override name="metricType">
<column name="METRIC_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="metricValue">
<column name="METRIC_VALUE" unique="false"/>
</attribute-override>
</embedded>
<embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.RiskScore" name="riskScore">
<attribute-override name="scoreType">
<column name="SCORE_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="otherScoreType">
<column name="OTHER_SCORE_TYPE" unique="false"/>
</attribute-override>
<attribute-override name="scoreCardExternalReferenceNo">
<column name="SCORE_EXTR_REF_NO" unique="false"/>
</attribute-override>
<attribute-override name="ratingModel">
<column name="RATING_MODEL" unique="false"/>
</attribute-override>
<attribute-override name="ratingStatus">
<column name="RATING_STATUS" unique="false"/>
</attribute-override>
<attribute-override name="riskGrade">
<column name="RISK_GRADE" unique="false"/>
</attribute-override>
<attribute-override name="scoreCardIndex">
<column name="SCORE_CARD_INDEX" unique="false"/>
</attribute-override>
<attribute-override name="score">
<column name="SCORE" unique="false"/>
</attribute-override>
</embedded>
</attributes>
</entity>
</entity-mappings>
I have managed to write the code as
package xmlexcel;
import org.apache.poi.hssf.usermodel.*;
import java.util.ArrayList;
import java.awt.List;
import java.io.*;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class XMLconvertExcel {
private static File xmlDocument;
private static NodeList e;
int a;
public void generateExcel(File xmlDocument) {
try {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("spreadSheet");
spreadSheet.setColumnWidth((short)0,(short) (256*25));
spreadSheet.setColumnWidth((short)1,(short) (256*25));
spreadSheet.setColumnWidth((short)2,(short) (256*25));
spreadSheet.setColumnWidth((short)3,(short) (256*25));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlDocument);
NodeList nList = document.getElementsByTagName("attributes");
document.getDocumentElement().normalize();
//a=nodelist.getLength();
//e = printStackTrace();
//System.out.println("I am here " +e);
System.out.println("Root element :" + document.getDocumentElement().getNodeName() + " nlist length " +nList.getLength());
System.out.println("Node Type :" + document.getDocumentElement().getNodeType());
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short)0);
cell.setCellValue("Entity");
cell = row.createCell((short)1);
cell.setCellValue("Table");
cell = row.createCell((short)2);
cell.setCellValue("Attribute");
cell = row.createCell((short)3);
cell.setCellValue("Column");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFRow row2 = spreadSheet.createRow(2);
HSSFRow row3 = spreadSheet.createRow(3);
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
System.out.println("\nCurrent Element :" + nNode.getNodeName());
switch {
case 0:
//cell = row1.createCell((short)0);
//cell.setCellValue("Attribute");
//trying from http://architects.dzone.com/articles/parsing-xml-using-dom-sax-and
cell = row1.createCell((short) 2);
cell.setCellValue(((Element) (nList.item(0)))
.getElementsByTagName("attribute-override").item(0)
.getFirstChild().getNodeValue());
break;
case 1:
//cell = row1.createCell((short)1);
//cell.setCellValue("Table");
cell = row1.createCell((short) 3);
cell.setCellValue(((Element) (nList.item(0)))
.getElementsByTagName("column").item(0)
.getFirstChild().getNodeValue());
break;
case 2:
cell = row1.createCell((short)2);
cell.setCellValue("Attribute");
cell = row1.createCell((short) 2);
cell.setCellValue(((Element) (nodelist.item(2)))
.getElementsByTagName("attribute-override").item(0)
.getFirstChild().getNodeValue());
cell = row1.createCell((short)3);
cell.setCellValue("Column");
cell = row1.createCell((short) 3);
cell.setCellValue(((Element) (nodelist.item(3)))
.getElementsByTagName("column").item(0)
.getFirstChild().getNodeValue());
break;
default:
break;
//wb.write(arg1.getOutputPayload().getOutputStream());
//Outputting to Excel spreadsheet
FileOutputStream output = new FileOutputStream(new File("C:\\java_training\\com\\XMLtoExcel\\ormaccount.xls"));
wb.write(output);
output.flush();
output.close();
} catch (IOException e) {
System.out.println("IOException " + e.getMessage());
} catch (ParserConfigurationException e) {
System.out.println("ParserConfigurationException " +e.getMessage());
}catch (SAXException e) {
System.out.println("SAXException " +e.getMessage());
private String printStackTrace() {
// TODO Auto-generated method stub
return null;
* @param args
public static void main(String[] args) {
File xmlDocument = new File("C:\\java_training\\com\\XMLtoExcel\\AccountCreditMatrixDetails.orm.xml");
XMLconvertExcel excel = new XMLconvertExcel();
excel.generateExcel(xmlDocument);
Both the tags are not getting printed in separate columns.
I have looked at
http://www.javaworld.com/article/2076189/enterprise-java/book-excerpt--converting-xml-to-spreadsheet--and-vice-versa.html
http://scn.sap.com/thread/3224533
http://www.tutorialspoint.com/java_xml/java_dom_parse_document.htm
The above URL shows example of simple xml.
Please can I get assistance.I too received this error as I tried to run my first Windows 8.1 deployment. Per another post I commented out this line
<IEWelcomeMsg>false</IEWelcomeMsg>
from the IE section of the unattend.xml. I was then able to run my deployment. I do not see this line in your posting though.
I referenced this link even though it was for Windows 7.
http://social.technet.microsoft.com/Forums/en-US/c41a2b69-a591-4cd3-86ab-6a0f8a73b858/getting-windows-could-not-parse-or-process-the-unattend-answer-file-for-pass-specialize-with?forum=mdt
Hope this helps someone.
JayTheTech
To clarify, I edited the unattend.xml file from from Deployment Share, not C:\Windows\Panther.
DS\control\task sequence ID\unattend.xml
JayTheTech -
I am getting a following error when i run the program in ECC 6.o
ERROR:" The where condition does not refer to for all entries table..
program is as follows..full marks wud be given.....
***INCLUDE MZSDRETL_RMP_PRICING_ENTRYF01 .
*& Form COMPUTE_SCROLLING_IN_TC
Vertical Scrolling in table control upon pressing , next page,
previous page , first page and last page button
-->P_TC_NAME table control name
-->P_OK_CODE okcode
-->P_LOOPC current loop count
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK_CODE
P_LOOPC.
-BEGIN OF LOCAL DATA----
DATA L_TC_NEW_TOP_LINE LIKE SY-TABIX.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE CXTAB_CONTROL.
-END OF LOCAL DATA----
ASSIGN (P_TC_NAME) TO <TC>.
IF <TC>-LINES = 0.
L_TC_NEW_TOP_LINE = 1.
ELSE.
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = <TC>-TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = <TC>-LINES
LAST_PAGE_FULL = C_X
LOOPS = P_LOOPC
OK_CODE = P_OK_CODE
OVERLAPPING = C_X
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE.
exceptions
no_entry_or_page_act = 01
no_entry_to = 02
no_ok_code_or_page_go = 03
others = 99.
ENDIF.
get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME .
IF SY-SUBRC = 0.
set actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
set the new top line *
<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
*& Form GET_VALUE_ON_REQUEST
Call function module to display the region list in form of search help
FORM GET_VALUE_ON_REQUEST TABLES RET
USING P_C_RET
P_C_DYN
P_DYNNR.
Call function module to display the data in internal table in form of
a search help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = P_C_RET
DYNPPROG = G_REPID
DYNPNR = P_DYNNR
DYNPROFIELD = P_C_DYN
VALUE_ORG = C_VAL_ORG " Value S
TABLES
VALUE_TAB = RET.
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. " GET_VALUE_ON_REQUEST
*& Form POPULATE_RANGES
Populate range tables with store grouping data
-->P_I_STORE_INFO store grouping entry
FORM POPULATE_RANGES USING L_REGION_ID
L_DIST_ID
L_AREA_ID
L_STORE_ID.
CLEAR : R_REGION , R_DIST , R_AREA , R_STORE .
CLEAR : R_REGION[] , R_DIST[] , R_AREA[] , R_STORE[].
populate region
IF NOT L_REGION_ID IS INITIAL.
R_REGION-SIGN = C_SIGN.
R_REGION-OPTION = C_OPT1.
R_REGION-LOW = L_REGION_ID.
APPEND R_REGION.
CLEAR R_REGION.
ENDIF.
populate district
IF NOT L_DIST_ID IS INITIAL.
R_DIST-SIGN = C_SIGN.
R_DIST-OPTION = C_OPT1.
R_DIST-LOW = L_DIST_ID.
APPEND R_DIST.
CLEAR R_DIST.
ENDIF.
populate area
IF NOT L_AREA_ID IS INITIAL.
R_AREA-SIGN = C_SIGN.
R_AREA-OPTION = C_OPT1.
R_AREA-LOW = L_AREA_ID.
APPEND R_AREA.
CLEAR R_AREA.
ENDIF.
populate store
IF NOT L_STORE_ID IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = L_STORE_ID
IMPORTING
OUTPUT = L_STORE_ID.
R_STORE-SIGN = C_SIGN.
R_STORE-OPTION = C_OPT1.
R_STORE-LOW = L_STORE_ID.
APPEND R_STORE.
CLEAR R_STORE.
ENDIF.
ENDFORM. " POPULATE_RANGES
*& Form GET_TABLE_ROW_VALUES
Get the field values of the current row of the table
l_stepl - current row no.
FORM GET_TABLE_ROW_VALUES USING L_STEPL.
DATA: L_REPID LIKE D020S-PROG.
REFRESH I_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-REGION_ID'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-DIST_ID'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-AREA_ID'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-ATTR_VAL'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'I_STORE_INFO-STORE_ID'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
WA_DYNPREAD-STEPL = L_STEPL.
WA_DYNPREAD-FIELDNAME = 'ZPRICELIST-ZLIST'.
APPEND WA_DYNPREAD TO I_DYNPREAD.
CLEAR WA_DYNPREAD.
L_REPID = G_REPID .
Call function to get the screen data
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = L_REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = I_DYNPREAD.
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. " GET_TABLE_ROW_VALUES
*& Form DETERMINE_LEVEL
Determine the level of store grouping info entered
Region - 1
Region/Dist - 2
Region/Dist/Area - 3
Region/Dist/Area/Store - 4
FORM DETERMINE_LEVEL USING P_I_STORE_INFO LIKE I_STORE_INFO.
IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL
AND P_I_STORE_INFO-DIST_ID IS INITIAL
AND P_I_STORE_INFO-AREA_ID IS INITIAL
AND P_I_STORE_INFO-STORE_ID IS INITIAL.
P_I_STORE_INFO-LEVEL = C_LEVEL1.
ENDIF.
IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL
AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL
AND P_I_STORE_INFO-AREA_ID IS INITIAL
AND P_I_STORE_INFO-STORE_ID IS INITIAL.
P_I_STORE_INFO-LEVEL = C_LEVEL2.
ENDIF.
IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL
AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL
AND NOT P_I_STORE_INFO-AREA_ID IS INITIAL
AND P_I_STORE_INFO-STORE_ID IS INITIAL.
P_I_STORE_INFO-LEVEL = C_LEVEL3.
ENDIF.
IF NOT P_I_STORE_INFO-REGION_ID IS INITIAL
AND NOT P_I_STORE_INFO-DIST_ID IS INITIAL
AND NOT P_I_STORE_INFO-AREA_ID IS INITIAL
AND NOT P_I_STORE_INFO-STORE_ID IS INITIAL.
P_I_STORE_INFO-LEVEL = C_LEVEL4.
ENDIF.
ENDFORM. " DETERMINE_LEVEL
*& Form GET_SY_STEPL
Get the current record number in the table control.
-->P_L_STEPL text
FORM GET_SY_STEPL USING P_L_STEPL LIKE SY-STEPL.
CLEAR P_L_STEPL.
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
POVSTEPL = P_L_STEPL
EXCEPTIONS
STEPL_NOT_FOUND = 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. " GET_SY_STEPL
*& Form GET_POPUP_CONFIRM
Display the popup to confirm the user
FORM GET_POPUP_CONFIRM USING P_L_ANS
P_G_POPUP_TEXT
G_LINE_TEXT.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = G_LINE_TEXT
TEXT_QUESTION = P_G_POPUP_TEXT
IMPORTING
ANSWER = P_L_ANS.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " GET_POPUP_CONFIRM
*& Form GOTO_SKU_HIER_SCREEN
Upon user wishes to go to the detail screen , a check is performed
to determine if any existing promo or pricing is already available
for the entered store grouping info . If it is available then
prompt a message to the user 'Already promo exists if user wants to
go to the detail screen ?'. If the user presses 'Yes' then then
detail screen will appear otherwise the header screen will appear
FORM GOTO_SKU_HIER_SCREEN.
CLEAR G_CHECK_ENTRY.
Check the store grouping entries beforr switching to detail screen.
PERFORM CHECK_STORE_ENTRIES.
CHECK G_CHECK_ENTRY IS INITIAL.
READ TABLE I_STORE_INFO WITH KEY REGION_ID = C_SPACE
DIST_ID = C_SPACE
AREA_ID = C_SPACE
STORE_ID = C_SPACE
ATTR_VAL = C_SPACE.
IF SY-SUBRC = 0.
DELETE I_STORE_INFO WHERE REGION_ID = C_SPACE
AND DIST_ID = C_SPACE
AND AREA_ID = C_SPACE
AND STORE_ID = C_SPACE
AND ATTR_VAL = C_SPACE.
ENDIF.
perform check for the duplicate store grouping data.
PERFORM CHECK_DUPLICATE_STRGRP_DATA.
If any duplicate entry is found then user will be prompted with the
message if he/she wants to delete those duplicate entries . If 'Yes'
is pressed then all the duplicate entries will be deleted or else
if 'No' is pressed , then user will remain in the same header screen
IF G_DUPLICATE_ENTRY = C_X.
CONCATENATE TEXT-058 TEXT-059
INTO G_POPUP_TEXT
SEPARATED BY SPACE.
CLEAR G_ANS.
CLEAR G_LINE_TEXT.
Get the pop-up to confirm the operation
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT.
IF G_ANS = '1'.
Delete the duplicate entries
DELETE ADJACENT DUPLICATES FROM I_STORE_INFO COMPARING REGION_ID
DIST_ID
AREA_ID
STORE_ID
ATTR_VAL.
MESSAGE S161(ZS) WITH TEXT-003.
ENDIF.
ELSE.
Perform the duplicate entry check for create or change pricing
IF G_MAIN_OKCODE = 'PRCC' OR G_MAIN_OKCODE = 'CRPR'.
IF I_STORE_INFO[] IS INITIAL.
MESSAGE S161(ZS) WITH TEXT-004.
ELSE.
CLEAR G_FLAG.
LOOP AT I_STORE_INFO WHERE NOT REPROMO IS INITIAL.
G_FLAG = C_X.
EXIT.
ENDLOOP.
Prompt the message by calling the function module for pop-up confirm
IF NOT G_FLAG IS INITIAL.
CONCATENATE TEXT-061 TEXT-062
INTO G_POPUP_TEXT SEPARATED BY SPACE .
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT.
IF G_ANS = C_ANS1.
CLEAR G_ANS.
PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.
Begin of DEVK939178
Set top line of sku table to 1 and resolve nested screen calls
TBCL3-TOP_LINE = 1.
call screen 9002.
LEAVE TO SCREEN 9002.
End of DEVK939178
ENDIF.
ELSE.
PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.
Begin of DEVK939178
Set top line of sku table to 1 and resolve nested screen calls
TBCL3-TOP_LINE = 1.
LEAVE TO SCREEN 9002.
call screen 9002.
End of DEVK939178
ENDIF.
ENDIF.
ELSE.
If user does not input any store grouping info in the header screen
and opts to go to the detail, then message will appear to the user as
'A Promo is going to be applied on the Price List type '. This will
necessarily be a % promo as the promo is going to applied across all
the SKUs that belong to that price list type which is irrespective of
the price of individual SKUs
IF I_STORE_INFO[] IS INITIAL.
IF G_PRICING_VIEW_FLAG = C_X " DEVK939197
OR G_PROMO_VIEW_FLAG = C_X. " DEVK939197
LEAVE TO SCREEN 9002.
ELSE.
IF G_PROMO_PLTYP <> C_X.
CLEAR G_POPUP_TEXT.
CLEAR G_LINE_TEXT.
CONCATENATE TEXT-063 TEXT-062
INTO G_POPUP_TEXT SEPARATED BY SPACE .
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT.
IF G_ANS = C_ANS1.
If user opts 'Yes' then another screen will appear where the user can
give the value of the % promo that is going to be applied on the
pricelist type
G_PROMO_PLTYP = C_X.
Begin of DEVK939178
Set top line of sku table to 1 and resolve nested screen calls
CLEAR I_STORE_INFO.
I_STORE_INFO-LEVEL = C_LEVEL6.
APPEND I_STORE_INFO.
TBCL3-TOP_LINE = 1.
PERFORM CHECK_EXIST_PROMO_STR .
PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.
LEAVE TO SCREEN 9002.
call screen 9002.
End of DEVK939178
call screen 9006 starting at 10 5 ending at 70 10.
ELSE.
MESSAGE S161(ZS) WITH TEXT-004.
ENDIF.
ENDIF.
ENDIF.
ELSE.
CLEAR G_FLAG.
LOOP AT I_STORE_INFO WHERE NOT REPROMO IS INITIAL.
G_FLAG = 'X'.
EXIT.
ENDLOOP.
IF NOT G_FLAG IS INITIAL.
CONCATENATE TEXT-064 TEXT-062
INTO G_POPUP_TEXT SEPARATED BY SPACE .
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT.
IF G_ANS = C_ANS1.
CLEAR G_ANS.
PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.
Begin of DEVK939178
Set top line of sku table to 1 and resolve nested screen calls
TBCL3-TOP_LINE = 1.
LEAVE TO SCREEN 9002.
call screen 9002.
End of DEVK939178
ENDIF.
ELSE.
PERFORM EXISTING_SKU_BEFORE_DETAIL_SCR.
Begin of DEVK939178
Set top line of sku table to 1 and resolve nested screen calls
TBCL3-TOP_LINE = 1.
LEAVE TO SCREEN 9002.
call screen 9002.
End of DEVK939178
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*endif.
ENDFORM. " GOTO_SKU_HIER_SCREEN
*& Form ADD_LINE_STR_GRP
Add new entry to the store gropuing info
FORM ADD_LINE_STR_GRP.
G_OKCODE = OKCODE.
CLEAR I_STORE_INFO.
DESCRIBE TABLE I_STORE_INFO LINES L_LINE.
DO 15 TIMES.
I_STORE_INFO-LEVEL = C_LEVEL0.
APPEND I_STORE_INFO.
CLEAR I_STORE_INFO.
ENDDO.
G_ADD_CNT = G_ADD_CNT + 15.
G_LINE_CNT = 1.
ENDFORM. " ADD_LINE_STR_GRP
*& Form DELETE_LINE_STR_GRP
Delete selected entries which the user wants to perform a
delete operation .
FORM DELETE_LINE_STR_GRP.
If the store grouping table is blank then issue message
'No Entry is available for Selection.' .
IF I_STORE_INFO[] IS INITIAL.
MESSAGE S161(ZS) WITH TEXT-001.
ELSE.
Check if any entry in the store info table is checked for the delete
If selected, then issue a confirmation message to the user in pop-up
READ TABLE I_STORE_INFO WITH KEY SEL = C_X.
IF SY-SUBRC = 0.
CLEAR G_POPUP_TEXT.
CLEAR G_LINE_TEXT.
G_POPUP_TEXT = TEXT-065 .
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT .
If the user opts 'Yes' then delete the selected lines
IF G_ANS = C_ANS1.
DELETE I_STORE_INFO WHERE SEL = C_X.
MESSAGE S161(ZS) WITH TEXT-002.
ENDIF.
ELSE.
Do the same deletion operation even if user does not select the line
but puts the cursor in any line entry.
GET CURSOR LINE L_LINE.
IF SY-SUBRC = 0.
L_LINE = L_LINE + TBCL_HEAD1-TOP_LINE - 1.
CLEAR G_POPUP_TEXT.
G_POPUP_TEXT = TEXT-065.
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS
G_POPUP_TEXT
G_LINE_TEXT.
IF G_ANS = C_ANS1.
DELETE I_STORE_INFO INDEX L_LINE.
Upon successful delete operation issue a success message to the user
MESSAGE S161(ZS) WITH TEXT-002.
ENDIF.
ELSE.
MESSAGE S161(ZS) WITH TEXT-006.
ENDIF.
ENDIF.
ENDIF.
DESCRIBE TABLE I_STORE_INFO LINES G_ADD_CNT.
ENDFORM. " DELETE_LINE_STR_GRP
*& Form SELECT_ALL_ENTRIES
When the user selects the 'Select All' button, then select all the
entries of the store grouping table by setting the SEL field to X for
each entry
FORM SELECT_ALL_ENTRIES.
IF I_STORE_INFO[] IS INITIAL.
If the store grouping table is blank then issue message
'No Entry is available for Selection.' .
MESSAGE S161(ZS) WITH TEXT-001.
ELSE.
LOOP AT I_STORE_INFO .
I_STORE_INFO-SEL = C_X.
MODIFY I_STORE_INFO.
ENDLOOP.
G_OKCODE = OKCODE.
ENDIF.
ENDFORM. " SELECT_ALL_ENTRIES
*& Form DESELECT_ALL_ENTRIES
Deselect all the entries in the table
FORM DESELECT_ALL_ENTRIES.
IF I_STORE_INFO[] IS INITIAL.
If the store grouping table is blank then issue message
'No Entry is available for Selection.' .
MESSAGE S161(ZS) WITH TEXT-001.
ELSE.
LOOP AT I_STORE_INFO .
I_STORE_INFO-SEL = C_SPACE.
MODIFY I_STORE_INFO.
ENDLOOP.
ENDIF.
ENDFORM. " DESELECT_ALL_ENTRIES
*& Form SAVE_PROMO
Save the promo Event.
FORM SAVE_PROMO.
DATA: L_DATUM LIKE SY-DATUM,
L_SUBRC LIKE SY-SUBRC .
Populate dept/class/subclass if sku or style is not blank
PERFORM POPULATE_DEPT_CLASS.
DATA: G_PROMONO LIKE ZSDRETL_RMPHEAD-PP_ID.
IF G_PROMO_CHG_FLAG = C_X.
G_PROMONO = G_PROMO_ID.
ELSE.
Get number range for the promo
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = C_NR_OBJ1
OBJECT = C_NROBJ
QUANTITY = '1'
IGNORE_BUFFER = C_X
IMPORTING
NUMBER = G_PROMONO.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF NOT G_PROMONO IS INITIAL.
REFRESH I_RMPHEAD.
CLEAR WA_RMPHEAD.
If Override flag is set for any SKU end that promo first
READ TABLE I_SKU_INFO WITH KEY OVERRIDE = C_X.
IF SY-SUBRC = 0.
perform end_existing_promo .
ENDIF.
Populate Header information for Promo event
REFRESH I_RMPHEAD.
CLEAR WA_RMPHEAD.
IF SY-DYNNR = '9006'.
WA_RMPHEAD-PP_ID = G_PROMONO.
WA_RMPHEAD-ID_TYPE = C_P.
WA_RMPHEAD-PLTYP = ZPRICELIST-ZLIST.
WA_RMPHEAD-APPROVE = CHK_APR.
WA_RMPHEAD-ERDAT = SY-DATUM.
WA_RMPHEAD-ERNAM = SY-UNAME.
WA_RMPHEAD-ID_DESC = G_PDESC.
WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.
WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
WA_RMPHEAD-CLEARANCE = C_SPACE.
WA_RMPHEAD-PROMO_TYPE = G_PTYPE.
APPEND WA_RMPHEAD TO I_RMPHEAD.
CLEAR WA_RMPHEAD.
ELSE.
WA_RMPHEAD-PP_ID = G_PROMONO.
WA_RMPHEAD-ID_TYPE = C_P.
WA_RMPHEAD-PLTYP = G_PRICELIST.
WA_RMPHEAD-APPROVE = CHK_APR.
WA_RMPHEAD-ERDAT = SY-DATUM.
WA_RMPHEAD-ERNAM = SY-UNAME.
WA_RMPHEAD-ID_DESC = G_PDESC.
WA_RMPHEAD-START_DATE = ZSDRETL_RMPHEAD-START_DATE.
L_SUBRC = 4.
LOOP AT I_SKU_INFO.
IF I_SKU_INFO-END_DATE GE ZSDRETL_RMPHEAD-START_DATE .
if i_sku_info-end_date ge sy-datum.
L_SUBRC = 0.
EXIT.
ENDIF.
ENDLOOP.
IF L_SUBRC = 4.
L_DATUM = ZSDRETL_RMPHEAD-START_DATE - 1.
l_datum = sy-datum - 1.
WA_RMPHEAD-END_DATE = L_DATUM.
ELSE.
WA_RMPHEAD-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
ENDIF.
WA_RMPHEAD-CLEARANCE = G_CHK_CLR.
WA_RMPHEAD-PROMO_TYPE = G_PROMO_TYPE.
APPEND WA_RMPHEAD TO I_RMPHEAD.
CLEAR WA_RMPHEAD.
ENDIF.
IF NOT I_RMPHEAD[] IS INITIAL.
MODIFY ZSDRETL_RMPHEAD FROM TABLE I_RMPHEAD.
IF SY-SUBRC = 0.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-067.
COMMIT WORK.
ENDIF.
ENDIF.
Populate Store information for Promo event
REFRESH I_RMPSTORE.
CLEAR WA_RMPSTORE.
IF SY-DYNNR = '9006' OR G_PROMO_PLTYP = C_X.
WA_RMPSTORE-PP_ID = G_PROMONO.
WA_RMPSTORE-RECNO = 0.
WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.
WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
WA_RMPSTORE-STORE_LEVEL = C_LEVEL6.
WA_RMPDETAIL-ID_TYPE = C_P.
WA_RMPDETAIL-PLTYP = G_PRICELIST.
APPEND WA_RMPSTORE TO I_RMPSTORE.
CLEAR WA_RMPSTORE.
ELSE.
LOOP AT I_STORE_INFO.
WA_RMPSTORE-PP_ID = G_PROMONO.
WA_RMPSTORE-RECNO = SY-TABIX.
WA_RMPSTORE-START_DATE = ZSDRETL_RMPHEAD-START_DATE.
WA_RMPSTORE-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
WA_RMPSTORE-REGION_ID = I_STORE_INFO-REGION_ID.
WA_RMPSTORE-DIST_ID = I_STORE_INFO-DIST_ID.
WA_RMPSTORE-AREA_ID = I_STORE_INFO-AREA_ID.
WA_RMPSTORE-STORE_ID = I_STORE_INFO-STORE_ID.
WA_RMPSTORE-ATTR_VAL = I_STORE_INFO-ATTR_VAL.
WA_RMPSTORE-STORE_LEVEL = I_STORE_INFO-LEVEL.
WA_RMPSTORE-ID_TYPE = C_P.
WA_RMPSTORE-PLTYP = G_PRICELIST.
APPEND WA_RMPSTORE TO I_RMPSTORE.
CLEAR WA_RMPSTORE.
ENDLOOP.
ENDIF.
IF NOT I_RMPSTORE[] IS INITIAL.
IF NOT I_RMPSTORE_TEMP[] IS INITIAL.
READ TABLE I_RMPSTORE_TEMP INTO WA_RMPSTORE INDEX 1.
IF SY-SUBRC = 0.
PERFORM ENQUEUE USING WA_RMPSTORE-PP_ID.
ENDIF.
DELETE ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE_TEMP.
IF SY-SUBRC = 0.
COMMIT WORK.
PERFORM DEQUE.
REFRESH I_RMPSTORE_TEMP.
ENDIF.
ENDIF.
MODIFY ZSDRETL_RMPSTORE FROM TABLE I_RMPSTORE.
IF SY-SUBRC = 0.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-066.
COMMIT WORK.
ENDIF.
ENDIF.
Populate SKU information for Promo event
CLEAR: WA_RMPDETAIL , I_RMPDETAIL[].
IF SY-DYNNR = '9006'.
WA_RMPDETAIL-PP_ID = G_PROMONO.
WA_RMPDETAIL-RECNO = 0.
WA_RMPDETAIL-START_DATE = ZSDRETL_RMPHEAD-START_DATE.
WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
WA_RMPDETAIL-VALUE = G_VAL_PLTYP.
WA_RMPDETAIL-ZLEVEL = C_LEVEL1.
APPEND WA_RMPDETAIL TO I_RMPDETAIL.
CLEAR WA_RMPDETAIL.
ELSE.
LOOP AT I_SKU_INFO.
WA_RMPDETAIL-PP_ID = G_PROMONO.
WA_RMPDETAIL-RECNO = SY-TABIX.
WA_RMPDETAIL-START_DATE = I_SKU_INFO-START_DATE.
IF ZSDRETL_RMPHEAD-END_DATE LT ZSDRETL_RMPHEAD-START_DATE.
if zsdretl_rmphead-end_date lt sy-datum.
WA_RMPDETAIL-END_DATE = ZSDRETL_RMPHEAD-END_DATE.
ELSE.
WA_RMPDETAIL-END_DATE = I_SKU_INFO-END_DATE.
ENDIF.
WA_RMPDETAIL-DEPT = I_SKU_INFO-DEPT.
WA_RMPDETAIL-CLASS = I_SKU_INFO-CLASS.
WA_RMPDETAIL-SUB_CLASS = I_SKU_INFO-SUB_CLASS.
WA_RMPDETAIL-STYLE = I_SKU_INFO-STYLE.
WA_RMPDETAIL-SKU = I_SKU_INFO-SKU.
WA_RMPDETAIL-VALUE = I_SKU_INFO-VALUE.
WA_RMPDETAIL-BASIC_PRICE = I_SKU_INFO-KBETR.
WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.
WA_RMPDETAIL-TOP_UP = I_SKU_INFO-TOP_UP.
WA_RMPDETAIL-OVERRIDE = I_SKU_INFO-OVERRIDE.
WA_RMPDETAIL-ZLEVEL = I_SKU_INFO-TYPE.
WA_RMPDETAIL-REF_PROMO = I_SKU_INFO-REF_PROMO.
WA_RMPDETAIL-ID_TYPE = C_P.
WA_RMPDETAIL-PLTYP = G_PRICELIST.
APPEND WA_RMPDETAIL TO I_RMPDETAIL.
CLEAR WA_RMPDETAIL.
ENDLOOP.
ENDIF.
IF NOT I_RMPDETAIL[] IS INITIAL.
IF NOT I_RMPDETAIL_TEMP[] IS INITIAL.
READ TABLE I_RMPDETAIL_TEMP INTO WA_RMPDETAIL INDEX 1.
IF SY-SUBRC = 0.
PERFORM ENQUEUE USING WA_RMPDETAIL-PP_ID.
ENDIF.
DELETE ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL_TEMP.
IF SY-SUBRC = 0.
COMMIT WORK.
PERFORM DEQUE.
REFRESH I_RMPDETAIL_TEMP.
ENDIF.
ENDIF.
MODIFY ZSDRETL_RMPDETL FROM TABLE I_RMPDETAIL.
IF SY-SUBRC = 0.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-068.
COMMIT WORK.
ENDIF.
ENDIF.
IF SY-SUBRC = 0.
IF G_PROMO_CHG_FLAG = C_X.
MESSAGE S161(ZS)
WITH TEXT-046 G_PROMONO TEXT-048.
ELSE.
MESSAGE S161(ZS)
WITH TEXT-046 G_PROMONO TEXT-049.
ENDIF.
LEAVE TO SCREEN 9000.
ENDIF.
ENDIF.
ENDFORM. " SAVE_PROMO
*& Form EXIT_FROM_HEADER_SCREEN
Exit from header screen
FORM EXIT_FROM_HEADER_SCREEN.
in case of view promo and view pricing , come back to the view/copy
screen
IF G_MAIN_OKCODE = 'VRPR' AND ( G_PROMO_VIEW_FLAG = C_X
OR G_PRICING_VIEW_FLAG = C_X ).
LEAVE TO SCREEN 9007.
ELSE.
if store grouping info table is empty then come back to the main menu
IF I_STORE_INFO[] IS INITIAL.
LEAVE TO SCREEN 9000.
ELSE.
if store grouping info contains a blank record then come to main menu
READ TABLE I_STORE_INFO INDEX 1.
IF SY-SUBRC = 0 AND I_STORE_INFO-REGION_ID IS INITIAL
AND I_SKU_INFO[] IS INITIAL.
LEAVE TO SCREEN 9000.
ENDIF.
if SKU info table is blank then issue message if the user wants to
exit from the header screen without entring the promo/pricing detail
IF I_SKU_INFO[] IS INITIAL.
CLEAR G_ANS .
IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.
G_POPUP_TEXT = TEXT-069.
ELSE.
G_POPUP_TEXT = TEXT-070.
ENDIF.
Call FM for pop-up message
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.
IF G_ANS = C_ANS1.
LEAVE TO SCREEN 9000.
ENDIF.
ELSE.
if sku info is avilable & user presses exit then a message is issued
if the user wants to leave without saving the promo/pricing event
CLEAR G_ANS .
IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.
G_POPUP_TEXT = TEXT-071.
ELSE.
G_POPUP_TEXT = TEXT-072.
ENDIF.
Call FM for pop-up message
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.
If user presses 'Yes' then go back to the main menu
IF G_ANS = C_ANS1.
LEAVE TO SCREEN 9000.
if user pressed 'No' then prompts the message if the user wants to go
back without saving if it says 'Yes' , then go to the main menu and if
it says 'No' then save the event and go back to main menu
ELSEIF G_ANS = C_ANS2.
CLEAR G_ANS .
message s161(zs) with text-164.
exit.
IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.
G_POPUP_TEXT = TEXT-073.
ELSE.
G_POPUP_TEXT = TEXT-074.
ENDIF.
Call FM for pop-up message
CLEAR G_LINE_TEXT.
PERFORM GET_POPUP_CONFIRM USING G_ANS G_POPUP_TEXT G_LINE_TEXT.
IF G_ANS = C_ANS1.
IF G_MAIN_OKCODE = 'CRPR' OR G_MAIN_OKCODE = 'PRCC'.
Call save pricing subroutine to save the pricing event
MESSAGE S161(ZS) WITH TEXT-164.
perform save_pricing.
ELSE.
Call save promo subroutine to save the promo event
perform save_promo.
MESSAGE S161(ZS) WITH TEXT-164.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " EXIT_FROM_HEADER_SCREEN
*& Form VIEW_PROMOS
Call subroutine to view all the pre-existing promos that are
available for the selected lines
FORM VIEW_PROMOS.
CASE SY-DYNNR.
WHEN '9001'.
G_DYNNR = SY-DYNNR.
Display all the promo that are already exist for the selected entries
in store grouping table
Begin of DEVK939178
logic is changed to check if any existing promo available with higher
store hierarchy
PERFORM VIEW_PRE_PROMO_STRGRP.
End of DEVK939178
WHEN '9002'.
G_DYNNR = SY-DYNNR.
Display all the promo that are already exist for the selected entries
in sku hierarchy table
Begin of DEVK939196
PERFORM VIEW_PROMO_FOR_SKUHIER1 .
End of DEVK939196
ENDCASE.
ENDFORM. " VIEW_PROMOS
*& Form VIEW_PRICING
View the existing pricing if available for an entry
FORM VIEW_PRICING.
CASE SY-DYNNR.
WHEN '9001'.
G_DYNNR = SY-DYNNR.
Display all the pricings that are already exist for selected entries
in store grouping table
PERFORM VIEW_PRE_PROMO_STRGRP .
WHEN '9002'.
G_DYNNR = SY-DYNNR.
Display all the pricings that are already exist for selected entries
in sku hierarchy table
PERFORM VIEW_PROMO_FOR_SKUHIER1.
ENDCASE.
ENDFORM. " VIEW_PRICING
*& Form VIEW_PROMO_FOR_STRGRP
Prepare the ALV scenarios to display the existing promos
FORM VIEW_PROMO_FOR_STRGRP.
REFRESH I_FIELDCAT.
CLEAR I_FIELDCAT.
Populate the field catalogue table for Stor grouping fields
PERFORM POPULATE_CATALOGUE USING:
Position Fieldname Tablename Title Display
'01' 'REGION_ID' 'I_STR_GRP1' TEXT-075 ' ',
'02' 'DIST_ID' 'I_STR_GRP1' TEXT-076 ' ',
'03' 'AREA_ID' 'I_STR_GRP1' TEXT-077 ' ',
'04' 'ATTR_VAL' 'I_STR_GRP1' TEXT-078 ' ',
'05' 'STORE_ID' 'I_STR_GRP1' TEXT-079 ' ',
'06' 'PP_ID' 'I_STR_GRP1' TEXT-084 ' ',
'07' 'START_DATE' 'I_STR_GRP1' TEXT-082 ' ',
'08' 'END_DATE' 'I_STR_GRP1' TEXT-083 ' ',
'09' 'PROMO_TYPE' 'I_STR_GRP1' TEXT-080 ' ',
'10' 'CLEARANCE' 'I_STR_GRP1' TEXT-081 ' ',
'11' 'ID_DESC' 'I_STR_GRP1' TEXT-161 ' '.
LOOP AT I_FIELDCAT INTO STRUCT_CAT.
CASE STRUCT_CAT-FIELDNAME.
WHEN 'PROMO_TYPE'.
IF G_PROMO_FLAG = C_X.
STRUCT_CAT-NO_OUT = C_SPACE.
ELSE.
STRUCT_CAT-NO_OUT = C_X.
ENDIF.
WHEN 'CLEARANCE'.
IF G_PROMO_FLAG = C_X.
STRUCT_CAT-NO_OUT = C_SPACE.
ELSE.
STRUCT_CAT-NO_OUT = C_X.
ENDIF.
WHEN 'START_DATE'.
IF G_PROMO_FLAG = C_X.
STRUCT_CAT-REPTEXT_DDIC = TEXT-082.
ELSE.
STRUCT_CAT-REPTEXT_DDIC = TEXT-085.
ENDIF.
WHEN 'END_DATE'.
IF G_PROMO_FLAG = C_X.
STRUCT_CAT-REPTEXT_DDIC = TEXT-083.
ELSE.
STRUCT_CAT-REPTEXT_DDIC = TEXT-086.
ENDIF.
WHEN 'PP_ID'.
IF G_PROMO_FLAG = C_X.
STRUCT_CAT-REPTEXT_DDIC = TEXT-084 .
ELSE.
STRUCT_CAT-REPTEXT_DDIC = TEXT-088.
ENDIF.
ENDCASE.
MODIFY I_FIELDCAT FROM STRUCT_CAT INDEX SY-TABIX.
ENDLOOP.
CLEAR STRUCT_LAYOUT.
STRUCT_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
IF G_PROMO_FLAG = C_X.
STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-089.
ELSE.
STRUCT_LAYOUT-WINDOW_TITLEBAR = TEXT-090.
ENDIF.
STRUCT_LAYOUT-ZEBRA = C_X.
Populate sort table
PERFORM POPULATE_SORT_TABLE.
populate event table
PERFORM POPULATE_EVENT_TABLE.
Call function to display the list of existing promos in ALV format
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
IS_LAYOUT = STRUCT_LAYOUT
IT_FIELDCAT = I_FIELDCAT
IT_SORT = I_SORTTAB[]
IT_EVENTS = I_EVENT[]
TABLES
T_OUTTAB = I_STR_GRP1
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. " VIEW_PROMO_FOR_STRGRP
*& Form POPULATE_CATALOGUE
Populating general informations for output format
-->p_position Column position
-->p_fname Field name
-->p_tabname Internal table name
-->p_title Title
-->p_display Display/No display
FORM POPULATE_CATALOGUE USING P_POSITION TYPE SYCUCOL
P_FNAME TYPE FIELDNAME
P_TABNAME TYPE TABNAME
P_TITLE TYPHi sahil,
probably one or more fields used for comparison in for all entries where clause is not part of the refered table. The error is given for one of your for all entries select - I don't know which one it was. Check this condition: Are all fields like i.e. I_SKU_HIER-PP_ID parts of the used tables?
Maybe ther is a typo.
Regards,
Clemens -
Stuck with the paint and repaint methods
I am supposed to create a JApplet with a button and a background color. When the button is clicked the first time a word is supposed to appear (I got that part), when the button is clicked the second time the word is supposed to appear again in a different color and in a different location on the Applet (I got that part).
The problem is that the first name is supposed to disappear when the second word appears. So I know I have to repaint the screen when the button is clicked the second time and draw the first string in the same color as the background color to make it invisible.
My problem is I am not sure how I can code to apply different settings each time the button is clicked. Can anyone help? Please let me know if my explanation sucks. I will try to explain better. However here is the code I have so far. I added a counter for the button just for testing purposes.
I just need some hints on what to do and if there is a easier way than using that if statement please let me know. I probably make it harder than it is.
Thanks in advance and Merry Christmas.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DisplayMyName extends JApplet
implements ActionListener
String myName = "DOG";
String myName1 = "DOG";
JButton moveButton = new JButton("Move It");
Font smallFont = new Font("Arial", Font.BOLD, 12);
Font largeFont = new Font("Lucida Sans", Font.ITALIC, 20);
int numClicks = 0;
JLabel label = new JLabel("Number of button clicks:" + numClicks);
public void init()
Container con = getContentPane();
con.setBackground(Color.RED);
con.setLayout( new FlowLayout() );
con.add(moveButton);
con.add(label);
moveButton.addActionListener(this);
public void paint(Graphics g)
numClicks++;
label.setText("Number of button clicks: " + numClicks);
if (numClicks == 2)
{ g.setFont(smallFont);
g.setColor(Color.BLUE);
g.drawString(myName, 50, 100);
else
if (numClicks == 3)
{ g.setFont(largeFont);
g.setColor(Color.YELLOW);
g.drawString(myName, 100, 200);
public void actionPerformed(ActionEvent move)
repaint();
}You're putting your program logic in the paint method, something you should not do. For instance, try resizing your applet and see what effect that has on number of button clicks displayed. This is all a side effect of the logic being in the paint method.
1) Don't override paint, override paintComponent.
2) Don't draw/paint directly in the JApplet. Do this in a JPanel or JComponent, and then add this to the JApplet. In fact I'd add the button, the and the label to the JPanel and add the label to the JApplet's contentPane (which usually uses BorderLayout, so it should fill the applet).
3) Logic needs to be outside of paint/paintComponent. the only code in the paintComponent should be the drawing/painting itself. The if statements can remain within the paintComponent method though.
4) When calling repaint() make sure you do so on the JPanel rather than the applet itself.
For instance where should numClicks++ go? Where should the code to change the label go? in the paint/paintComponent method? or in the button's actionlistener? which makes more sense?
Edited by: Encephalopathic on Dec 24, 2008 9:37 AM
Maybe you are looking for
-
"The operation could not be completed" using iMovie 10.0.6
I'm using the new iMovie 10.0.6 with OS X Yosemite 10.10. This is the first time I access to iMovie after upgrade to Yosemite. When I try to begin a new movie and after select a theme the following message is shown: "The operation could not be comple
-
What is wrong with my Macbook?
I dropped my macbook (2007 model) and the screen is so cracked that I can not see anything. I got a mini-dvi - vga cord and plugged it into a monitor, but when i turn it on, it just goes to the mac background, and will not show the login screen. What
-
My ipad is very slow. Already rebooted it and still has the problem.
I have an ipad 3 and istalled Ios6 three weeks ago. It had no performance problem. Today, the ipad is running slow. When typing, it takes a while until the letters fo to the text boxes. When using intensive touch screen apps, it takes 2 sseconds to m
-
Hello -- I am trying to export a document from Illustrator CS4 as a .jpg, but want to export JUST the artboard, not all the images that go off the edge of it. In the past, all I had to do was to make Crop Marks around the artboard and away we go! N
-
I need to display the data of smartform in the printed paper (Invoice)
Hi Experts, I have a requirement where i need to print the invoice. The paper is already printed with respective Text. When this printed paper is placed to the printer, I need to print my data in the respective places. The standard output type is rd0