Service For Object
Service For Object
Process:
* SELECTION-SCREEN
PARAMETERS : P_FUNLOC TYPE ILOA-TPLNR,
CB_PRVW TYPE C AS CHECKBOX.
Step 1:
Get the Spool Requests that are generated by the Active User (user running the
program) from the table
TSP01 and hold the latest Spool by sorting and reading index 1.
Step 2:
Now modify the table TSP01 by updating the field - RQPRIO (Spool: Spool or print
request priority) to 1
(Very high priority).
IF SY-SUBRC = 0.
UPDATE TSP01
SET RQPRIO = '1'
WHERE RQIDENT = LS_TSP01-RQIDENT.
REFRESH LI_TSP01[].
ENDIF.
ENDIF.
Step 3:
Target any place in the system (desktop/presentation server) and get the list of
files present in that
directory.
Step 4:
If the targeted directory is not empty (contains any files) after calling the above
method, delete all those
files and make directory empty by calling method FILE_DELETE of class
CL_GUI_FRONTEND_SERVICES.
Step 5:
Step 6:
Now get the object content by calling Function Module SO_OBJECT_READ by passing the
Folder Id and
Object Id captured from above function module.
Then download the Object (attachment) into the above targeted folder using function
module
SO_OBJECT_DOWNLOAD by passing the component Id, Path and object content fetched
from above
function module.
And also show Preview or directly print as per the user restrictions by calling
method EXECUTE of class
CL_GUI_FRONTEND_SERVICES by passing path of object and operation (either preview or
print).