P_PERNR problem
Hi,
I have some problem in object P_PERNR. Hope someone can help me with the following scenario.
One of my client needs ESS/MSS. My problem is that in the portal, there is an option for employee to be delegated the position of manager when his/her manager is not around. We need to restrict that the employee will not be able to approve his/her own request when he/she is in the position of manager.
To make it clear, here is the detailed description. Employee A would like to request for Leave (IT2001). Once the request is made, the request will be sent to employee A's manager for approval. If the manager is not around, Employee A can be delegated the task of manager. However, we would like to restrict that Employee A would not be able to approve the leave application which he/she make earlier.
I understand that this can be done through object P_PERNR. However, I have tried a lot of combination but I still end up with the same. Can anyone help?
Sean
Hi Sean,
Welcome to SDN.
Check this might help -
Although the structural authorization example will work, there's a simpler way. For the ESS users, you must assign the authorization object P_PERNR for the infotypes (and subtypes) and that you want them to see only their own data for, and make sure you do not assign them P_ORGIN for those infotypes.
Before P_PERNR is effective, though, you must activate the authorization check for this object. You do this with transaction OOAC, changing the value for AUTSW PERNR to 1.
P_PERNR comes into play when a user tries to access infotype data against their own personnel number. For other personnel numbers, P_ORGIN is used.
Also, to post any question please use the appropriate forum for maximum visibility.
For HR related queries use this following -
SAP ERP Human Capital Management (SAP ERP HCM)
Regards,
Amit
Similar Messages
-
ESS Services Problem - PLOG and P_PERNR
Hi everyone.
We are currently upgrading from ECC 5 to ECC 6 and I am facing an ESS issue and have a few questions.
First, have the Webdynpro services changed between release 5 and 6? Webdynpro service sap.com/pcui_gp~xssutils/XssMenuArea doesn't show up under SU24 when reviewing auth objects PLOG and P_PERNR in ECC 6, our upgraded system. In our current ECC 5 landscape, this service is available and viewable under these auth objects. Is this service available in ECC 6.0?
Second question - how do I manually add this service to be checked/proposed for PLOG and P_PERNR? I receive an error when clicking the change/display auth button in PFCG when workign with our ESS role. The error says
"Authorization default values of transaction B690099F24B95252AC6B70AEBD3C12 for object PLOG inconsistent"
The character string refers to service sap.com/pcui_gp~xssutils/XssMenuArea. How can I add this service to auth objects PLOG and P_PERNR?
Any help would be greatly appreciated and rewarded!
Toddthere are some changes in the service in the functionality wise, but the basi structure is more or less, Same roles
and profiles can be used -
Hi there,
same Thread I post in "Portal Developement". Now I try my luck in ths category...
we implement ESS (ERP2004 with WebDynpros) in our testsystem, but we got an error and don´t know what to do...
System Landscape:
- mySAP Enterprise Portal 6.0 SP17
- Java Application Server (excluding from HR)
- mySAP ERP2004 HR-System
The Connections from the portal runs to the Java-App-Server, not direct to the HR-System (HR-System has no Java Installation and our Customer don´t want a installation, because it could be a bad performance)
We implement the Jco´s and fill out the usermapping. If we want to call the firstpage of the new ESS-Role we get this error.
Can anyone help us? Do we need some installations?
Best regards
Christian
Error
500 Internal Server Error
Web Dynpro Container/SAP J2EE Engine/6.40
Failed to process request. Please contact your system administrator.
Error Summary
While processing the current request, an exception occured which could not be handled by the application or the framework.
If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
Root Cause
The initial exception that caused the request to fail, was:
com.sap.dictionary.runtime.DdException: Type com.sap.xss.ser.xssmenu.model.types.P_Pernr does not exist
at com.sap.dictionary.types.mdi.util.ProviderUtil.createAbapTypeXmlMap(ProviderUtil.java:400)
at com.sap.dictionary.runtime.mdi.DataProvider.createSimpleTypeFromAbapType(DataProvider.java:586)
at com.sap.dictionary.runtime.mdi.DataProvider.getDataType(DataProvider.java:286)
at com.sap.dictionary.runtime.DdDictionary.getDataType(DdDictionary.java:95)
at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:164)
... 54 more
See full exception chain for details.
System Environment
Client
Web Dynpro Client Type HTML Client
User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)
Version
DOM version
Client Type msie6
Client Type Profile ie6
ActiveX enabled
Cookies enabled
Frames enabled
Java Applets enabled
JavaScript enabled
Tables enabled
VB Script enabled
Server
Web Dynpro Runtime Vendor: SAP, Build ID: 6.4015.00.0000.20051123162612.0000 (release=630_VAL_REL, buildtime=2005-12-14:21:51:22[UTC], changelist=377533, host=PWDFM026)
J2EE Engine No information available
Java VM Classic VM, version:1.4.2, vendor: IBM Corporation
Operating system AIX, version: 5.2, architecture: ppc64
Other
Session Locale de
Time of Failure Thu Jan 11 16:14:11 GMT+00:00 2007 (Java Time: 1168532051021)
Web Dynpro Code Generation Infos
sap.com/pcui_gp~xssutils
SapDictionaryGenerationCore 6.4018.00.0000.20060530191647.0000 (release=630_REL, buildtime=2006-09-20:21:03:45[UTC], changelist=405154, host=PWDFM027.wdf.sap.corp)
SapDictionaryGenerationTemplates 6.4018.00.0000.20060530191647.0000 (release=630_REL, buildtime=2006-09-20:21:03:57[UTC], changelist=405154, host=PWDFM027.wdf.sap.corp)
SapGenerationFrameworkCore 6.4015.00.0000.20050818152155.0000 (release=630_VAL_REL, buildtime=2005-11-24:21:18:08[UTC], changelist=363812, host=PWDFM026.wdf.sap.corp)
SapIdeWebDynproCheckLayer 6.4018.00.0000.20060823112633.0000 (release=630_REL, buildtime=2006-09-20:21:14:40[UTC], changelist=415262, host=PWDFM027.wdf.sap.corp)
SapMetamodelCommon 6.4018.00.0000.20060302125746.0000 (release=630_REL, buildtime=2006-09-20:20:56:46[UTC], changelist=392271, host=PWDFM027.wdf.sap.corp)
SapMetamodelCore 6.4018.00.0000.20060302125746.0000 (release=630_REL, buildtime=2006-09-20:20:56:36[UTC], changelist=392271, host=PWDFM027.wdf.sap.corp)
SapMetamodelDictionary 6.4018.00.0000.20060302125547.0000 (release=630_REL, buildtime=2006-09-20:21:00:39[UTC], changelist=392265, host=PWDFM027.wdf.sap.corp)
SapMetamodelWebDynpro 6.4018.00.0000.20060823112248.0000 (release=630_REL, buildtime=2006-09-20:21:09:40[UTC], changelist=415252, host=PWDFM027.wdf.sap.corp)
SapWebDynproGenerationCTemplates 6.4018.00.0000.20060915154217.0000 (release=630_REL, buildtime=2006-09-20:21:52:30[UTC], changelist=417774, host=PWDFM027)
SapWebDynproGenerationCore 6.4018.00.0000.20060823112633.0000 (release=630_REL, buildtime=2006-09-20:21:15:10[UTC], changelist=415262, host=PWDFM027.wdf.sap.corp)
SapWebDynproGenerationTemplates 6.4018.00.0000.20060915154217.0000 (release=630_REL, buildtime=2006-09-20:21:52:30[UTC], changelist=417774, host=PWDFM027)
sap.com/tcwddispwda
No information available
sap.com/pcui_gp~xssfpm
SapDictionaryGenerationCore 6.4018.00.0000.20060530191647.0000 (release=630_REL, buildtime=2006-09-20:21:03:45[UTC], changelist=405154, host=PWDFM027.wdf.sap.corp)
SapDictionaryGenerationTemplates 6.4018.00.0000.20060530191647.0000 (release=630_REL, buildtime=2006-09-20:21:03:57[UTC], changelist=405154, host=PWDFM027.wdf.sap.corp)
SapGenerationFrameworkCore 6.4015.00.0000.20050818152155.0000 (release=630_VAL_REL, buildtime=2005-11-24:21:18:08[UTC], changelist=363812, host=PWDFM026.wdf.sap.corp)
SapIdeWebDynproCheckLayer 6.4018.00.0000.20060823112633.0000 (release=630_REL, buildtime=2006-09-20:21:14:40[UTC], changelist=415262, host=PWDFM027.wdf.sap.corp)
SapMetamodelCommon 6.4018.00.0000.20060302125746.0000 (release=630_REL, buildtime=2006-09-20:20:56:46[UTC], changelist=392271, host=PWDFM027.wdf.sap.corp)
SapMetamodelCore 6.4018.00.0000.20060302125746.0000 (release=630_REL, buildtime=2006-09-20:20:56:36[UTC], changelist=392271, host=PWDFM027.wdf.sap.corp)
SapMetamodelDictionary 6.4018.00.0000.20060302125547.0000 (release=630_REL, buildtime=2006-09-20:21:00:39[UTC], changelist=392265, host=PWDFM027.wdf.sap.corp)
SapMetamodelWebDynpro 6.4018.00.0000.20060823112248.0000 (release=630_REL, buildtime=2006-09-20:21:09:40[UTC], changelist=415252, host=PWDFM027.wdf.sap.corp)
SapWebDynproGenerationCTemplates 6.4018.00.0000.20060915154217.0000 (release=630_REL, buildtime=2006-09-20:21:52:30[UTC], changelist=417774, host=PWDFM027)
SapWebDynproGenerationCore 6.4018.00.0000.20060823112633.0000 (release=630_REL, buildtime=2006-09-20:21:15:10[UTC], changelist=415262, host=PWDFM027.wdf.sap.corp)
SapWebDynproGenerationTemplates 6.4018.00.0000.20060915154217.0000 (release=630_REL, buildtime=2006-09-20:21:52:30[UTC], changelist=417774, host=PWDFM027)
sap.com/tcwdcorecomp
No information available
Detailed Error Information
Detailed Exception Chain
com.sap.tc.webdynpro.services.exceptions.WDTypeNotFoundException: type com.sap.xss.ser.xssmenu.model.types.P_Pernr could not be loaded: com.sap.dictionary.runtime.DdException: Type com.sap.xss.ser.xssmenu.model.types.P_Pernr does not exist
at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getSimpleType(DataTypeBroker.java:250)
at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getDataType(DataTypeBroker.java:213)
at com.sap.tc.webdynpro.progmodel.context.DataAttributeInfo.init(DataAttributeInfo.java:314)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:669)
at com.sap.tc.webdynpro.progmodel.context.DataNodeInfo.doInit(DataNodeInfo.java:233)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:654)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:657)
at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:347)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createComponent(ClientComponent.java:855)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createComponent(ClientComponent.java:158)
at com.sap.tc.webdynpro.progmodel.components.ComponentUsage.createComponentInternal(ComponentUsage.java:143)
at com.sap.tc.webdynpro.progmodel.components.ComponentUsage.createComponent(ComponentUsage.java:135)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$ComponentUsageManager.createBLCComponentUsage(FPMComponent.java:628)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPM.attachComponentToUsage(FPMComponent.java:773)
at com.sap.xss.ser.xssmenu.vc.header.VcXssMenuHeader.onInit(VcXssMenuHeader.java:196)
at com.sap.xss.ser.xssmenu.vc.header.wdp.InternalVcXssMenuHeader.onInit(InternalVcXssMenuHeader.java:225)
at com.sap.xss.ser.xssmenu.vc.header.VcXssMenuHeaderInterface.onInit(VcXssMenuHeaderInterface.java:162)
at com.sap.xss.ser.xssmenu.vc.header.wdp.InternalVcXssMenuHeaderInterface.onInit(InternalVcXssMenuHeaderInterface.java:144)
at com.sap.xss.ser.xssmenu.vc.header.wdp.InternalVcXssMenuHeaderInterface$External.onInit(InternalVcXssMenuHeaderInterface.java:220)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:466)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:354)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:179)
at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:347)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:370)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:608)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java(Compiled Code))
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java(Compiled Code))
Caused by: com.sap.dictionary.runtime.DdException: Type com.sap.xss.ser.xssmenu.model.types.P_Pernr does not exist
at com.sap.dictionary.types.mdi.util.ProviderUtil.createAbapTypeXmlMap(ProviderUtil.java:400)
at com.sap.dictionary.runtime.mdi.DataProvider.createSimpleTypeFromAbapType(DataProvider.java:586)
at com.sap.dictionary.runtime.mdi.DataProvider.getDataType(DataProvider.java:286)
at com.sap.dictionary.runtime.DdDictionary.getDataType(DdDictionary.java:95)
at com.sap.dictionary.runtime.DdBroker.getDataType(DdBroker.java:164)
at com.sap.dictionary.runtime.DdBroker.getSimpleType(DdBroker.java:170)
at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getSimpleType(DataTypeBroker.java:242)
... 52 moreHi,
uhm... good question, long time ago...
Error should be in the JCO-Destinations, where you can choose a targetsystem for each Jco-Destination.
Since them we installed a java on the abap-system, so we have a doublestack.
In the Jco Destiantions must be the ABAP-System.
Application via SAPTicket and MetaData via fix User like DDIC.
Regards
Christian -
Hi,
I read the blog posted by Jocelyn Dart-<b><i>Raising ABAP OO Events for Workflow</i></b>...
<b>/people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow
When I tried the same using my own Class, I am getting some problem.
Well, I created my Class with two Attributes
1) <i>M_POR</i>(Persistent Object Reference Attribute)
2) <i>PERNR</i>(Employee Number)
And I created a Constructor with one parameter.
And I also coded the remaining standard methods as per that blog - <b><i>USING ABAP OO Methods in Workflow Tasks</i></b>.
Finally I activated my CLASS and each individual method.
I created one small report that raises ABAP OO Event as mentioned in the blog with the below mentioned code.
<i>report yworkflowtrigger_ooabap.
data : ls_ywftest1_key type p_pernr,
lv_objtype type sibftypeid,
lv_event type sibfevent,
lv_objkey type sibfinstid,
lr_event_parameters type ref to if_swf_ifs_parameter_container,
lv_param_name type swfdname,
lv_visit_date type datum.
lv_objtype = 'YWFTEST1'.
lv_event = 'STARTEVENT'.
Set up the LPOR Instance id
ls_ywftest1_key = '00000024'.
move ls_ywftest1_key to lv_objkey.
try.
call method cl_swf_evt_event=>raise
exporting
im_objcateg = cl_swf_evt_event=>mc_objcateg_cl
im_objtype = lv_objtype
im_event = lv_event
im_objkey = lv_objkey
IM_EVENT_CONTAINER =
catch cx_swf_evt_invalid_objtype .
catch cx_swf_evt_invalid_event .
endtry.</i>
I switched on my event trace and tried raising the Event. But event is not raised even after execution of this code. I checked the SY-SUBRC value at the ENDTRY, But this seems perfect(SY-SUBRC = 0).
Why is my event not getting triggered even after the execution of above code?
Is there anything which I have missed.
We are on <b>ECC 5.0</b>
Regards,
<i><b>Raja Sekhar</b></i>I missed this tip in that blog.
"<i><b>Tip! Just as for Business Object events, the COMMIT WORK statement is crucial when raising a Workflow event - without this the event will not be raised.</b></i>"
Regards,
<i><b>Raja Sekhar</b></i> -
Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS
Dear All,
I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..
Please suggest me on the way to overcome this problem..
We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions
So in my program I have the parameters to accept
P_BEGDA - 01.10.2007
P_INFTY - P0008
P_ACTIO - COPY
I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE
BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP
The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION
ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode
It gives the below possiblities
"ASSIGN_BASE_TOO_SHORT" C
"SAPLHRMM" or "LHRMMU03"
"HR_INFOTYPE_OPERATION"
But If I use the below internal table
Data : g_t_0008 like P0008 occurs 0 with header line.
And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table
field-symbols: <dyn_table> type standard table.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
to get the srurcute
perform get_structure using l_f_table.
perform create_dynamic_itab .
assign dy_table->* to <dyn_table>.
perform get_data tables <dyn_table01>
using pernr-pernr p_infty.
below are the forms routine .
form get_structure using p_table.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
clear : ifc[], dy_table.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
endform.
*& Form get_data
form get_data tables p_table
using p_pernr
p_infty.
clear : p_table, p_table[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = P_PERNR
INFTY = p_infty
BEGDA = p_datum
ENDDA = p_datum
TABLES
INFTY_TAB = p_table
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
IF lines( p_table ) GT 0.
*write :/'Record exist' , 'IT', p_infty.
clear p_table.
PERFORM hr_operation tables p_table
using g_t_t588d-actio g_t_t588d-INFTY
g_t_t588d-SUBTY.
else.
PERFORM append_status using g_t_itab-pernr p_infty ' '
'Error' 'No records'.
ENDIF.
endform. " get_data
form hr_operation tables p_table
using p_actio P_INFTY P_SUBTY.
data: l_f_return LIKE bapireturn1.
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.
<l_field> = p_begda.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = P_infty
number = G_T_ITAB-PERNR
subtype = P_subty
validityend = g_f_endda
validitybegin = P_datum
record = P_TABLE
operation = p_actio
IMPORTING
return = l_f_return.
IF sy-subrc NE 0.
ENDIF.
ENDFORM.try
using field symbol for a wrk area instead of Field symbol for a table
loop your inernal table (again a field symbol) assigning to <fs_wrkarea>
in loop call HR_INFO.._OP..
reward if helpful -
Problem in using - changing parameter
hi all , I have problem in cahange valule.
FORM logo TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA : pernr TYPE p_pernr,
bukrs TYPE bukrs,
begda TYPE begda.
TABLES : ztable
DATA: BEGIN OF p0001 OCCURS 10.
INCLUDE STRUCTURE p0001.
DATA: END OF p0001.
READ TABLE in_tab WITH KEY name = 'PTXT1-BEGDA'.
begda = in_tab-value.
READ TABLE out_tab WITH KEY name = 'PTXT1-PERNR'.
pernr = in_tab-value.
rp-read-infotype pernr 0001 p0001 begda begda.
SELECT SINGLE * FROM ztable WHERE bukrs = p0001-bukrs.
IF sy-subrc EQ 0.
MOVE 'LOGO' TO out_tab-name.
MOVE zpkom-logo TO out_tab-value.
APPEND out_tab.
ENDIF.
ENDFORM. "logo
/: PERFORM LOGO IN Z_SUBR
/: USING &PTXT1-PERNR&
/: USING &PTXT1-BEGDA&
/: CHANNGING &LOGO&
/: ENDFORM
logo is some value that I will use in sap script later.Hello,
I think that correct code is:
FORM logo TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
DATA : pernr TYPE p_pernr,
bukrs TYPE bukrs,
begda TYPE begda.
TABLES : ztable
DATA: BEGIN OF p0001 OCCURS 10.
INCLUDE STRUCTURE p0001.
DATA: END OF p0001.
READ TABLE in_tab WITH KEY name = 'PTXT1-BEGDA'.
begda = in_tab-value.
READ TABLE out_tab WITH KEY name = 'PTXT1-PERNR'.
pernr = in_tab-value.
rp-read-infotype pernr 0001 p0001 begda begda.
SELECT SINGLE * FROM ztable WHERE bukrs = p0001-bukrs.
IF sy-subrc EQ 0.
READ TABLE out_tab with key 'LOGO'.
MOVE zpkom-logo TO out_tab-value.
MODIFY out_tab INDEX sy-tabix.
ENDIF.
ENDFORM. "logo
/: PERFORM LOGO IN PROGRAM Z_SUBR
/: USING &PTXT1-PERNR&
/: USING &PTXT1-BEGDA&
/: CHANGING &LOGO&
/: ENDPERFORM -
Problem with custom tone curves
I have a problem with saving custom tone curves and don't know what to do about it. I am running Lr 5.7.1. on OS X 10.10.3 but I know this problem was there on OS X 10.10.2.
The problem is as follows, if I create a tone curve a try to save it Lr does not save it in under /Users/{UserID}/Library/Application Support/Adobe/CameraRaw/Curves as it should; instead it places it under /Users/{UserID}/. As a result the custom tone curve does not appear in the Point Curve list.
2 items of additional/useful information:
1) I can literarily see the Save dialog jumping from the correct folder, /Users/{UserID}/Library/Application Support/Adobe/CameraRaw/Curves, to the incorrect folder, /Users/{UserID}/
2) If I manually move the file to right location it appears in the Point Curve list
I have checked permissions and the User ID has Read/Write access. I have also made visible hidden folders with no luck.
Any suggestions are very welcome.Hi,
To the details of an Infotype :
View the record in PA20, to make sure the PERNR has a record for the Infotype
Make sure the parameters passed to HR_INFOTYPE_OPERATION are correct :
Rather than passing them directly, pass :
g_pernr type p_pernr value pernr
g_infty type prelp-infty value 9402
Lock the PERNR with BAPI_EMPLOYEE_ENQUEUE
Read values
SELECT * FROM <table> INTO CORRESPONDING FIELDS OF <wa>
WHERE pernr = g_pernr
AND begda <= sy-datum
AND endda >= sy-datum.
ENDSELECT.
Perform HR_INFOTYPE_OPERATION.
Provided you fill all the key fields : SUBTYPE,OBJID.... RECORDNUMBER. (passed from p9008)
Why ?:
For an Emp, a number of records may be created, depending on the Time constraint of the Infotype
Say when you modify, the actual record may be delimted to sy-datum and a new record may be inserted
To learn more about Time constraints refer : http://help.sap.com/saphelp_nw04/helpdata/en/f4/51d2c9a79911d189550000e8216659/frameset.htm
Basline : BEGDA and ENDDA are very important in determining which record to modify!!
Unlock PERNR with BAPI_EMPLOYEE_DEQUEUE
The above should take care of No data stored for 9402 in the selected period
Regards,
Ravi -
Customize P_PERNR object ?
Hi,
i have a problem with authorizational object.
Id like to modify the logic under the P_PERNR object.
Is possible to assign a user a personnel number using a different infotype respect the 0105, subtype 0001.
For example I'd like to insert two different users for the same PERNR.
EX:
CID 1110000
IT 0105 SUBTYPE 0001 -> USER1
IT 0105 SUBTYPE ZZZZ -> USER2.
in this way both the user can access the CID 1110000Hi,
Please, please, please do not do what you are planning. The system should stop you, but if not, please do not have different users assigned the same PERNR. Concern: each user could then see and change the personal data for that PERNR.
For this and other related questions about authorizations, you can utilize structural authorizations and authorizations with context to solve your problems in relation to P_PERNR. Please do not try to circumvent the built-in authorization restrictions. You are asking for trouble.
Paul -
I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
Thank you in advance,
LeftyThis was one solution from the socket programming forum, have you tried this??
public Thread MyThread extends Thread{
boolean active = true;
public void run(){
ss.setSoTimeout(90);
while (active){
try{
serverSocket = ss.accept();
catch (SocketTimeoutException ste){
// do nothing
// interrupt thread
public void deactivate(){
active = false;
// you gotta sleep for a time longer than the
// accept() timeout to make sure that timeout is finished.
try{
sleep(91);
}catch (InterruptedException ie){
interrupt();
} -
A problem with Threads and MMapi
I am tring to execute a class based on Game canvas.
The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
The MIDI tone "Stammers".
How to over come the problem?
Thanks in advance
Kobi
See Code example below:
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
public class MainScreenCanvas extends GameCanvas implements Runnable {
private MainMIDlet parent;
private boolean mTrucking = false;
Image imgBackgound = null;
int imgBackgoundX = 0, imgBackgoundY = 0;
Player player;
public MainScreenCanvas(MainMIDlet parent)
super(true);
this.parent = parent;
try
imgBackgound = Image.createImage("/images/area03_bkg0.png");
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
catch(Exception e)
System.out.println(e.getMessage());
* starts thread
public void start()
mTrucking = true;
Thread t = new Thread(this);
t.start();
* stops thread
public void stop()
mTrucking = false;
public void play()
try
InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
player = Manager.createPlayer(is, "audio/midi");
player.setLoopCount(-1);
player.prefetch();
player.start();
catch(Exception e)
System.out.println(e.getMessage());
public void run()
Graphics g = getGraphics();
play();
while (true)
tick();
input();
render(g);
* responsible for object movements
private void tick()
* response to key input
private void input()
int keyStates = getKeyStates();
if ((keyStates & LEFT_PRESSED) != 0)
imgBackgoundX++;
if (imgBackgoundX > 0)
imgBackgoundX = 0;
if ((keyStates & RIGHT_PRESSED) != 0)
imgBackgoundX--;
if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
* Responsible for the drawing
* @param g
private void render(Graphics g)
g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
this.flushGraphics();
}You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
Regds,
SD
N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM -
Hi all,
I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
Below you can find the code
import java.lang.*;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class intervals extends MIDlet implements CommandListener
public Display ekran;
private SweepCanvas sweeper;
private Form rundy;
private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
private long czas,x;
private Command exitCommand;
private Command addRound;
private Command delRound;
private Command start;
private TextField repeat;
private Form odliczanie;
private Alert ostrz;
Licznik thread;
String test;
StringItem test1;
int parz,i,j,k;
static int l;
int ilrund;
int ilpowt;
Item sec;
long sec1;
public intervals()
rundy = new Form("Interwały sportowe");
exitCommand = new Command("Wyjście", Command.EXIT, 2);
addRound = new Command("Dodaj","Dodaj rundę", Command.ITEM,1);
delRound = new Command("Usuń","Usuń ostatnią rundę", Command.ITEM,1);
start = new Command("Start", Command.ITEM,1);
odliczanie = new Form("Odliczanie");
TextField dodaj(TextField kolej)
kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
if(rundy.size()==0)
rundy.insert(rundy.size(),kolej);
else
rundy.insert(rundy.size()-1, kolej);
return kolej;
void odliczanie(TextField round)
monitor m=new monitor();
k=Integer.parseInt(round.getString());
ekran.setCurrent(odliczanie);
thread=new Licznik(k,odliczanie);
thread.start();
ekran.setCurrent(rundy);
public void startApp()// throws MIDletStateChangeException
rundy.deleteAll();
repeat = new TextField("Podaj ilość powtórzeń",null,1,TextField.NUMERIC);
rundy.addCommand(addRound);
rundy.addCommand(exitCommand);
rundy.setCommandListener(this);
Canvas obrazek = new MyCanvas();
ekran = Display.getDisplay(this);
ekran.setCurrent(obrazek);
czas=System.currentTimeMillis();
while (System.currentTimeMillis()<czas+1000)
continue;
ekran.setCurrent(rundy);
public void pauseApp()
public void destroyApp(boolean unconditional)
notifyDestroyed();
public void commandAction(Command c, Displayable s)
if (c == exitCommand)
destroyApp(false);
notifyDestroyed();
else if(c==addRound)
if(rundy.size()==0)//Sprawdzenie ilości elementów w celu poprawnego wyświetlania liczby rund w formie
parz=1;
else
parz=rundy.size();
switch(parz)
case 1:
round0=dodaj(round0);break;
case 2:
round1=dodaj(round1);break;
case 3:
round2= dodaj(round2);break;
case 4:
round3=dodaj(round3);break;
case 5:
round4=dodaj(round4);break;
default:
ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
ostrz.setTimeout(3000);
ekran.setCurrent(ostrz);
if(rundy.size()==1)
rundy.append(repeat);
rundy.addCommand(start);
rundy.addCommand(delRound);
else if(c==delRound)
if(rundy.size()!=0)
rundy.delete(rundy.size()-2);
if (rundy.size()==1)
rundy.deleteAll();
if(rundy.size()==0)
rundy.removeCommand(delRound);
rundy.removeCommand(start);
else if(c==start)
ilrund=rundy.size()-1;
if(this.repeat.size()>0)
ilpowt=Integer.parseInt(this.repeat.getString());
ekran = Display.getDisplay(this);
for (i=1; i<=ilpowt;i++)
odliczanie= new Form("Odliczanie");
for (j=0;j<ilrund;j++)
switch(j)
case 0:
odliczanie(round0);
break;
case 1:
odliczanie(round1);
break;
case 2:
odliczanie(round2);
break;
case 3:
odliczanie(round3);
break;
case 4:
odliczanie(round4);
break;
case 5:
odliczanie(round5);
break;
case 6:
odliczanie(round6);
break;
case 7:
odliczanie(round7);
break;
case 8:
odliczanie(round8);
break;
class Licznik extends Thread
int czas1,k;
Form forma;
monitor m;
public Licznik(int k,Form formap)
czas1=k;
forma=formap;
public synchronized void run()
while(czas1>0)
forma.deleteAll();
forma.append("Czas pozostały (s): "+czas1);
try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
czas1--;
if(czas1<=0)
m.put();
}and monitor class
public class monitor
boolean busy=false;
synchronized void get()
if(!busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
notify();
synchronized void put()
if(busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
busy=true;
notify();
}Can anybody help me with this?Groovemaker,
Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
Daniel -
Problem with threads within applet
Hello,
I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
this thread is running in endless loop.
he is doing something and go to sleep on and on.
the problem is,
when I refresh my IE6 browser I see more than 1 thread.
for debug matter, I did the following things:
inside the thread, sysout every time he goes to sleep.
sysout in the singleton constructor.
sysout in the singleton destructor.
the output goes like this:
when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
The destructor never works (no output there).
I don't understand what is going on.
someone can please shed some light?
thanks.
btw. I am working with JRE 1.1
this is very old and big applet and I can't convert it to something new.Ooops. sorry!
I did.
public void start() {
public void stop() {
public void destroy() {
try {
resetAll();
Configuration.closeConnection();
QuoteItem.closeConnection();
} finally {
try {
super.finalize();
} catch (Throwable e) {
e.printStackTrace();
} -
Problem with Threads and a static variable
I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
Code functionality:
A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
The problem as far I understand is:
Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
Thanks,
B.D.
Code:
private static volatile boolean bChanged = false;
private static Thread objMainProcess;
protected static void Init(){
objMainProcess = new Thread() {
public void run() {
while( objMainProcess == Thread.currentThread() ) {
GetState();
objMainProcess.setDaemon( true );
objMainProcess.start();
public static void initStatusTimer(){
if(objTimer == null)
objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
public void actionPerformed( java.awt.event.ActionEvent evt){
SetState();
private static void SetState(){
if( objMainProcess == null ) return;
synchronized( objMainProcess ) {
bChanged = true;
try{
objMainProcess.notify();
}catch( IllegalMonitorStateException e ) {}
private static boolean GetState() {
if( objMainProcess == null ) return false;
synchronized( objMainProcess ) {
if( bChanged) {
SendMessage();
bChanged = false;
return true;
try {
objMainProcess.wait();
}catch( InterruptedException e ) {}
return false;
}Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
Again as you said, There is a reason I can't call sendMessage() inside setState().
The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
Thanks,
B.D. -
Problem with threads running javaw
Hi,
Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
troy.troy,
Try and post a minimum code sample of your app which
does not work.
When using javaw, make sure you redirect the standard
error and standard output streams to file.
Graeme.Hi Graeme,
I dont understand what you mean by redirection to file? some of my code below.
The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
public class Server{
ServerSocket aServerSocket;
Socket dianosticsSocket;
Socket nPortExpress;
ClientListener aClientListener;
LinkedList queue = new LinkedList();
int port = 0;
int clientPort = 0;
String clientName = null;
boolean serverAlive = true;
* Server constructor generates a server
* Socket and then starts a client threads.
* @param aPort socket port of local machine.
public Server(int aPort, String aClientName, int aClientPort){
port = aPort;
clientName = aClientName;
clientPort = aClientPort;
try{
// create a new thread
aServerSocket = new ServerSocket(port) ;
// connect to the nPortExpress
aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
// aClientListener.setDaemon(true);
aClientListener.start();
// start a dianostic port
DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
// System.out.println("Server is running on port " + port + "...");
// System.out.println("Connect to nPort");
catch(Exception e)
// System.out.println("ERROR: Server port " + port + " not available");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
serverAlive = false;
System.exit(1);
while(serverAlive&&aClientListener.hostSocket.isConnected()){
try{
// connect the client
Socket aClient = aServerSocket.accept();
//System.out.println("open client connection");
//System.out.println("client local: "+ aClient.getLocalAddress().toString());
// System.out.println("client localport: "+ aClient.getLocalPort());
// System.out.println("client : "+ aClient.getInetAddress().toString());
// System.out.println("client port: "+ aClient.getLocalPort());
// make a new client thread
ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
// start thread
clientThread.start();
catch(Exception e)
//System.out.println("ERROR: Client connection failure");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
}// end while
} // end constructor Server
void serverExit(){
JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}// end class Server
*** connect to another server
public class ClientListener extends Thread{
InetAddress hostName;
int hostPort;
Socket hostSocket;
BufferedReader in;
PrintWriter out;
boolean loggedIn;
LinkedList queue; // reference to Server queue
Server serverRef; // reference to main server
* ClientListener connects to the host server.
* @param aHostName is the name of the host eg server name or IP address.
* @param aHostPort is a port number of the host.
* @param aLoginName is the users login name.
public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer) // reference to Server queue)
hostName = aHostName;
hostPort = aHostPort;
queue = aQueue;
serverRef = aServer;
// connect to the server
try{
hostSocket = new Socket(hostName, hostPort);
catch(IOException e){
//System.out.println("ERROR: Connection Host Failed");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);
System.exit(0);
} // end constructor ClientListener
** multi client connection server
ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
queue = aQueue;
addToQueue(this);
client = aSocket;
clientRef = aClientListener;
aDiagnostic = diagnostics;
} // end constructor ClientWorker
* run method is the main loop of the server program
* in change of handle new client connection as well
* as handle all messages and errors.
public void run(){
boolean alive = true;
String aSubString = "";
in = null;
out = null;
loginName = "";
loggedIn = false;
while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
try{
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
if(aDiagnostic){
out.println("WELCOME to diagnostics");
broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
out.flush();
else {
out.println("WELCOME to Troy's Server");
broadCastDia("Connect : client "+client.getInetAddress().toString());
out.flush();
String line;
while(((line = in.readLine())!= null)){
StringTokenizer aStringToken = new StringTokenizer(line, " ");
if(!aDiagnostic){
broadCastDia(line);
clientRef.sendMessage(line); // send mesage out to netExpress
out.println(line);
out.flush();
else{
if(line.equals("GETIPS"))
getIPs();
else{
clientRef.sendMessage(line); // send mesage out to netExpress
out.println(line);
out.flush();
} // end while
catch(Exception e){
// System.out.println("ERROR:Client Connection reset");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);
try{
if(aDiagnostic){
broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
out.flush();
else {
broadCastDia("Disconnect : client "+client.getInetAddress().toString());
out.flush();
// close the buffers and connection;
in.close();
out.close();
client.close();
// System.out.println("out");
// remove from list
removeThreadQueue(this);
alive = false;
catch(Exception e){
// System.out.println("ERROR: Client Connection reset failure");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);
}// end while
} // end method run
* method run - Generates io stream for communicating with the server and
* starts the client gui. Run also parses the input commands from the server.
public void run(){
boolean alive = true;
try{
// begin to life the gui
// aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
// aGuiClient.show();
in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
while (alive && hostSocket.isConnected()){
String line;
while(((line = in.readLine())!= null)){
System.out.println(line);
broadCast(line);
} // end while
} // end while
catch(Exception e){
// System.out.println("ERRORa Connection to host reset");
JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
try{
hostSocket.close();
}catch(Exception a){
JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
alive = false;
System.exit(1);
} // end method run -
Problem with Threads and "plase wait..."-Window
Hi everyone,
I have a problem that I'm not able to solve in any way... I have a time-consuming task (a file decryption) which I execute in a separate thread; I've used the SwingWorker class, like suggested by sun-tutorial, and it works right. The problem is that I have to wait that the decryption have finished before continuing with program-execution. Therefore I would like to display a "please wait"-window while the task runs. I've tryed all the possible ways I know but the problem is always the same: the waitWindow is displayed empty, the bounds are painted but the contents no; it's only painted when the decrypt-task has finished. Please help me, I have no more resources....
decrypt-file code:
public class DecryptFile {
private String cryptedFileNameAndPath;
private ByteArrayInputStream resultStream = null;
// need for progress
private int lengthOfTask;
private int current = -1;
private String statMessage;
public DecryptFile(String encZipFileNameAndPath) {
cryptedFileNameAndPath = encZipFileNameAndPath;
//Compute length of task...
// 0 for indeterminate
lengthOfTask = 0;
public ByteArrayInputStream getDecryptedInputStream() {
return this.resultStream;
* Called from ProgressBarDemo to start the task.
public void go() {
current = -1;
final SwingWorker worker = new SwingWorker() {
public Object construct() {
return new ActualTask();
worker.start();
* Called from ProgressBarDemo to find out how much work needs
* to be done.
public int getLengthOfTask() {
return lengthOfTask;
* Called from ProgressBarDemo to find out how much has been done.
public int getCurrent() {
return current;
public void stop() {
current = lengthOfTask;
* Called from ProgressBarDemo to find out if the task has completed.
public boolean done() {
if (current >= lengthOfTask)
return true;
else
return false;
public String getMessage() {
return statMessage;
* The actual long running task. This runs in a SwingWorker thread.
class ActualTask {
ActualTask () {
current = -1;
statMessage = "";
resultStream = AIUtil.getInputStreamFromEncZip(cryptedFileNameAndPath); //here the decryption happens
current = 0;
statMessage = "";
}The code that calls decryption and displays waitWindow
final WaitSplash wS = new WaitSplash("Please wait...");
final DecryptFile cryptedTemplate = new DecryptFile (this.templateFile);
cryptedTemplate.go();
while (! cryptedTemplate.done()) {
try {
wait();
} catch (Exception e) { }
this.templateInputStream = cryptedTemplate.getDecryptedInputStream();
wS.close();Thanks, thanks, thanks in advance!
EdoardoMaybe you can try setting the priority of the long-running thread to be lower? so that the UI will be more responsive...
Maybe you are looking for
-
Java-plugin for windows vista question
Hello, What is the best java -plug ins for the windows Vista OS in the client? Is JRE 1.6 is good or we need to get anything higher? we have currently jre1.6 but at startup itis giving some problem. does anybody uses window vista as clint ? if so wha
-
Help button not visible in off-line version
Why is de help/information button not visible in the off-line version. The web-based version is oké. In use Adobe Accrobat version XI.
-
Is there any difference in SAP 4.7 and ECC 5.0
Dear, Is there any difference in SAP 4.7 and ECC 5.0... Thanx & Regards, Mohammad Nabi
-
How to transfer song from iPod to new itune
i just re update my pc n all my stuff are gone n now i want to transfer all song from my 4G ipod touch to my new itune, so how it work? i scared to sync my ipod cause i might lose all song i have.. i really need help now,,
-
Where can I get a manual for a 1st generation iPhone.