Displaying list using pushbutton
Hi Forum,
How to display a list using a pushbutton.
Pls give an example..
I welcome you to become online friends only to discuss abap.
my id is [email protected]
Thanks,
Shilpa
Hi this will help u.
Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user wont have the actual Grid interface but the List interface.
There is a workaround to display ALV Grid in Background Job. The only restriction is you cant schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesnt have to go to SM37 to view the job status/log. Once the Job Status is changed to COMPLETED, user can click on DISPLAY SPOOL to view the ALV Grid.
Limitations:
Cant schedulea background job
The session should be active until the background job is completed. If the session is closed, then user wont be able to check the output in ALV Grid. User would be able to check the output through spool or SM37
Advantages:
If the spool width is greater than 255 characters, then the entire width could be seen in the output because the output is directed to an ALV Grid and not to spool
Interface of ALV Grid is available instead of ALV List even though its a background job.
Program wont give the TIME OUT error
Steps Required:
1. Once you execute the program, the following screen would be displayed
2. Click Display Job Status to check the Status of the Background Job
3. Click on Display the Job Log to check the Log
4. Click on Display Job Status to check the Job Status
5. Click on DISPLAY SPOOL to check the spool content once the Job Status is changed to COMPLETED. Output is displayed in ALV Grid
Programs:
1. Two different programs needs to be created
ZPROGRAM_ONE: This is the 1st program, where the selection screen and all the data validations would be done. Error handling for invalid data should be done in this program.
Once the data validation is done, this program would call the 2nd program ZPROGEAM_TWO. Build the logic to display ALV Grid in this program. The logic will only display ALV in foreground and it wont be reflected in the spool.
ZPROGRAM_TWO: This program would fetch all the data and do all the processing. If you want the spool output along with ALV Grid output, then build the logic in this program to display ALV Grid.
*& Report ZPROGRAM_ONE *
REPORT zprogram_one .
PRASHANT PATIL
TABLES : mara,
tsp01.
type-pools:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
i_jobsteplist TYPE STANDARD TABLE OF tbtcstep, " For spool number
wa_params TYPE pri_params, " To Get Print Parameters
wa_jobhead TYPE tbtcjob, " To know the status of job
wa_jobsteplist TYPE tbtcstep, " To know the spool
w_jobname TYPE tbtco-jobname, " Job name for bckgrnd job
w_jobcount TYPE tbtco-jobcount, " Unique id for bckgrd job
w_path TYPE string, " Upload path
w_lsind TYPE sy-lsind, " Index
wa_seltab TYPE rsparams,
i_seltab TYPE STANDARD TABLE OF rsparams,
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
CONSTANTS DECLARATION *
CONSTANTS :
c_a(1) TYPE c VALUE 'A',
c_m(1) TYPE c VALUE 'M',
c_l(1) TYPE c VALUE 'L',
c_c(1) TYPE c VALUE 'C',
c_zfdr(4) TYPE c VALUE 'ZFDR',
c_x(1) TYPE c VALUE 'X',
c_locl(4) TYPE c VALUE 'LOCL', " Destination is LOCAL
c_f(1) TYPE c VALUE 'F', " Job Status - Failed
c_s(1) TYPE c VALUE 'S',
c_p(1) TYPE c VALUE 'P'.
SELECTION SCREEN PARAMETERS
SELECT-OPTIONS : s_matnr FOR mara-matnr.
START-OF-SELECTION.
Before the export, fill the data fields before CLUSTR
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
EXPORT s_matnr
TO DATABASE indx(st) FROM wa_index ID wa_index_key.
To Open the Job for background processing
PERFORM open_job.
To get the print parameters
PERFORM get_print_parameters.
Submit the job in background
PERFORM job_submit.
Close the background job
PERFORM job_close.
This is the output screen with the buttons ********
Create 3 buttons DISPLAY SPOOL, STATUS, JOBLOG
SET PF-STATUS 'ZS001'.
WRITE: / 'The program is submitted in Background'.
WRITE: / 'Press DISPLAY SPOOL to see the spool'.
WRITE: / 'Press STATUS to see the status of the background'.
AT USER-COMMAND.
If user presses the 'BACK' button
IF sy-ucomm = 'BAK'.
IF wa_jobhead-status = c_f OR
wa_jobhead-status = c_a.
LEAVE TO SCREEN 0.
ENDIF.
ENDIF.
If the user presses the 'DISPLAY SPOOL' Button
IF sy-ucomm = 'DISPLAY'.
PERFORM display_spool.
ENDIF.
If the user presses the 'JOB STATUS' Button
IF sy-ucomm = 'STATUS'.
PERFORM display_status.
ENDIF.
If the user presses the 'JOB LOG' Button
IF sy-ucomm = 'JOBLOG'.
PERFORM display_job_log.
ENDIF.
*& Form open_job
text
--> p1 text
<-- p2 text
FORM open_job .
This is to Create a new job which is to be submitted in background to
process sales order/delivery/invoice
Here we would get a unique id ( Jobcount ) which identifies our job
along with the job name which we have assigned to our job
CONCATENATE sy-uname
sy-datum
sy-uzeit
INTO w_jobname . " Assign unique jobname
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = w_jobname
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = w_jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " open_job
*& Form get_print_parameters
text
--> p1 text
<-- p2 text
FORM get_print_parameters .
DATA : l_valid TYPE c.
This is to get the Print Parameters for the job which is to be
submitted in background to process sales order/delivery/invoice
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
ARCHIVE_ID = C_CHAR_UNKNOWN
ARCHIVE_INFO = C_CHAR_UNKNOWN
ARCHIVE_MODE = C_CHAR_UNKNOWN
ARCHIVE_TEXT = C_CHAR_UNKNOWN
AR_OBJECT = C_CHAR_UNKNOWN
ARCHIVE_REPORT = C_CHAR_UNKNOWN
AUTHORITY = C_CHAR_UNKNOWN
COPIES = C_NUM3_UNKNOWN
COVER_PAGE = C_CHAR_UNKNOWN
DATA_SET = C_CHAR_UNKNOWN
DEPARTMENT = C_CHAR_UNKNOWN
destination = c_locl " LOCL
EXPIRATION = C_NUM1_UNKNOWN
immediately = space
IN_ARCHIVE_PARAMETERS = ' '
IN_PARAMETERS = ' '
LAYOUT = C_CHAR_UNKNOWN
LINE_COUNT = C_INT_UNKNOWN
LINE_SIZE = C_INT_UNKNOWN
LIST_NAME = C_CHAR_UNKNOWN
LIST_TEXT = C_CHAR_UNKNOWN
MODE = ' '
new_list_id = c_x
PROTECT_LIST = C_CHAR_UNKNOWN
no_dialog = c_x
RECEIVER = C_CHAR_UNKNOWN
RELEASE = C_CHAR_UNKNOWN
REPORT = C_CHAR_UNKNOWN
SAP_COVER_PAGE = C_CHAR_UNKNOWN
HOST_COVER_PAGE = C_CHAR_UNKNOWN
PRIORITY = C_NUM1_UNKNOWN
SAP_OBJECT = C_CHAR_UNKNOWN
TYPE = C_CHAR_UNKNOWN
user = sy-uname
USE_OLD_LAYOUT = ' '
UC_DISPLAY_MODE = C_CHAR_UNKNOWN
DRAFT = C_CHAR_UNKNOWN
ABAP_LIST = ' '
USE_ARCHIVENAME_DEF = ' '
DEFAULT_SPOOL_SIZE = C_CHAR_UNKNOWN
PO_FAX_STORE = ' '
NO_FRAMES = C_CHAR_UNKNOWN
IMPORTING
OUT_ARCHIVE_PARAMETERS =
out_parameters = wa_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_print_parameters
*& Form job_submit
text
--> p1 text
<-- p2 text
FORM job_submit .
The job which we have created & the unique id ( jobcount ) which we
have got identifies our job. Hence those parameters are passed along
with the name of the background program "ZPROGRAM_TWO"
The job is submitted in background.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
authcknam = sy-uname
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = w_jobcount
jobname = w_jobname
LANGUAGE = SY-LANGU
priparams = wa_params
report = 'ZPROGRAM_TWO'
VARIANT = ' '
IMPORTING
STEP_NUMBER =
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10
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. " job_submit
*& Form job_close
text
--> p1 text
<-- p2 text
FORM job_close .
Once the job is submitted in background then the job is closed
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = w_jobcount
jobname = w_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
strtimmed = c_x
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
DONT_RELEASE = ' '
TARGETGROUP = ' '
DIRECT_START =
IMPORTING
JOB_WAS_RELEASED =
CHANGING
RET =
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9
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. " job_close
*& Form display_spool
text
--> p1 text
<-- p2 text
FORM display_spool .
To Read the Job to get the spool details
DATA : l_rqident TYPE tsp01-rqident, " Spool Number
l_spoolno TYPE tsp01_sp0r-rqid_char.
CLEAR : l_rqident,
w_lsind,
wa_jobsteplist.
REFRESH : i_jobsteplist.
SET PF-STATUS 'ZAR02'.
Get the Spool Number
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Read the Job Step list to get the spool number
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident <> space.
Spool Number
l_rqident = wa_jobsteplist-listident.
MOVE l_rqident TO l_spoolno.
Check the spool in TSP01
SELECT SINGLE * FROM tsp01 WHERE rqident = l_rqident.
IF sy-subrc = 0.
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = l_spoolno
IMPORTING
RC =
STATUS =
PERFORM show_alv.
ENDIF.
w_lsind = sy-lsind.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_spool
*& Form show_alv
text
--> p1 text
<-- p2 text
FORM show_alv .
Before the import, fill the data fields before CLUSTR.
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT i_mara
FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
FREE MEMORY ID wa_index_key1.
This prepares the field-catalog for ALV.
PERFORM prepare_fieldcatalog.
This displays the output in ALV format .
PERFORM display_alv.
ENDFORM. " show_alv
*& Form display_status
text
--> p1 text
<-- p2 text
FORM display_status .
To Display the STATUS of the JOB which is exectued in background
CLEAR : wa_jobsteplist.
REFRESH : i_jobsteplist.
WRITE:/ 'DISPLAYING JOB STATUS'.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
To Display the status text as per the status type
CASE wa_jobhead-status.
WHEN 'S'. WRITE: / 'Scheduled'.
WHEN 'R'. WRITE: / 'Released'.
WHEN 'F'. WRITE: / 'Completed'.
WHEN 'A'. WRITE: / 'Cancelled'.
WHEN OTHERS.
ENDCASE.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_status
*& Form display_job_log
text
--> p1 text
<-- p2 text
FORM display_job_log .
To display the log of the background program
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'BP_JOBLOG_SHOW_SM37B'
EXPORTING
client = sy-mandt
jobcount = w_jobcount
joblogid = ' '
jobname = w_jobname
EXCEPTIONS
error_reading_jobdata = 1
error_reading_joblog_data = 2
jobcount_missing = 3
joblog_does_not_exist = 4
joblog_is_empty = 5
joblog_show_canceled = 6
jobname_missing = 7
job_does_not_exist = 8
no_joblog_there_yet = 9
no_show_privilege_given = 10
OTHERS = 11.
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. " display_job_log
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Material no.'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Creation date'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Name of Person'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = ' Last Change'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = i_fieldcat
tables
t_outtab = i_mara.
ENDFORM. " display_alv
ZPROGRAM_TWO: This is the 2nd program which would be called from program ZPROGRAM_ONE.
*& Report ZPROGRAM_TWO *
REPORT zprogram_two .
PRASHANT PATIL
TABLES : mara.
TYPE-POOLS:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
SELECT-OPTIONS : s_matnr FOR mara-matnr.
Before the import, fill the data fields before CLUSTR.
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT s_matnr
FROM DATABASE indx(st) ID wa_index_key TO wa_index.
FREE MEMORY ID wa_index_key.
SELECT matnr
ersda
ernam
laeda
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
PERFORM prepare_fieldcatalog.
PERFORM display_alv.
Before the export, fill the data fields before CLUSTR
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
EXPORT i_mara
TO DATABASE indx(st) FROM wa_index1 ID wa_index_key1.
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_mara.
ENDFORM. " display_alv
its possible to display ALV Grid using OO ALV. Following code can be used instead of FM.
In the PBO, add following code
SET PF-STATUS 'ZSTAT'.
If program is executed in background
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING
e_offline = off.
IF off IS INITIAL.
IF container1 IS INITIAL.
CREATE OBJECT container1
EXPORTING
container_name = 'CC_ALV1' .
ENDIF.
ENDIF.
CREATE OBJECT g_grid1
EXPORTING
i_parent = container1.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
i_save = 'A'
i_default = ' '
is_layout =
is_print =
IT_SPECIAL_GROUPS =
it_toolbar_excluding =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = i_output
it_fieldcatalog = i_fieldcatalog
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
with regards,
Hema.
pls give points if helpful.
Similar Messages
-
Using a devices camera and adding the image to the display list
Hi,
My students and I have not been able to make an AIR app that can take a picture using the devices camera and then add the image to the display list. We are able to open the devices camera and of course take a picture, but that's it.
We've been using these two tutorials/examples:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/CameraUI.ht ml
and
http://tv.adobe.com/watch/adc-presents/input-for-mobile-devices-camera/
I've uploaded our project: http://www.dayvid.com/professor/camera.zip
Can someone help us out?
Thanks!
Below is the main document class:
package {
import flash.desktop.NativeApplication;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MediaEvent;
import flash.media.CameraUI;
import flash.media.MediaPromise;
import flash.media.MediaType;
import flash.events.MouseEvent;
public class Main extends MovieClip{
private var deviceCameraApp:CameraUI = new CameraUI();
private var imageLoader:Loader;
public function Main()
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
camera_btn.addEventListener(MouseEvent.CLICK, cameraBtnClicked);
private function cameraBtnClicked(event:MouseEvent):void
if( CameraUI.isSupported )
result_txt.text = "Initializing camera...";
deviceCameraApp.addEventListener( MediaEvent.COMPLETE, imageCaptured );
deviceCameraApp.addEventListener( Event.CANCEL, captureCanceled );
deviceCameraApp.addEventListener( ErrorEvent.ERROR, cameraError );
deviceCameraApp.launch( MediaType.IMAGE );
else
result_txt.text = "Camera interface is not supported.";
private function imageCaptured( event:MediaEvent ):void
result_txt.text = "Media captured...";
var imagePromise:MediaPromise = event.data;
if( imagePromise.isAsync )
result_txt.text = "Asynchronous media promise.";
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, asyncImageLoaded );
imageLoader.addEventListener( IOErrorEvent.IO_ERROR, cameraError );
imageLoader.loadFilePromise( imagePromise );
else
result_txt.text = "Synchronous media promise.";
imageLoader.loadFilePromise( imagePromise );
showMedia( imageLoader );
private function captureCanceled( event:Event ):void
result_txt.text = "Media capture canceled.";
NativeApplication.nativeApplication.exit();
private function asyncImageLoaded( event:Event ):void
result_txt.text = "Media loaded in memory.";
showMedia( imageLoader );
private function showMedia( loader:Loader ):void
this.addChild( loader );
private function cameraError( error:ErrorEvent ):void
result_txt.text = "Error:" + error.text;
NativeApplication.nativeApplication.exit();Hi,
Do I have to add the picture to the cameraroll in order to add it to the AIR apps display list?
Both examples from Adobe claim that their examples work. Do they not?
In the example, the event handler asyncImageLoaded is never called. The output text field shows - result_txt.text = "Asynchronous media promise."; So the Event.COMPLETE is being added. But I don't think it's being dispatched.
Any ideas? -
Display list of sales orders for one particular customer using BAPI in WD
Friends,
i want to display list of sales orders for one particular customer, the materials ordered, quantity ordered, goods issue date of that particular order and contact information about that particular customer, using Webdynpro.
Please somebody send me related info,blogs,help links , to complete this task, this is very urgent.
Please help
PeterFind the WD tutorials here...
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/web%20dynpro%20sample%20applications%20and%20tutorials.htm">Tutorials</a> -
Can anyone help me display the calendar list using an iphone4 with iso 7.1.1? I have already tried tapping the magnifying glass and that doesn't work.
That icon allows for the calendar month to display with the appts for that month below. I want to see only the list of appointments without the month displaying. I use to be able to get that display but since the last update tapping the magnifiying glass doesn't work.
-
I'm trying to make an interactive task board based on the task list app in SharePoint 2013. The task lisk includes fields like "Title","Description","Status","% Complete","Due Date","Assigned To",
etc. I used knockout.js to bind "Title","Description", and "Status" to my HTML controls. Here is some of the code:
var ViewModal = function(items, listname){
var self = this;
self.sortBy = ko.observableArray(sortBy);
self.tasks = ko.observableArray(items);
self.listname = ko.observable(listname);
self.auto = ko.observable(false);
self.getTasks = function() {
clearTimeout(self.getTasks);
// server relative url to REST service endpoint
var ajaxurl = _spPageContextInfo.webServerRelativeUrl + "/_vti_bin/listdata.svc/" + self.listname() + "?$orderby=PriorityValue";
$.ajax({
type: "GET",
url: ajaxurl,
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false,
processData: true,
success: function (data, status, xhr) {
if (status == "success" && data) {
ko.mapping.fromJS(data.d.results, mapping, self.tasks)
$(".task-item").draggable();
error: alert
if (self.auto()) {
setTimeout(self.getTasks, 10000);
<div class="tasks-column">
<div class="column-header">Not Started</div>
<!-- ko foreach: tasksNotStarted -->
<div class="task-item">
<div class="view" data-bind="visible: !IsEditing()">
<button class="edit" data-bind="click: $root.editTask">edit</button>
<h2><span data-bind="text: Title"></span></h2>
<div data-bind="html: Description"></div>
<span data-bind="text: PriorityValue"></span>
</div>
<div class="edit" data-bind="visible: IsEditing">
<button class="save" data-bind="click: $root.saveTask">save</button>
<input type="text" data-bind="value: Title"></input>
</div>
</div>
I'm having trouble displaying the data from the "Assigned To" user/group field. I tried:
<span data-bind="text: AssignedTo"></span>
But it displays the field as [object Object]
I tried using $select/$expand
?$select=Title,AssignedTo/Id,Assignedto/Title&$expand=AssignedTo/Id,AssignedTo/Title";
But it still returns the [object Object]Hi,
Please use the REST URI below:
/_api/lists/getbytitle('ListName')/items?$select=Title,AssignedTo/ID,AssignedTo/Title&$expand=AssignedTo/ID,AssignedTo/Title
More information for your reference:
How to get User Details and User Group Details in SharePoint 2013 REST API with Knockout for SharePoint Js (KoSpJs)
http://www.ashokraja.me/post/How-to-get-User-Details-and-User-Group-Details-in-SharePoint-2013-REST-API-with-Knockout-for-SharePoint-Js-(KoSpJs).aspx
How to Get Login Name and Display Name using SharePoint 2013 REST API
https://www.nothingbutsharepoint.com/sites/devwiki/articles/pages/how-to-get-login-name-and-display-name-using-sharepoint-2013-rest-api.aspx
Best Regards
Dennis Guo
TechNet Community Support -
How to send an updated list using batch job
Hi All,
The program displays data on the screen, if the data looks ok, then there is an option to update.
When I run update, the program submits a batch job and the basic list gets updated, but my batch job is still sending the data on the screen. how can i send the updated list using batch job.
Ex: output of the program
1 2
there is an update button on the screen, when i press update button, my program submits in batch job, the above list becomes
1 2
3 4
but when i check the spool, it shows the o/p as 1 2 ..it is not sending the updated list.
Please suggest me how to send the updated data
Thanks,
KumarHi Krishna,
I have added a button on the alv list. when i press update button, my program updates the list, then submits the batch job. I am attaching the sample test program i am trying with, please suggest me how can i get the updated list.
*& Report ZTESTSSSSS
REPORT ZTESTSSSSS.
DATA: gt_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat type slis_t_fieldcat_alv,
gt_sort TYPE slis_t_sortinfo_alv,
g_repid LIKE sy-repid,
gt_layout TYPE slis_layout_alv.
start-of-selection.
lt_return-type = 'S'.
lt_return-message = 'test message'.
append lt_return.
CLEAR gt_fieldcat.
gt_fieldcat-fieldname = 'TYPE'.
gt_fieldcat-outputlen = '3'.
gt_fieldcat-tabname = 'LT_RETURN'.
gt_fieldcat-seltext_l = 'Type'.
gt_fieldcat-seltext_m = 'Type'.
gt_fieldcat-seltext_s = 'Type'.
APPEND gt_fieldcat TO lt_fieldcat.
CLEAR gt_fieldcat.
gt_fieldcat-fieldname = 'MESSAGE'.
gt_fieldcat-outputlen = '15'.
gt_fieldcat-tabname = 'LT_RETURN'.
gt_fieldcat-seltext_l = 'Message'.
gt_fieldcat-seltext_m = 'Message'.
gt_fieldcat-seltext_s = 'Message'.
APPEND gt_fieldcat TO lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = lt_fieldcat
TABLES
T_OUTTAB = lt_return
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*& Form set_pf_status
text
-->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM. "Set_pf_status
*& Form user_command
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ 'UPD'.
Adding another message
lt_return-type = 'S'.
lt_return-message = 'Another test message'.
APPEND lt_return.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
l_upd = 'X'.
LOOP AT lt_return.
WRITE: / lt_return-type, lt_return-message.
ENDLOOP.
IF sy-batch IS INITIAL.
l_upd = 'X'.
Open the Job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_name
IMPORTING
jobcount = w_number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT ('ZTESTSSSSS') VIA JOB w_name NUMBER w_number
AND RETURN
WITH p_recnnr = p_recnnr.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_number
jobname = w_name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "User_command
Thanks,
Kumar -
How to get administrations of distribution list using api?
I want get all administrations of a distribution list using api, how to do that?
anybody knows? Thank you very much!!there is a standard function in mdm wd component
https://help.sap.com/saphelp_nwmdm71/helpdata/en/loio30bf76947bb64c48a2e835fda42c5183_30bf76947bb64c48a2e835fda42c5183/4…
"Note The Compare to Original button on the Items Detail component opens a Compare component enabling a user to compare a checked out record with an original record (if the user has authorization for the checked out group).
If the checked out record is a result of a merge action, then the Compare view displays all the original records prior to the merge. When a merge action is executed on a number of checked out records, the merged record is also checked out." -
How do I query a SharePoint List using a url and filtering on date?
I am reading a SharePoint list using jquery. Everything is working fine
except for the filter. Each list item has an expiration date. I want to retrieve JUST the items that have not expired (Expires > Today) but I can't figure out the url syntax and I've been searching all day for an example and
can't find one. Could someone please help?!? See bold code below.
Thanks,
Glen
$(document).ready(function ()
<strong>var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
</strong> $.getJSON(qryWCFUrl, function (results)
$.each(results.d.results, function (i, mmAlert)
itemID = mmAlert.Id;
mmTitle = mmAlert.Title;
mmClass = mmAlert.ClassValue;
//alert("Item="+itemID+" Title="+mmTitle+" Class="+mmClass);
AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);Fadi,
Thanks for your response. I actually have another version of the code that uses the SP client objects that works. The problem is site boundries. Let me give a more complete project explanation.
I am creating a master page for a new intranet. As part of this master page, I want to read from an SP list of alerts and post each alert (if not expired) in the SP status bar. I've gotten this to work with SP client objects and jquery (except
for the date filter part). Both of these solutions work fine on the top site level. BUT when trying it out at the sub-site level, the SP client objects version of my code fails. The jQuery version works except the date filtering.
I looked at the example from your link and it looks like a bit of a hybrid to my approaches: JQuery with CAML. My question is; does this example permit me to access a list in the top-level site from the subsites? Please excuse my ignorance,
but I am an EXTREME newbie in this having spent the past 8 years as a VB.Net developer and a little bit of ASP.Net.
Below are the two different versions of my code in different versions of my master page definition:
SP Client Object Version
<script type="text/javascript">
// <![CDATA[
ExecuteOrDelayUntilScriptLoaded(LoadAlerts, "sp.js");
var ctx;
var currAlerts;
function LoadAlerts() {
ctx = new SP.ClientContext.get_current();
list = ctx.get_web().get_lists('/sites/MMTP1/Lists/').getByTitle('MMAlerts');
var cmlQry = new SP.CamlQuery();
var camlExp = '<query><Query><Where><Gt><FieldRef Name="Expires" /><Value IncludeTimeValue="FALSE" Type="DateTime"><Today /></Value></Gt></Where></Query></query>';
cmlQry.set_viewXml(camlExp);
currAlerts = list.getItems(cmlQry);
ctx.load(currAlerts,'Include(ID,Title,Class)');
ctx.executeQueryAsync(GetAlertsSuccess,GetAlertsFailed);
function GetAlertsSuccess() {
var lstEnum = currAlerts.getEnumerator();
while(lstEnum.moveNext()) {
var mmAlert = lstEnum.get_current();
AddMMStatus(mmAlert.get_item('ID'),mmAlert.get_item('Title'),mmAlert.get_item('Class'));
function GetAlertsFailed(sender,args) {
alert('Alerts load failed: ' + args.tostring);
function AddMMStatus(msgID, strTitle, strClass) {
var statID;
var statClass;
var statTitle;
statClass = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a>";
statTitle = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a>";
statID = SP.UI.Status.addStatus(statClass, statTitle, true);
SP.UI.Status.setStatusPriColor(statID,"red");
function DisplayAlert(msgID) {
var options = {
title: "Miller & Martin Alert!",
url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
allowMaximize: false,
showClose: true
SP.UI.ModalDialog.showModalDialog(options);
// ]]>
</script>
JQuery Version (works except for filtering by date)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" >
// <![CDATA[
var itemID;
var mmTitle;
var mmClass;
$(document).ready(function ()
var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
$.getJSON(qryWCFUrl, function (results)
$.each(results.d.results, function (i, mmAlert)
itemID = mmAlert.Id;
mmTitle = mmAlert.Title;
mmClass = mmAlert.ClassValue;
AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);
function AddMMStatus(msgID, strTitle, strClass, strSeverity) {
var statID;
var statClass;
var statTitle;
statClass = "<div id=\"mmAlertTitle\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a></div>";
statTitle = "<div id=\"mmAlertDetail\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a></div>";
statID = SP.UI.Status.addStatus(statClass, statTitle, true);
SP.UI.Status.setStatusPriColor(statID,"green");
function DisplayAlert(msgID) {
var options = {
title: "Miller & Martin Alert!",
url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
allowMaximize: false,
showClose: true
SP.UI.ModalDialog.showModalDialog(options);
// ]]>
</script> -
Unable to display grid using OOALV
Hi,
I'm not able to display the list using Object-Oriented ALV technique. On executing it shows a pop-up error message as 'Program Error'. When I see its details, it shows as 'Output table passed to the ALV is not defined globally but locally. thus the reference to the table is lost'. My code snippet is as follows:
<Garbled code removed by moderator>
Kindly inform me the reason for this error or inform me the resolution for it.
I've created the Screen '200' and Custom container in it. Given the same name (i.e 'cust_cont') as ALV grid's parent. Also created the PF Status 'GRID'
Moderator message : Post only relevant portion of source code, use code tags for better visibility of code.
Edited by: Vinod Kumar on Jan 12, 2012 6:29 PMYou have to define the table in the TOP include of your program, then you should be good to go.
I have not seen your code but you have to do something like this
IF G_CUSTOM_CONTAINER IS INITIAL.
* creating container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.
* creating ALV GRID...
CREATE OBJECT GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
* SEt layout and fieldcat
PERFORM layout.
PERFORM fieldcat.
* Show list
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = ge_layout
CHANGING
IT_FIELDCATALOG = gt_fieldcat
IT_OUTTAB = gt_materiales.
ENDIF.
kind regards! -
ALV issue: when save list using Local File command will get run time error!
help!!!!
report list using ALV method when to save this list using Local File.
i will get GETWA_NOT_ASSIGNED run time error information.
how resolve it?
source code :
REPORT ZIFT0103.
TABLES : MARA,MARC,CDHDR,CDPOS,MAKT.
******DEVK909212****************
****利用工厂来区分不同的SERVER的FTP ADDRESS ,user ,PASSWORD
DATA: FTP_WERKS LIKE MARC-WERKS.
********定义一个RANGE用来抓取MARC的信息
RANGES:R_MATNR FOR MARA-MATNR OCCURS 0.
********定义一个INTERNAL TABLE 来抓取MARC 的信息
DATA:BEGIN OF IT_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
FLAG_UI TYPE C,
END OF IT_MARC.
*******定义存放北京的数据的变量
DATA : BEGIN OF FTP_BEIJING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_BEIJING .
******定义福清的数据变量
DATA : BEGIN OF FTP_FUQING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_FUQING .
*******DEVK909212*****************
DATA : BEGIN OF FTP_ITEMDOC1 OCCURS 0 ,
MATNR(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC1 .
DATA : BEGIN OF FTP_ITEMDOC OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC .
DATA: WA_ZMSGTA TYPE ZMSGTA ,
l_ersda like MARA-ERSDA .
***********DEVK909553********************
****用来决定执行FTP还是显示LIST**********
DATA:g_tcode_flag.
***********DEVK909553********************
Error message process ******************************
DEFINE EXPLAIN_MSG.
break soe_richard.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = &1 "SY-MSGID
NUMBER = &2 "SY-MSGNO
LANGUAGE = SY-LANGU
TEXTFORMAT = &3
LINKPATTERN =
MESSAGE_V1 = &4 "SY-MSGV1
MESSAGE_V2 = &5 "SY-MSGV2
MESSAGE_V3 = &6 "SY-MSGV3
MESSAGE_V4 = &7 "SY-MSGV4
IMPORTING
MESSAGE = &8 "WA_ZMSGTA-MSE1
RETURN =
TABLES
TEXT =
END-OF-DEFINITION.
DEFINE ERROR_MSG_UPDATA.
CALL FUNCTION 'ZINSERT_MSG' "IN UPDATE TASK
EXPORTING
XZMSGTA = &1 "WA_ZMSGTA
EXCEPTIONS
UPDATE_ERROR = 1
OTHERS = 2.
END-OF-DEFINITION.
IF SY-TCODE = 'ZIFT103' .
g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = '请耐心等候,系统正在抓数据'.
ENDIF.
l_ersda = sy-datum - 1 . "取前一天产生的物料号码。
DATA:BEGIN OF it_change OCCURS 0,
OBJECTID TYPE CDHDR-OBJECTID,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
TABKEY TYPE CDPOS-TABKEY,
END OF it_change.
DATA:BEGIN OF it_cDhdr OCCURS 0,
OBJECTID type CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
END OF it_cdhdr.
DATA:search_len TYPE I.
DATA:BEGIN of it_insert OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
END OF it_insert.
DATA:BEGIN OF it_MAKT OCCURS 0,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF it_makt.
DATA IT_MARA TYPE TABLE OF MARA WITH HEADER LINE.
DATA:BEGIN OF IT_OUT OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MATKL TYPE MARA-MATKL,
MAKTX TYPE MAKT-MAKTX,
PSTAT TYPE MARA-PSTAT,
BRGEW TYPE MARA-BRGEW,
NTGEW TYPE MARA-NTGEW,
GEWEI TYPE MARA-GEWEI,
FERTH TYPE MARA-FERTH,
KZUMW TYPE MARA-KZUMW,
ERNAM TYPE MARA-ERNAM,
ERSDA TYPE MARA-ERSDA,
END OF IT_OUT.
*-- DECLARE DATA FOR ALV
TYPE-POOLS: slis.
DATA : g_variant LIKE disvariant,
g_save(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE, "
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
gs_print TYPE slis_print_alv,
gs_layout TYPE slis_layout_alv .
******只能抓出系统有做更改的数据***************
******而第一次INSERT MARA的数据抓不出来********
START-OF-SELECTION.
SELECT AOBJECTID AUSERNAME AUDATE BTABKEY
INTO TABLE it_change
FROM ( CDPOS AS B INNER JOIN CDHDR AS A ON
AOBJECTCLAS = BOBJECTCLAS AND
AOBJECTID = BOBJECTID AND
ACHANGENR = BCHANGENR )
WHERE A~OBJECTCLAS = 'MATERIAL'
AND A~UDATE = l_ersda
AND B~TABNAME = 'MARC'
AND B~CHNGIND = 'I'.
LOOP AT it_change.
search_len = STRLEN( it_change-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = it_change-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = it_change-objectid+0(18).
IT_MARC-USERNAME = it_change-username.
IT_MARC-UDATE = It_change-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
****CDPOS is Cluster TABLE 所以没有办法用INNER JOIN******
SELECT OBJECTID CHANGENR USERNAME UDATE
INTO TABLE it_cdhdr
FROM CDHDR
WHERE OBJECTCLAS = 'MATERIAL'
AND UDATE = l_ersda.
AND TCODE = 'MM02'.
LOOP AT IT_cdhdr.
SELECT * FROM CDPOS
WHERE OBJECTCLAS = 'MATERIAL'
AND OBJECTID = IT_CDHDR-OBJECTID
AND CHANGENR = IT_CDHDR-CHANGENR
AND TABNAME = 'MARC'
AND CHNGIND = 'I'.
search_len = STRLEN( CDPOS-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = CDPOS-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = IT_cdhdr-objectid+0(18).
IT_MARC-USERNAME = IT_cdhdr-username.
IT_MARC-UDATE = IT_cdhdr-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
CLEAR IT_MARC.
ENDSELECT.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 20
TEXT = '处理好当天CHANGE的数据'.
ENDIF.
*******抓当天做了INSERT的数据*************
*******不需要***********************
SELECT BMATNR BWERKS INTO TABLE IT_INSERT
FROM MARC AS B JOIN MARA AS A
ON AMATNR = BMATNR
WHERE A~ERSDA = l_ersda.
LOOP AT IT_INSERT.
IT_MARC-MATNR = IT_INSERT-MATNR.
IT_MARC-WERKS = IT_INSERT-WERKS.
IT_MARC-FLAG_UI = 'I'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 40
TEXT = '处理好当天INSERT的数据'.
ENDIF.
IF g_tcode_flag = 'L'.
PERFORM get_MAKTX.
PERFORM get_mara.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 100
TEXT = '处理好数据,并开始显示数据'.
PERFORM do_data.
PERFORM display_alv.
ELSE.
PERFORM get_MAKTX.
PERFORM do_ftp.
ENDIF.
*& Form get_marktx
text
FORM get_maktx.
SELECT MATNR MAKTX INTO TABLE IT_MAKT FROM MAKT
WHERE MATNR IN R_MATNR AND SPRAS = '1'.
ENDFORM. "get_marktx
*& Form get_mara
text
FORM get_mara.
SELECT * INTO TABLE it_mara FROM MARA
WHERE MATNR IN R_MATNR.
ENDFORM. "get_mara
*& Form do_data
text
FORM do_data.
SORT IT_MARC BY MATNR WERKS.
DELETE ADJACENT DUPLICATES FROM IT_MARC COMPARING MATNR WERKS.
LOOP AT IT_MARC.
CLEAR IT_MAKT.
CLEAR IT_MARA.
READ TABLE IT_MAKT WITH KEY MATNR = IT_MARC-MATNR.
READ TABLE IT_MARA WITH KEY MATNR = IT_MARC-MATNR.
MOVE-CORRESPONDING IT_MARA TO IT_OUT.
IT_OUT-MAKTX = IT_MAKT-MAKTX.
IT_OUT-WERKS = IT_MARC-WERKS.
IF IT_MARC-FLAG_UI = 'U'.
IT_OUT-ERNAM = IT_MARC-USERNAME.
ENDIF.
APPEND IT_OUT.
CLEAR IT_OUT.
ENDLOOP.
ENDFORM. "do_data
*SELECT AMATNR BMAKTX INTO CORRESPONDING
*FIELDS OF FTP_ITEMDOC1 FROM MARA AS A JOIN MAKT AS B
*ON AMATNR = BMATNR WHERE A~ERSDA = l_ersda
*AND B~SPRAS = '1' . "代表为中文说明。
APPEND FTP_ITEMDOC1.
*******DEVK909212****************
*******添加RANGE*****************
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = FTP_ITEMDOC1-MATNR.
APPEND R_MATNR.
CLEAR FTP_ITEMDOC1.
*******DEVK909212****************
*ENDSELECT.
*******DEVK909212****************
****get WERKS information from MARC*******
*SELECT MATNR WERKS INTO TABLE IT_MARC
*FROM MARC
*WHERE MATNR IN R_MATNR.
*******DEVK909212****************
******DEVK909212****************
**MARK**************************
*LOOP AT FTP_ITEMDOC1 .
MOVE : FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_ITEMDOC-MAKTX.
APPEND FTP_ITEMDOC.
CLEAR FTP_ITEMDOC.
*ENDLOOP.
******DEVK909212****************
******DEVK909212***********************************
**根据IT_MARC中信息,往北京和福清的TABLE写数据*****
FORM do_ftp.
LOOP AT IT_MARC.
***福清的
IF IT_MARC-WERKS = '1010' OR IT_MARC-WERKS = '1020'
OR IT_MARC-WERKS = '1023' .
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_FUQING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_FUQING-MATNR,
IT_MARC-MATNR TO FTP_FUQING-MATNR1,
IT_MAKT-MAKTX TO FTP_FUQING-MAKTX.
APPEND FTP_FUQING.
CLEAR FTP_FUQING.
ENDIF.
***北京的
IF IT_MARC-WERKS = '1041' OR IT_MARC-WERKS = '1042'.
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_BEIJING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_BEIJING-MATNR,
IT_MARC-MATNR TO FTP_BEIJING-MATNR1,
IT_MAKT-MAKTX TO FTP_BEIJING-MAKTX.
APPEND FTP_BEIJING.
CLEAR FTP_BEIJING.
ENDIF.
ENDLOOP.
****清楚重复的数据**********
SORT FTP_FUQING.
DELETE ADJACENT DUPLICATES FROM FTP_FUQING.
SORT FTP_BEIJING.
DELETE ADJACENT DUPLICATES FROM FTP_BEIJING.
***传送数据********
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_FUQING[].
FTP_WERKS = '1010'.
PERFORM ftp_work.
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_BEIJING[].
FTP_WERKS = '1041'.
PERFORM ftp_work.
******DEVK909212***********************************
ENDFORM. "do_ftp
*& Form ftp_work
把以前FTP的工作做一个FORM
*******DEVK909212**************************
FORM ftp_work.
*******DEVK909212**************************
CHECK FTP_ITEMDOC[] IS NOT INITIAL.
FTP function *****************************************************
DATA : HDL TYPE I,
L_SLEN TYPE I ,
ERROR,
KEY TYPE I VALUE 26101957,
DEST TYPE RFCDES-RFCDEST VALUE 'SAPFTPA'.
DATA: FTP_RESULT TYPE TABLE OF TEXT.
DATA: P_FILE TYPE RLGRAP-FILENAME.
DATA: L_USER(16) TYPE C VALUE 'SFIS',
L_PWD(16) TYPE C VALUE 'SFIS',
L_HOST(16) TYPE C VALUE '172.16.31.17'.
*******DEVK909212**************************
*****根据不同的工厂来抓FTP的信息
CALL FUNCTION 'Z_FTP_SFIS'
EXPORTING
BLART = 'S'
WERKS = FTP_WERKS
IMPORTING
HOST = L_HOST
USER1 = L_USER
PASS1 = L_PWD.
*******DEVK909212**************************
CONCATENATE l_ersda '.KP' INTO P_FILE.
SET EXTENDED CHECK OFF.
ERROR = 0.
CHECK HDL IS INITIAL.
Connect to server
L_SLEN = STRLEN( L_PWD ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = L_PWD
SOURCELEN = L_SLEN
KEY = KEY
IMPORTING
DESTINATION = L_PWD.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Connect to FTP Server'.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = L_USER
PASSWORD = L_PWD
HOST = L_HOST
RFC_DESTINATION = DEST
IMPORTING
HANDLE = HDL
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = HDL
COMMAND = 'ascii'
TABLES
DATA = FTP_RESULT
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = HDL
FNAME = P_FILE
CHARACTER_MODE = 'X'
TABLES
TEXT = FTP_ITEMDOC
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
*******DEVK909212**************************
*******CLOSE FTP******************
CHECK NOT HDL IS INITIAL.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = HDL.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
DESTINATION = DEST
EXCEPTIONS
OTHERS = 1.
CLEAR HDL.
ENDFORM. "ftp_work
*******DEVK909212**************************
FORM DISPLAY_ALV .
*-- PREPARE ALV DATA
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*-- LAYOUT SETTING
PERFORM PREPARE_ALV_FIELD USING GT_FIELDCAT[].
*-- ALV DISPLAY
PERFORM CALL_REUSE_ALV_GRID_DISPLAY.
ENDFORM. " display_alv
*& Form eventtab_build
text
-->P_GT_EVENTS[] text
FORM EVENTTAB_BUILD USING PT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = PT_EVENTS.
READ TABLE PT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
LS_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY PT_EVENTS FROM LS_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " eventtab_build
*& Form comment_build
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM COMMENT_BUILD USING PT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
L_DATE(30),
l_v_BWKEY like T001W-BWKEY, "Valuation area
l_v_BUKRS like T001K-BUKRS. "Firm/Company
Listenerschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
select single BWKEY
into l_v_BWKEY
from t001w
where WERKS IN s_WERKS.
select single BUKRS
into l_v_BUKRS
from t001k
where BWKEY = l_v_BWKEY.
SELECT SINGLE butxt INTO LS_LINE-INFO
FROM t001
WHERE bukrs = l_v_BUKRS.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '报表名称:'.
LS_LINE-INFO = SY-TITLE.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印日期:'.
WRITE SY-DATUM TO LS_LINE-INFO.
ls_line-info = sy-datum.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印時間:'.
WRITE SY-UZEIT TO LS_LINE-INFO.
ls_line-info = sy-uzeit.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '使用者:'.
LS_LINE-INFO = SY-UNAME.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
ENDFORM. " comment_build
*& Form prepare_alv_field
text
-->P_GT_FIELDCAT[] text
FORM PREPARE_ALV_FIELD USING P_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_LINE TYPE SLIS_FIELDCAT_ALV.
*-- DEFINE MARCO
DEFINE APPEND_ALV_FIELD.
CLEAR LS_LINE.
LS_LINE-FIELDNAME = &1.
LS_LINE-TABNAME = &2.
LS_LINE-REPTEXT_DDIC = &3.
LS_LINE-SELTEXT_L = &3.
LS_LINE-SELTEXT_M = &3.
LS_LINE-SELTEXT_S = &3.
LS_LINE-QFIELDNAME = &4.
LS_LINE-QTABNAME = &5.
LS_LINE-NO_OUT = &6.
LS_LINE-NO_ZERO = &7.
LS_LINE-OUTPUTLEN = &8.
APPEND LS_LINE TO P_FIELDCAT.
END-OF-DEFINITION.
APPEND_ALV_FIELD: 'MATNR' 'IT_OUT' '料号'
'O' 'X' ''.
APPEND_ALV_FIELD: 'WERKS' 'IT_OUT' '工厂'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MTART' 'IT_OUT' 'MTyp'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MEINS' 'IT_OUT' 'BUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKL' 'IT_OUT' '物料组\分群码'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKX' 'IT_OUT' '物料描述'
'O' 'X' ''.
APPEND_ALV_FIELD: 'PSTAT' 'IT_OUT' '维护状态'
'O' 'X' ''.
APPEND_ALV_FIELD: 'BRGEW' 'IT_OUT' '毛重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'NTGEW' 'IT_OUT' '净重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'GEWEI' 'IT_OUT' 'WUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'FERTH' 'IT_OUT' '对外机种名'
'O' 'X' ''.
APPEND_ALV_FIELD: 'KZUMW' 'IT_OUT' '高关税标识'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERNAM' 'IT_OUT' '创建者'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERSDA' 'IT_OUT' '创建日期'
'O' 'X' ''.
ENDFORM. " prepare_alv_field
*& Form call_reuse_alv_grid_display
text
--> p1 text
<-- p2 text
FORM CALL_REUSE_ALV_GRID_DISPLAY .
gs_layout-f2code = 'DISPLAY'.
gs_print-no_print_listinfos = 'X'.
gs_layout-colwidth_optimize = 'X'. "列宽度自动根据内容优化
gs_layout-f2code = '&ETA'. "double check弹出详细信息
gs_layout-zebra = 'X'. "清单条纹显示
gs_layout-no_vline = ''. "是否显示列间隔线
gs_layout-box_fieldname = ''. "是否显示checkbox
gs_layout-confirmation_prompt = ''. "推出清单是否提示
gs_layout-detail_titlebar = '详细信息'."详细清单的标题
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PF_STATUS_SET = 'ALV_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'ALV_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = GT_LIST_TOP_OF_PAGE[]
IT_FIELDCAT = GT_FIELDCAT[]
IT_EVENTS = GT_EVENTS[]
I_STRUCTURE_NAME = 'IT_OUT'
I_SAVE = 'A'
IS_LAYOUT = GS_LAYOUT
IS_PRINT = GS_PRINT
TABLES
T_OUTTAB = IT_OUT
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. " call_reuse_alv_grid_display
*& Form PREPARE_ALV_FIELD
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "TOP_OF_PAGEHi,
Please check your field catalog and refer field names once again.
Check spelling, or Check strucutre properly.
There are something wrong in your catalog definition
aRs. -
Help with taking a pic with Android camera and adding pic to display list
Hi,
My students and I have not been able to make an AIR app that can take a picture using the devices camera and then add the image to the display list. We are able to open the devices camera and of course take a picture, but that's it.
We've been using these two tutorials/examples:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/media/CameraUI.html
and
http://tv.adobe.com/watch/adc-presents/input-for-mobile-devices-camera /
I've uploaded our project: http://www.dayvid.com/professor/camera.zip
Can someone help us out?
Thanks!
Below is the main document class:
package {
import flash.desktop.NativeApplication;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MediaEvent;
import flash.media.CameraUI;
import flash.media.MediaPromise;
import flash.media.MediaType;
import flash.events.MouseEvent;
public class Main extends MovieClip{
private var deviceCameraApp:CameraUI = new CameraUI();
private var imageLoader:Loader;
public function Main()
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
camera_btn.addEventListener(MouseEvent.CLICK, cameraBtnClicked);
private function cameraBtnClicked(event:MouseEvent):void
if( CameraUI.isSupported )
result_txt.text = "Initializing camera...";
deviceCameraApp.addEventListener( MediaEvent.COMPLETE, imageCaptured );
deviceCameraApp.addEventListener( Event.CANCEL, captureCanceled );
deviceCameraApp.addEventListener( ErrorEvent.ERROR, cameraError );
deviceCameraApp.launch( MediaType.IMAGE );
else
result_txt.text = "Camera interface is not supported.";
private function imageCaptured( event:MediaEvent ):void
result_txt.text = "Media captured...";
var imagePromise:MediaPromise = event.data;
if( imagePromise.isAsync )
result_txt.text = "Asynchronous media promise.";
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, asyncImageLoaded );
imageLoader.addEventListener( IOErrorEvent.IO_ERROR, cameraError );
imageLoader.loadFilePromise( imagePromise );
else
result_txt.text = "Synchronous media promise.";
imageLoader.loadFilePromise( imagePromise );
showMedia( imageLoader );
private function captureCanceled( event:Event ):void
result_txt.text = "Media capture canceled.";
NativeApplication.nativeApplication.exit();
private function asyncImageLoaded( event:Event ):void
result_txt.text = "Media loaded in memory.";
showMedia( imageLoader );
private function showMedia( loader:Loader ):void
this.addChild( loader );
private function cameraError( error:ErrorEvent ):void
result_txt.text = "Error:" + error.text;
NativeApplication.nativeApplication.exit();Hi,
My students and I have not been able to make an AIR app that can take a picture using the devices camera and then add the image to the display list. We are able to open the devices camera and of course take a picture, but that's it.
We've been using these two tutorials/examples:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/media/CameraUI.html
and
http://tv.adobe.com/watch/adc-presents/input-for-mobile-devices-camera /
I've uploaded our project: http://www.dayvid.com/professor/camera.zip
Can someone help us out?
Thanks!
Below is the main document class:
package {
import flash.desktop.NativeApplication;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MediaEvent;
import flash.media.CameraUI;
import flash.media.MediaPromise;
import flash.media.MediaType;
import flash.events.MouseEvent;
public class Main extends MovieClip{
private var deviceCameraApp:CameraUI = new CameraUI();
private var imageLoader:Loader;
public function Main()
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
camera_btn.addEventListener(MouseEvent.CLICK, cameraBtnClicked);
private function cameraBtnClicked(event:MouseEvent):void
if( CameraUI.isSupported )
result_txt.text = "Initializing camera...";
deviceCameraApp.addEventListener( MediaEvent.COMPLETE, imageCaptured );
deviceCameraApp.addEventListener( Event.CANCEL, captureCanceled );
deviceCameraApp.addEventListener( ErrorEvent.ERROR, cameraError );
deviceCameraApp.launch( MediaType.IMAGE );
else
result_txt.text = "Camera interface is not supported.";
private function imageCaptured( event:MediaEvent ):void
result_txt.text = "Media captured...";
var imagePromise:MediaPromise = event.data;
if( imagePromise.isAsync )
result_txt.text = "Asynchronous media promise.";
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, asyncImageLoaded );
imageLoader.addEventListener( IOErrorEvent.IO_ERROR, cameraError );
imageLoader.loadFilePromise( imagePromise );
else
result_txt.text = "Synchronous media promise.";
imageLoader.loadFilePromise( imagePromise );
showMedia( imageLoader );
private function captureCanceled( event:Event ):void
result_txt.text = "Media capture canceled.";
NativeApplication.nativeApplication.exit();
private function asyncImageLoaded( event:Event ):void
result_txt.text = "Media loaded in memory.";
showMedia( imageLoader );
private function showMedia( loader:Loader ):void
this.addChild( loader );
private function cameraError( error:ErrorEvent ):void
result_txt.text = "Error:" + error.text;
NativeApplication.nativeApplication.exit(); -
How to display 'List' of objects in table format
I am trying to display bunch of records in the table format.
I have the List of bean object populated with table datas.
Currently the code is working fine ,if I tend to display one record.I am wondering how to display all the records.
I know theres a 'Fieldloop'.If thats the one please explain with example.iterate the object list using field loop. eg. is given below
[ <Field name='MatchTable'>
<Display class='SimpleTable'>
<Property name='columns'>
<List>
<String>title</String>
</List>
</Property>
</Display>
<FieldLoop for='name' in='userlist'>
<Field name='username'>
<Display class='Label'>
<Property name='labels'>
<ref>name</ref>
</Property>
</Display>
</Field>
<FieldLoop>
</Field> -
Accessing the global Address List using Java Outlook Connector
Hi All,
I have written a code to access the Global Address List using (Jar) in Java outlook Connector
However i am able to retriev the name and email address of that employee only.
I want the other details like location(particularly).
Please help out.
Thanks,
Arijit.Ari_Dev wrote:
The scenario is i am an employee and i want to get information regarding other employees(name,location) which are stored in outlook through my java application(using JOC).Just a point of clarification, there is no actual java code in the Sun Outlook Connector. The use of Java with most of our products names is for marketing/branding purposes only.
Now there are employees who are not stored in my address book or local contacts.For them when i try to read the GAL i can get only their name and email address.So the 'cn:' (name) and 'mail:' (email address) attributes are being provided by the directory for a GAL search.
however if i try displaying their details using the JOC it comes with proper information through the outlook pop up but cannot read this data.As I said in my previous response, the data that the Sun Outlook Connector provides in the GAL view is determined by the user that the GAL binds to the directory server as, plus the restrictions that user has on the information the directory server will provide for GAL searches/queries.
This bind user is usually different from the 'super-user' bind user that UWC/Communications Express uses which is why you may see more information in UWC/CE compared to in the GAL in Outlook.
Therefore you need to work with the Directory Server administrator to increase the information that the Sun Outlook Connector user is able to see.
Regards,
Shane. -
Noobie question: How do I add something to the display list from a non-main class?
I know how to use addChild() within the main class to add
something to the stage display list and have it appear on the
screen, but how do I add something to the stage display list from
code within another class?
So for example say I want to add some text (myTextField) to
the stage's display list from within NotTheMainClass' code, could
you give an example of the necessary code?you must pass a reference to a display list object or create
one that's available to your class.
there are so many ways to do this i'm not sure how you want
to proceed. but you can create a globally available reference to
the stage and root timeline: -
Hi experts,
i am using one standard function module in my program. i am calling this program using a submit and return statement in another program.In the standard funtion module one write statement is used. My issue is once the function module is called and the program is returning to the main program. once it is returned the main program got stopped and going to the next screen and showing the list whatever which is written by using write statement. i think this is happening because of the return statement. but i want to suppress the display list.
Thanks in advance.
ArulUse addition EXPORTING LIST TO MEMORY of the SUBMIT statement.
Like:
SUBMIT report EXPORTING LIST TO MEMORY
AND RETURN.
Regards,
Naimesh Patel
Maybe you are looking for
-
Where can I download the files and intro-intro.mov sound.mp3?
I accidentally deleted files and intro-intro.mov sound.mp3 to see the welcome video. Where can I download them? I have mac os x version 10.7.4 Thanks to all
-
Redirecting to different pages based on value from table linked from report
Hi, I wanted to navigate to different pages from a report link based on a value from the table on which the report is built. I was able to link to particular page without any problem. But, I wanted to link to different pages based on value in the tab
-
IPad apps crash after installing iOS 4.2
After i installed iOS 4.2 almost any app crashes after a few minutes to the home screen and changes arent saved yet. Some apps handle it a bit longer, some crash right after a minute or so. Any idea why or what to do?
-
Does anyone know how to compact an Access Database programmatically from LabVIEW? Can the Database Connectivity Toolset be used?
-
Virus detected in J2SE V5.0 download??!!
I just ran my Symantec AntiVirus on my Win2003 Server and it quarantined the following file: File: C:\Documents and Settings\Administrator\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar\arr3.jar-58b317c1-609c5581.zip>>Counter.class Symant