Axis - Using type safe enumerations as parameters.
I defined the following:
interface A {
foo(E x);
where class E is a type safe enumeration (NOT a Java1.5 enum).
When using java2wsdl | wsdl2java i get:
interface A' {
foo(String x);
And then all the stubs and skeletons are implementing A' so I can't use my A. How can I stop axis from doing this?
Hi,
AFAIK, you can't. I'm not an expert though, so everything below may not be the best solution.
The best way I have found for dealing with enums is to declare them as such in your schema, viz:
<simpleType name="HoldStatus">
<annotation>
<documentation>The status of a hold.</documentation>
</annotation>
<restriction base="string">
<enumeration value="INACTIVE"/>
<enumeration value="ACTIVE"/>
</restriction>
</simpleType>Then, most WSDL->Java tools will do something sensible with this, making their own form of enum. I don't know about Axis, but Weblogic's wsdl2service does this.
Then you still have to map between the generated enum and your one. This is the best solution I'm aware of, though.
As far as running java2wsdl then wsdl2java - I'm not aware of any tools that will do 'round tripping' like this successfully. I'd be keen to hear of some if there are any though :-D
-Tim
Similar Messages
-
Generics simply aren't type-safe?
From http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf page 15:
In particular, the language is designed to guarantee that if your entire application has been compiled without unchecked warnings using javac -source 1.5, it is type safe.
However, I can create this:
import java.util.*;
public class TypeUnsafe
static public <T extends Collection> void workaround(T a, T b)
a.addAll(b);
static public void main(String[] args)
Collection<Integer> a = new ArrayList<Integer>();
Collection<String> b = new ArrayList<String>();
b.add("Bwahahaha");
workaround(a, b);
System.out.println(a.iterator().next().intValue()); // ClassCastException
}There are no casts or particular trickery involved, and this compiles without warnings using javac -source 1.5. Yet I just added a String to a Collection<Integer>. Despite T being defined as extending a raw type, the usual unchecked warning when calling a method with parameterised arguments on a raw type is not given.
On the positive side, it gives me a handy alternative to the NYI @SuppressWarnings :)
I've searched bug parade and the forums, but haven't come across this particular problem... I've only recently started playing with generics, so perhaps I'm missing some subtlety that explains why people aren't jumping up and down and screaming about this.
Sorry if this has been discussed before, and I'm not yet familiar enough with the terminology to have found it in my searches.Few thoughts:
- The program kingguppy has presented is an example of program with false sense of security despite using generics - the generic program compiles even without a warning but in the end it throws ClassCastException. I hope that we won't find many generic programs with such characteric. I'd say that the program does not benefit of generics because there is no contract between container and containee as far as parameters of workaround() method are concerned. Actually, as Michael said, it uses raw type (Collection). If possible we should avoid using raw types in generic programs. By the way, do you know that raw types might be deprecated in the future?
- Micheal also sugested that in case when there is a conversion from parameterized type to raw type the compiler should emit a warning. I agree with him. I hope that kingguppy will file a bug report and let us know what "generic gurus" think about it. Funny, if the workaround() method were designed as
static public void notGenerifiedMethod(Collection a, Collection b) {
a.addAll(b);
}the compiler would actually emit an unchecked warning. Perhaps, it's sometimes better not to use generified methods.
- The reason why I presented let's say a possible or different solution to the original problem is because in the end it matters only if we, developers, can produce a workable solution. The bosses don't like to hear that there are bugs... I hope you all know what I mean. Who knows, there might be a reader of this forum who will find it useful.
Your thoughts are welcomed.
Andrej -
J2SE 6 warning message when using type casting
With Java SE 5 and 6 version, there's always an annoying warning message when I write the following code:
LinkedList<MyBean> cart0 = (LinkedList<MyBean>) session.getAttribute("cart");The warning message is because I use the type casting with the getAttribute method and thus this is not type-safe. So how do I get around the warning message and write standard code that sticks to the J2SE 6 standards? Thank you.Add a @SuppressWarnings annotation to the method. A bit intelligent IDE will provide you a quickfix option for it.
Keep in mind: it's a warning, not an error. The sessionMap is cannot be specifically parameterized and will never be, it should be able to store any object to your taste. Further on this has not much to do with JSF at itself. -
Using TYPES with out in a procedure
Can you use TYPES with the OUT parameter when executing a procedure?
CREATE OR REPLACE PROCEDURE get_assoc_status (fin_aor_id IN ASSOCIATE_OFFICE_RECORDS.ASSOCIATE_OFFICE_RECORD_ID%TYPE,
v_amr_id OUT ASSOCIATE_MASTER_RECORDS.ASSOCIATE_MASTER_RECORD_ID%TYPE, ....
In all documentation where I've looked procedures up, all the examples use internal defined types, like NUMBER, VARCHAR2,etc...It seems like there shouldn't be a problem but I keep getting this message:
Error at line 2
ORA-06550: line 2, column 70:
PLS-00103: Encountered the symbol "," when expecting one of the following:
:= ( ; not null range default character
ORA-06550: line 9, column 1:Yes, you can use typed output parameters:
sql>create or replace procedure p_test(p_empno in emp.empno%type, p_sal out emp.sal%type)
2 is
3 begin
4 select sal
5 into p_sal
6 from emp
7 where empno = p_empno;
8 end;
9 /
Procedure created.
sql>var the_salary number
sql>exec p_test(7369, :the_salary)
PL/SQL procedure successfully completed.
sql>print the_salary
THE_SALARY
800 -
Type safe bean interfaces (Java 5) and JBoss IDE
I've posted this help request already in the appropriate JBoss forum.
But unfortunately still without any response.
Latest JBoss IDE versions support type safe business methods e.g. like
* only for testing
* @ejb.interface-method view-type = "both"
* @ejb.permission role-name = "Default"
public ArrayList<String> getSomeStrings()
}But the interface methods will be always generated unsafe like
* only for testing
public java.util.ArrayList getSomeStrings( )
throws java.rmi.RemoteException;Is this a known problem or is something wrong with my xdoclet configuration?
Thanks in advance
TorstenYep... I think that's what I found. By using public methods in my enum class to map it's string member to the EJB field I was able to effectively use my enum in the EJB. The container does it work with a String but the EJB's clients only deal with a enum field. That's what I originally intended so, thanks for your response.
-
Associated table type of the Table parameters in function module
Hi,
If I want to select all the associated table types of the Table parameters used in a given function module in a report, how can that be done ?
Thanks.
Regards,
RajeshTry this.
report zrich_0001 .
data: import type table of rsimp with header line,
change type table of rscha with header line,
export type table of rsexp with header line,
tables type table of rstbl with header line,
except type table of rsexc with header line,
docume type table of rsfdo with header line,
source type table of rssource with header line.
parameters: p_func type rs38l-name.
call function 'RPY_FUNCTIONMODULE_READ'
exporting
functionname = p_func
tables
import_parameter = import
changing_parameter = change
export_parameter = export
tables_parameter = tables
exception_list = except
documentation = docume
source = source
exceptions
error_message = 1
function_not_found = 2
invalid_name = 3
others = 4.
loop at tables.
write:/ tables-parameter,
tables-dbstruct,
tables-types,
tables-optional,
tables-typ,
tables-class,
tables-ref_class,
tables-line_of,
tables-table_of.
endloop.
Regards,
Rich Heilman -
What does it mean by "Deprecation of MBeanHome and Type-Safe Interfaces" ?
The "Javadoc" for the type safe WebLogic MBean interfaces have this disclaimer;
Deprecation of MBeanHome and Type-Safe Interfaces... This is a type-safe interface for a WebLogic Server MBean, which you can import into your client classes and access through weblogic.management.MBeanHome. As of 9.0, the MBeanHome interface and all type-safe interfaces for WebLogic Server MBeans are deprecated. Instead, client classes that interact with WebLogic Server MBeans should use standard JMX design patterns in which clients use the javax.management.MBeanServerConnection interface to discover MBeans, attributes, and attribute types at runtime.
Link: http://otndnld.oracle.co.jp/document/products/wls/docs100/javadocs_mhome/weblogic/management/configuration/DomainMBean.html
I don't understand what this means;
1) Is all the WebLogic MBean interfaces in the "weblogic.management.configuration.*" deprecated?
2) Is the usage of MBeanTypeService also deprecated. since it requires the an WebLogic MBean interface as input for it's getMBeanInfo method?
3) If the WebLogic MBean interfaces will dispear, wil there be any reliable source for type information about WebLogic MBean since the information returned by MBeanTypeService.getMbeanInfo(), MBeanserver.getMbeanInfo() or WebLogicObjectName.getMbeanInfo() isn't consist in its naming schemes (tries to but..)?Hi,
While scheduling background job, you can trigger the job based on existing job status as dependency or schedule the job based on the SAP Event.
Dependency Job like first background job completes successfully then second followup job will executed other job will not triggered.
Event Jobs: While importing data through transportation, some RDD* jobs automatically triggers. These are event based jobs.
Regards,
Ganesh
****Reward points if Helpful***** -
Symaltaneous use of select-option and parameters in smartforms .
hello Abaper,
I am design a smartforms . we have given some input. when we use only parameters it works properly. as same when we use select-option only its works .
But when i use both parameter and select option at that time error generate .
Actually call function is not works .
So please give me proper idea how to solve this problem .
Regards
kamal kishoreHi ,
Still problem is not solved.
i want to call following fields but function modules show run time error. IF separately i call only parameter its run properly.
in the same way if i call only select option is runs properly.
please suggest me how can i call both the things.
PARAMETERS: P_BUKRS TYPE BSEG-BUKRS OBLIGATORY,
P_GJAHR TYPE BSEG-GJAHR OBLIGATORY.
parameters: P_SECCO type SECCODE-SECCODE OBLIGATORY.
*SELECT-OPTIONS : P_SECCO FOR SECCODE-SECCODE OBLIGATORY.
PARAMETERS: P_QSCOD TYPE J_1IEWTNUMGR-QSCOD OBLIGATORY.
SELECT-OPTIONS: P_BUDAT FOR BKPF-BUDAT OBLIGATORY,
P_BLART FOR BKPF-BLART,
P_J_HLN FOR J_1IEWTCHLN-J_1IEXTCHLN,
P_J_HDT FOR J_1IEWTCHLN-J_1IEXTCHDT OBLIGATORY,
P_LIFNR FOR LFB1-LIFNR.
regards
kamal
Edited by: kamal_kishore_sah on Apr 12, 2011 7:44 AM -
What are the function modules used in interactive ALV and parameters?
what are the function modules used in interactive ALV and parameters?
hi sunil
check these links,
About ALV:
http://www.geocities.com/mpioud/Abap_programs.html
ALV Group Heading
http://www.sap-img.com/fu037.htm
and few more,
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
also run the folowing code and see
check this sample code.you will be well versed with all the events of a interactive alv report.mark points if useful.
*& Report ZALV4_INTERACTIVE *
*& interactive alvs *
REPORT ZALV4_INTERACTIVE NO STANDARD PAGE HEADING
MESSAGE-ID ZMSG
LINE-COUNT 37(3)
LINE-SIZE 134.
TYPE-POOLS : SLIS.
TABLES DECLARATION ********************
TABLES : VBRK, " BILLING MASTERS TABLE
VBRP. " BILLING ITEM TABLE
TYPES DECLARATION ********************
TYPES : BEGIN OF TY_VBRK, " types for billing masters table
VBELN TYPE VBRK-VBELN, " billing document
WAERK TYPE VBRK-WAERK, " document currency
VKORG TYPE VBRK-VKORG, " sales organization
FKDAT TYPE VBRK-FKDAT, " billing date
BUKRS TYPE VBRK-BUKRS, " company code
BUTXT TYPE T001-BUTXT, " company name
NETWR TYPE VBRK-NETWR, " net currency value
LINE_COLOR(4) TYPE C,
END OF TY_VBRK.
TYPES : BEGIN OF TY_VBRP, " types for billing document item data
POSNR TYPE VBRP-POSNR, " billing item
FKIMG TYPE VBRP-FKIMG, " actual invoiced quantitty
VRKME TYPE VBRP-VRKME, " sales unit
NETWR TYPE VBRP-NETWR, " net currency value
MATNR TYPE VBRP-MATNR, " material number
ARKTX TYPE VBRP-ARKTX, " short text for sales order item
END OF TY_VBRP.
FIELD CATALOG ********************
DATA : WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.
LAYOUT DECLARATION ********************
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
EVENTS DECLARATION ********************
DATA : TY_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
PF STATUS ********************
DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
USER COMMAND ********************
DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
R_UCOMM LIKE SY-UCOMM.
INTERNAL TABLES ********************
DATA : IT_VBRK TYPE TABLE OF TY_VBRK, "internal table for billing master
IT_VBRP TYPE TABLE OF TY_VBRP, "internal table for billing item
*internal table for field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
WORK AREA ********************
DATA : WA_VBRK LIKE LINE OF IT_VBRK, "work area for billing master
WA_VBRP LIKE LINE OF IT_VBRP. "work area for billing item
VARIABLE DECLARATION ********************
DATA : V_DATE TYPE SY-DATUM, " variable to store date values
V_VBELN TYPE VBRK-VBELN, " variable for billing document
V_FKDAT TYPE VBRK-FKDAT, " variable for billing date
V_FLAG(1). " variable for flag
SELECTION SCREEN ********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN , " Billing document
S_FKDAT FOR VBRK-FKDAT, " Billing date
S_MATNR FOR VBRP-MATNR. " Material number
PARAMETERS : R1 RADIOBUTTON GROUP G1, "whole item details
R2 RADIOBUTTON GROUP G1. "selected item details
INITIALIZATION ********************
INITIALIZATION.
V_FLAG = 'X'.
V_DATE = SY-DATUM - 20.
S_FKDAT-SIGN = 'I'.
S_FKDAT-OPTION = 'EQ'.
S_FKDAT-LOW = V_DATE.
S_FKDAT-HIGH = SY-DATUM.
APPEND S_FKDAT.
SELECTION SCREEN VALIDATION ********************
AT SELECTION-SCREEN.
PERFORM CONVERSION. " performs data conversion for input
PERFORM VBELN_VALIDATE. " validating the billing document
PERFORM FKDAT_VALIDATE. " validating the billing date
START OF SELECTION ********************
START-OF-SELECTION.
SET TITLEBAR 'AAAA'.
PERFORM VBRK_POPULATE. " populating the billing master detais
PERFORM FIELDCATALOG. " designing the field catalog
PERFORM EVENTS. " performing the events for top of page
PERFORM DISP_BASICLIST." displaying the basic list
*& Form VBELN_VALIDATE
text validating the billing document
--> p1 text
<-- p2 text
FORM VBELN_VALIDATE .
IF S_VBELN IS INITIAL.
MESSAGE E000 WITH 'Make entries in all required fields'.
ELSE.
SELECT SINGLE VBELN
FROM VBRK
INTO V_VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'BILLING DOCUMENT DOESNT EXIST'.
ENDIF.
ENDIF.
ENDFORM. " VBELN_VALIDATE
*& Form FKDAT_VALIDATE
text validating the billing date
--> p1 text
<-- p2 text
FORM FKDAT_VALIDATE .
SELECT SINGLE FKDAT
FROM VBRK
INTO V_FKDAT
WHERE FKDAT IN S_FKDAT.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'BILLING DATE DOESNT EXIST'.
ENDIF.
ENDFORM. " FKDAT_VALIDATE
*& Form VBRK_POPULATE
text populating the billing master details
--> p1 text
<-- p2 text
FORM VBRK_POPULATE .
DATA : LD_COLOR(1) TYPE C.
LD_COLOR = 5.
SELECT VBRK~VBELN
VBRK~WAERK
VBRK~VKORG
VBRK~FKDAT
VBRK~BUKRS
VBRK~NETWR
T001~BUTXT
FROM VBRK INNER JOIN T001
ON VBRKBUKRS = T001BUKRS
INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
WHERE VBRK~VBELN IN S_VBELN AND
VBRK~FKDAT IN S_FKDAT.
LOOP AT IT_VBRK INTO WA_VBRK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBRK-LINE_COLOR.
MODIFY IT_VBRK FROM WA_VBRK.
ENDLOOP.
ENDFORM. " VBRK_POPULATE
*& Form CONVERSION
text data conversion to take leading zeroes into account
--> p1 text
<-- p2 text
FORM CONVERSION .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = S_VBELN
IMPORTING
OUTPUT = S_VBELN.
ENDFORM. " CONVERSION
*& Form DISP_BASICLIST
text displaying the basic list
--> p1 text
<-- p2 text
FORM DISP_BASICLIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = PF_STATUS
I_CALLBACK_USER_COMMAND = USER_COMMAND
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRK
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. " DISP_BASICLIST
*& Form FIELDCATALOG
text designing the field catalog
--> p1 text
<-- p2 text
FORM FIELDCATALOG .
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DOCUMENT'.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-EMPHASIZE = 'C610'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'DOCUMENT CURRENCY'.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'VKORG'.
WA_FIELDCAT-SELTEXT_L = 'SALES ORGANIZATION'.
WA_FIELDCAT-EMPHASIZE = 'C610'.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'FKDAT'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DATE'.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_L = 'COMPANY CODE'.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'BUTXT'.
WA_FIELDCAT-SELTEXT_L = 'COMPANY NAME'.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-OUTPUTLEN = 25.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBRK'.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET CURRENCY VALUE'.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-OUTPUTLEN = 20.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM. " FIELDCATALOG
*& Form SET_PF_STATUS
text set the pf status
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'Z50658_PFSTATUS' EXCLUDING EXTAB.
ENDFORM. "SET_PF_STATUS
*& Form SET_USER_COMMAND
text set the user command
FORM SET_USER_COMMAND USING R_UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'CLICK'.
IF R1 = 'X'.
IF NOT IT_VBRK IS INITIAL.
SELECT POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP
INTO CORRESPONDING FIELDS OF TABLE IT_VBRP
FOR ALL ENTRIES IN IT_VBRK
WHERE VBELN = IT_VBRK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH ' NO BILLING DETAILS FOUND'.
ELSE.
IF V_FLAG = 'X'.
PERFORM DET_FIELDCATALOG.
V_FLAG = ''.
ENDIF.
PERFORM DET_LISTDISPLAY.
ENDIF.
ENDIF.
ENDIF.
IF R2 = 'X'.
READ TABLE IT_VBRK INTO WA_VBRK INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SELECT SINGLE POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP
INTO CORRESPONDING FIELDS OF WA_VBRP
WHERE VBELN = WA_VBRK-VBELN.
ENDIF.
APPEND WA_VBRP TO IT_VBRP.
ENDIF.
IF V_FLAG = 'X'.
PERFORM DET_FIELDCATALOG. "designing the field catalog for items
V_FLAG = ''.
ENDIF.
PERFORM DET_LISTDISPLAY. "displaying the secondary list
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'UP'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
CALL TRANSACTION 'SE38'.
ENDCASE.
ENDFORM. "SET_USER_COMMAND
*& Form DET_FIELDCATALOG
text designing the field catalog for item details
--> p1 text
<-- p2 text
FORM DET_FIELDCATALOG .
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'POSNR'.
WA_FIELDCAT1-SELTEXT_L = 'BILLING ITEM'.
WA_FIELDCAT1-COL_POS = 1.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'FKIMG'.
WA_FIELDCAT1-SELTEXT_L = 'INVOICE QUANTITY'.
WA_FIELDCAT1-COL_POS = 2.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'VRKME'.
WA_FIELDCAT1-SELTEXT_L = 'SALES UNIT'.
WA_FIELDCAT1-COL_POS = 3.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'NETWR'.
WA_FIELDCAT1-SELTEXT_L = 'NET CURRENCY VALUE'.
WA_FIELDCAT1-COL_POS = 4.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'MATNR'.
WA_FIELDCAT1-SELTEXT_L = 'MATERIAL NUMBER'.
WA_FIELDCAT1-COL_POS = 5.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_FIELDCAT1-TABNAME = 'IT_VBRP'.
WA_FIELDCAT1-FIELDNAME = 'ARKTX'.
WA_FIELDCAT1-SELTEXT_L = 'SALES ORDER ITEM'.
WA_FIELDCAT1-COL_POS = 6.
WA_FIELDCAT1-OUTPUTLEN = 20.
APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
WA_LAYOUT1-ZEBRA = 'X'.
ENDFORM. " DET_FIELDCATALOG
*& Form DET_LISTDISPLAY
text displaying the secondary list
--> p1 text
<-- p2 text
FORM DET_LISTDISPLAY .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT1
IT_FIELDCAT = IT_FIELDCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBRP
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.
CLEAR IT_VBRP[].
ENDFORM. " DET_LISTDISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR TY_EVENTS.
TY_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
TY_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND TY_EVENTS TO IT_EVENTS.
ENDFORM. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
SKIP.
ULINE.
WRITE :/2 ' DATE :', SY-DATUM,
45 'INTELLIGROUP ASIA PVT LTD',
110 'TIME :', SY-UZEIT.
WRITE : /3 'USER :', SY-UNAME,
45 'TITLE :', SY-TITLE,
110 'PAGE :', SY-PAGNO.
ULINE.
SKIP.
ENDFORM. "TOP_OF_PAGE
Cheers
navjot
Reward with points if it is helpful
Message was edited by:
navjot sharma -
Problem with central build of Simple Date Type with Enumeration
Dear gurus,
I hope I'm posting this in the correct forum. Please advise if I'm in the wrong forum.
I have a Web Dynpro DC in which I've created a simple data type with enumeration. It is used for binding to a radio box. The data type is called DownloadType; the enumeration contains two vales: current and archive. To allow me to access the enumeration values, I turn on the "Generate a class representation of the enumeration" in the data type builder.
I then reference the enumeration values with code like:
if (downloadType.equals (DownloadType._CURRENT))
yada yada yada
This works fine when building locally and deploying directly. But when the DC is built by CBS (or doing a "Development Component->Build..." in NW Dev Studio), the build fails, stating that the DownloadType._CURRENT symbol cannot be resolved.
For example:
C:yadayadayada.java:227: cannot resolve symbol
symbol : variable _CURRENT
location: class yadayadayada.DownloadType
equals(DownloadType._CURRENT)) {
Apparently the central builder is not smart enough to handle the "Generate a class representation" flag.
Is this a known problem? Are there any workarounds?
Thanks in advance for any help you can provide.
-Kelly
P.S. Environment: 2004sHi Kelly,
works for me using SP10, what SP are you on?
There's a line in the DC log that says:
[ddgen] [Info] Generating datatypes/com/x/x/x/MyEnum.java
and the java compiler includes the matching path for compilation:
[echo] source paths:
[echo] ...\_comp\src\packages
[echo] ..\t\ABF37B5AFB3B2E8A76FFD29E7862EA48\gen_ddic\datatypes
Regards,
Marc -
Type-safe enum in CMP EJB field...
Is it possible to use a type-safe enum like this in an EJB CMP field?
I have tried to do that but although the code compiles I get errors.
package dataBeansPkg;
import java.io.Serializable;
import java.io.ObjectStreamException;
import java.util.HashMap;
public final class Estado implements Serializable
private static final String ACTIVODESC = "Activo";
private static final String INACTIVODESC = "Inactivo";
private static final String ELIMINADODESC = "Eliminado";
private static final String BLOQUEADODESC = "Bloqueado";
private static HashMap VALUES = new HashMap();
private final String status;
private final String descripcion;
public static final Estado ACTIVO = new Estado("A", ACTIVODESC);
public static final Estado INACTIVO = new Estado("I", INACTIVODESC);
public static final Estado ELIMINADO = new Estado("E", ELIMINADODESC);
public static final Estado BLOQUEADO = new Estado("B", BLOQUEADODESC);
protected Estado()
this.status = null;
this.descripcion = null;
protected Estado(String estado, String descripcion)
this.status = estado;
this.descripcion = descripcion;
VALUES.put(estado, this);
public String getValor() { return status; }
public String getEstado() { return status; }
public String getDescripcion() { return descripcion; }
public String toString() { return getValor(); }
public final boolean equals(Object o) { return super.equals(o); }
public final int hashCode() { return super.hashCode(); }
public static Estado find(String estado)
if(VALUES.containsKey(estado)) {
return (Estado)VALUES.get(estado);
return null;
public Object readResolve()
Object result = find(status);
if(result != null)
return result;
else
return INACTIVO; // valor por omision
Whenever I run a client using the bean with a field associated to this enum, I get...
java.io.StreamCorruptedException: Caught EOFException while reading the stream header
and
Error loading state: java.io.StreamCorruptedException: Caught EOFException while reading the stream header
Is it possible to use a type-safe enum as a field in an CMP bean?Yep... I think that's what I found. By using public methods in my enum class to map it's string member to the EJB field I was able to effectively use my enum in the EJB. The container does it work with a String but the EJB's clients only deal with a enum field. That's what I originally intended so, thanks for your response.
-
I have type-safe generic array copying!
Check this out. I get no warnings from this, and so far it seems to work fine, and it only takes twice the time of a normal array copy.
All you have to do is pass in a dummy array of the same type as your inputArray, which under normal circumstances is very doable. The dummy array does not need to have the same dimension as the input array, which lets you use this as a static method in a utility class without feeling the burning need to make it throw an exception.
It takes advantage of Collections' type-safe toArray() method.
public static <T> T[] copyArray(T[] inputArray, T[] targetArray)
return arrayToList(inputArray).toArray(targetArray);
private static <T> ArrayList<T> arrayToList(T[] inputArray)
ArrayList<T> returnValue = new ArrayList<T>();
for(int i = 0; i < inputArray.length; i++)
returnValue.add(inputArray);
return returnValue;And I like my tabs, thank you.Many people consider using tabs in code to be
amatuerish. I can't say I disagree. Tabs are
represented as different lengths depending on the
editor. If you are using Eclipse, you can set it to
insert a number of space when you hit tab instead of
inserting tabs.I like tabs because they are an abstraction of indentation levels, something you don't get with spaces (unless you use one space per level), and therefore it makes more sense to me to use them. I use editors with good tab sizes that are also adjustable. Plus, I just like them better. So there. -
Hello All,
I want to have type safe collections. Today. when we do programming with collections it almost behaves like a scripting language with no data types. any thing which is an object goes in and comes out freely.
what about having a Collection(vector, ArrayList) class which can contain objects of only one type.
something like
ArrayList<Integer> a = new ArrayList();
regards,
Abhishek.Here's my way of using generics in normal Java - not quite as good as a compile error - but it works, and gives you a runtime error on inserting an object of the wrong type.
I did this when at Uni, hence all the funky comments (well, you can't expect the lecturers to actually read the code, can you?).
Just something you may find useful:
import java.util.*;
���An implementation of the Proxy pattern, designed to wrap any list, and make it accept
���objects of the specified type (subclasses are allowed) only, hence allowing a user of
���this class to 'trust' the Proxy list.
public class TypeSafeList extends AbstractList implements Serializable
���protected List source;
���protected Class acceptable;
���/**
������@param list the list to assign.
������@exception java.lang.IllegalArgumentException if the list contains elements of a
������different type to that specified
���*/
���public TypeSafeList(List list,Class acceptable)
���{
������Iterator iterator = list.iterator();
������while( iterator.hasNext() )
���������if( !acceptable.isInstance( iterator.next() ) )
������������throw new IllegalArgumentException( list+" contains elements not of type "+acceptable);
������this.source=list;
������this.acceptable=acceptable;
���}
���/**
������Passes on the request to the underlying list. See java.util.List.
���*/
���public Object get(int index)
���{
������return source.get(index);
���}
���/**
������Passes on the request to the underlying list. See java.util.List.
���*/
���public int size()
���{
������return source.size();
���}
���/**
������Checks that the type of the parameter is valid, and then passes on the
������request to the underlying list. See java.util.List.
������
������@exception java.lang.IllegalArgumentException if the type of the parameter is
������invalid.
���*/
���public Object set(int index,Object element)
���{
������return source.set(index,checkType(element));
���}
���/**
������Passes on the request to the underlying list. See java.util.List.
���*/
���public Object remove(int index)
���{
������return source.remove(index);
���}
���/**
������Checks that the type of the parameter is valid, and then passes on the
������request to the underlying list. See java.util.List.
���*/���
���public void add(int index,Object object)
���{
������source.add(index,checkType(object));
���}
���/**
������Return the Class object this List is configured to accept.
���*/
���public Class getAcceptable()
���{
������return acceptable;
���}
���
���/**���
������Checks the validity of the parameter against the protected field 'acceptable'.
������@return object if object is valid.
������@exception java.lang.IllegalArgumentException if the argument is invalid.
���*/
���protected Object checkType(Object object) throws IllegalArgumentException
���{
������if (acceptable.isInstance(object))
���������return object;
������throw new IllegalArgumentException(object+" needs to be of type "+acceptable.getName());
���}
} -
Implicit and explicit Type conversion using Type object in heap
Hi,
I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.Hello,
>> I am surprised how Implicit and explicit Type conversion works using Type object in heap.
For Implicit conversions: Typical examples are conversions from smaller to larger integral types, and conversions from derived classes to base classes. For the first one, the reference would be different which means it would return a different pointer to
a new object. For the reference type, it actually points to the same memory location, you could use the object.ReferenceEquals() to check it.
For Explicit conversions (casts):Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. For first one, it would perform the same with implicit conversions.
While for the conversion of conversion of a base-class instance to a derived class, actually, there's no built-in way to do this conversion.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Feedback on impementing second horizontal axis using Flex 2.0.1
I am attempting to use the concept of a second horizontal
axis using Flex 2.0. It is not clear to me if it is supported by
the Flex 2.0.1 sdk although livedocs does provide an example using
secondVerticalAxis. A snippet of my code is attached with this
message. At runtime, the second series does not display. Any
feedback about usage of the component would be greatly appreciated.
Thanks.>>That data base is fine for a development environment.
Thanks edbrendel.
So, since I am able to run Apache 2.2 as I want to, would I
be better of to use MySQL 5 or MS SQL Express if I want it to be
largely development, but also for my own stuff (my galleries etc.)
actually running pages served to the web?
I know of the technotes, a couple of them (incl. the MySQL
note on installing V. 5 as a datasource and all that), but never
saw that one...so thanks very much. I've manually added the Apache
2.2 file line in httpd.conf and added the file in the config area,
which always worked in the past with XP Pro and XP64...hope it does
with 2003 I had 2003 server when I first started playing, it was a
nightmare, I hope now that I've bought everything I can wrap my
head around it!). I just make sure I don't try to configure CF
until after manually adding the files, and changing the Apache
config file and restarting. Then I go into the administrator for
the first time.
Shawn
Maybe you are looking for
-
File to multiple files scenario
Hi there, I will try to explain my scenario. I pick up a file with several lines and I need to create one output file per line - <RECORD> + <LINE_ITEM> + <LINE_ITEM> + <LINE_ITEM> -</RECORD> I set up message mapping and interface mapping target to un
-
Problems with using scroll bar within some internet pages
I am a Volunteer here, not employed by HP. You too can become an HP Expert! Details HERE! If my post has helped you, click the Kudos Thumbs up! If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you
-
HP Compaq nx 6325: HDD Size up
I want to change the HDD of my HP Compaq nx6325 (SATA) / XP SP3 (atapi.sys installed) from the original 100 GB to an actual 500GB/8SSD Seagate SATA. What do I have to regard: Bios HDD Translation mode Bit-shift or LBA-Assisted? BIOS-DMA transmission
-
Which was the last version of Firefox that Supported Java Platform 6 ?
I want to know the the last version of Firefox that Supported Java Platform 6 update 45 (Java SE Runtime Environment 6u45) ? In other words which version of firefox started support for Java 7 ?
-
Just formatted my mac but iLife (from original disc) will not install
hi all! I've done a routine format of my Macbook Pro 13" a couple of weeks ago, it all went well but I seem not to be able to install the bundled applications from the orignal, grey cd that came with my mac. I insert the cd, start the procedure then