on 2007 Jan 09 3:11 PM
Hi All
I have created a spool for a SAP script now i want to get the OTF format into an internal table and pass the OTF internal table to use this internal table in the FM CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF' which will give me PDF format. My problem is in the 3.1i version we used CALL 'RSPOACSD'(call cfunc) to get the OTF data into the internal table. Now in ECC5.0 Call cfunc are obsolete. can any one help how to go about this.
Regards,
Lakshmikanth.T.V
check below code...
&----
*& Report ZFR_SEND_FPY1_SPOOL *
*& *
&----
*& *
&----
REPORT ZFR_SEND_SPOOL LINE-SIZE 120
LINE-COUNT 60
MESSAGE-ID ZF_CD.
--
TYPES: BEGIN OF TY_JOB_ID,
JOBNAME TYPE BTCJOB,
JOBCOUNT TYPE BTCJOBCNT,
STEPCOUNT TYPE BTCSTEPCNT,
STRTDATE TYPE BTCXDATE,
STRTTIME TYPE BTCXTIME,
END OF TY_JOB_ID.
TYPES: TY_T_SPOOL_LIST TYPE STANDARD TABLE OF SOLI.
--
TABLES: SOMLRECI1, TBTCO.
--
DATA: IT_SPOOL_LIST TYPE STANDARD TABLE OF SOLI,
IT_VALUTAB TYPE STANDARD TABLE OF RSPARAMS.
--
CONSTANTS: CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
--
DATA: W_JOB_NAME TYPE BTCJOB,
W_JOB_ID TYPE BTCJOBCNT,
W_SPOOL_ID TYPE BTCLISTID,
W_VARIANT TYPE BTCVARIANT,
W_JOB_DATE TYPE BTCXDATE,
W_STEP_ID TYPE BTCSTEPCNT.
--
SELECT-OPTIONS: S_JOB FOR TBTCO-JOBNAME OBLIGATORY NO INTERVALS.
--
SELECT-OPTIONS: S_REC FOR SOMLRECI1-RECEIVER OBLIGATORY NO INTERVALS
DEFAULT 'abraham.jimenez@ge.com'.
--
INITIALIZATION.
S_JOB-SIGN = 'I'.
S_JOB-OPTION = 'CP'.
S_JOB-LOW = 'ERCPASS-BC_TFRRECK*_CMD'.
APPEND S_JOB.
S_JOB-SIGN = 'I'.
S_JOB-OPTION = 'CP'.
S_JOB-LOW = 'ERCPASS-BC_AUTOAPRV*_CMD'.
APPEND S_JOB.
--
START-OF-SELECTION.
Get the latest job id, job step and job full name corresponding to the
Job name pattern in the selection screen
PERFORM GET_JOB_ID CHANGING W_JOB_ID
W_STEP_ID
W_JOB_NAME
W_JOB_DATE.
Get the spool request number corresponding to the Job Name, Job Id and
Step Id
PERFORM GET_SPOOL_REQUEST_NO USING W_JOB_NAME
W_JOB_ID
W_STEP_ID
CHANGING W_SPOOL_ID
W_VARIANT.
Get spool list based on the spool request number and keep only
error messages of spool list for FPG1 transaction and the entire spool
list for ZF30 transaction
PERFORM GET_SPOOL_LIST_AND_FILTER USING W_JOB_NAME
W_SPOOL_ID
CHANGING IT_SPOOL_LIST.
This subroutine sends excel attachment of the spool list
in email
PERFORM SEND_EXCEL_ATT_IN_MAIL USING IT_SPOOL_LIST
W_JOB_NAME
W_VARIANT
W_JOB_DATE.
--
END-OF-SELECTION.
&----
*& Form GET_JOB_ID
&----
This subroutine gets the latest Job ID, Step ID and Full name
of the job based on the job pattern entered in the selection
screen
----
<--P_JOB_ID Job Id
<--P_STEP_ID Step Id
<--P_JOB_NAME Full Job name
<--P_START_DATE Job Run Date
----
FORM GET_JOB_ID CHANGING P_JOB_ID TYPE BTCJOBCNT
P_STEP_ID TYPE BTCSTEPCNT
P_JOB_NAME TYPE BTCJOB
P_START_DATE TYPE BTCXDATE.
DATA: IT_JOB_ID TYPE STANDARD TABLE OF TY_JOB_ID,
WA_JOB_ID TYPE TY_JOB_ID.
SELECT JOBNAME JOBCOUNT STEPCOUNT STRTDATE STRTTIME
FROM TBTCO
INTO TABLE IT_JOB_ID
WHERE JOBNAME IN S_JOB
AND STATUS = 'F'
ORDER BY STRTDATE DESCENDING STRTTIME DESCENDING.
IF SY-SUBRC <> 0.
MESSAGE I004 WITH TEXT-001.
EXIT.
ELSE.
READ TABLE IT_JOB_ID INTO WA_JOB_ID INDEX 1.
P_JOB_ID = WA_JOB_ID-JOBCOUNT.
P_STEP_ID = WA_JOB_ID-STEPCOUNT.
P_JOB_NAME = WA_JOB_ID-JOBNAME.
P_START_DATE = WA_JOB_ID-STRTDATE.
ENDIF.
ENDFORM. " GET_JOB_ID
&----
*& Form GET_SPOOL_REQUEST_NO
&----
This subroutine gets the Spool request number from the Job Name,
Job ID and Step Id
----
-->P_JOB_NAME Job name
-->P_JOB_ID Job Count
-->P_STEP_ID Step Id
<--P_SPOOL_ID Spool Id
<--P_VARIANT Variant
----
FORM GET_SPOOL_REQUEST_NO USING P_JOB_NAME TYPE BTCJOB
P_JOB_ID TYPE BTCJOBCNT
P_STEP_ID TYPE BTCSTEPCNT
CHANGING P_SPOOL_ID TYPE BTCLISTID
P_VARIANT TYPE BTCVARIANT.
CHECK NOT P_JOB_NAME IS INITIAL.
SELECT SINGLE LISTIDENT VARIANT INTO (P_SPOOL_ID, P_VARIANT)
FROM TBTCP
WHERE JOBNAME = P_JOB_NAME
AND JOBCOUNT = P_JOB_ID
AND STEPCOUNT = P_STEP_ID.
ENDFORM. " GET_SPOOL_REQUEST_NO
&----
*& Form GET_SPOOL_LIST_AND_FILTER
&----
This subroutine gets the spool list corresponding to the spool
request number and keeps only those records in the spool list
which contains error for FPG1 and keeps the entire spool list
for ZF30
----
-->P_JOB_NAME Job Name
-->P_SPOOL_ID Spool Id
<--PT_SPOOL_LIST Internal table containing the spool list
----
FORM GET_SPOOL_LIST_AND_FILTER USING P_JOB_NAME TYPE BTCJOB
P_SPOOL_ID TYPE BTCLISTID
CHANGING P_T_SPOOL_LIST TYPE
TY_T_SPOOL_LIST.
DATA: W_SPOOL_NO TYPE RSPOID,
W_INDEX TYPE SYTABIX,
W_LINES TYPE SY-TABIX,
WA_SPOOL_LIST TYPE SOLI.
CHECK NOT P_SPOOL_ID IS INITIAL.
W_SPOOL_NO = P_SPOOL_ID.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
RQIDENT = W_SPOOL_NO
DESIRED_TYPE = 'RAW'
TABLES
BUFFER = P_T_SPOOL_LIST
EXCEPTIONS
NO_SUCH_JOB = 1
JOB_CONTAINS_NO_DATA = 2
SELECTION_EMPTY = 3
NO_PERMISSION = 4
CAN_NOT_ACCESS = 5
READ_ERROR = 6
TYPE_NO_MATCH = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
MESSAGE I004 WITH TEXT-002 P_JOB_NAME.
EXIT.
ENDIF.
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
LOOP AT P_T_SPOOL_LIST INTO WA_SPOOL_LIST.
IF ( WA_SPOOL_LIST-LINE CS 'Transfer Complete' ) OR
( WA_SPOOL_LIST-LINE CS '-----' ).
DELETE TABLE P_T_SPOOL_LIST FROM WA_SPOOL_LIST.
ELSE.
REPLACE ALL OCCURRENCES OF '|' IN WA_SPOOL_LIST-LINE WITH CON_TAB.
CONCATENATE CON_CRET WA_SPOOL_LIST-LINE INTO WA_SPOOL_LIST-LINE.
MODIFY P_T_SPOOL_LIST FROM WA_SPOOL_LIST TRANSPORTING LINE.
ENDIF.
ENDLOOP.
LOOP AT P_T_SPOOL_LIST INTO WA_SPOOL_LIST.
IF WA_SPOOL_LIST-LINE CS 'Msg. var.'.
CLEAR W_INDEX.
W_INDEX = SY-TABIX.
ENDIF.
ENDLOOP.
W_INDEX = W_INDEX + 1.
READ TABLE P_T_SPOOL_LIST INTO WA_SPOOL_LIST INDEX W_INDEX.
IF SY-SUBRC <> 0.
DESCRIBE TABLE P_T_SPOOL_LIST LINES W_LINES.
DELETE P_T_SPOOL_LIST FROM 1 TO W_LINES.
ENDIF.
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
LOOP AT P_T_SPOOL_LIST INTO WA_SPOOL_LIST.
REPLACE ALL OCCURRENCES OF '|' IN WA_SPOOL_LIST-LINE WITH CON_TAB.
CONCATENATE CON_CRET WA_SPOOL_LIST-LINE INTO WA_SPOOL_LIST-LINE.
MODIFY P_T_SPOOL_LIST FROM WA_SPOOL_LIST TRANSPORTING LINE.
ENDLOOP.
ENDIF.
ENDFORM. " GET_SPOOL_LIST_AND_FILTER
&----
*& Form SEND_EXCEL_ATT_IN_MAIL
&----
This subroutine sends excel attachment of the list in email
----
-->P_T_SPOOL_LIST Internal table containing filtered spool list
-->P_JOB_NAME Job Name
-->P_VARIANT Variant name of the job
-->P_JOB_DATE Job Run Date
----
FORM SEND_EXCEL_ATT_IN_MAIL USING P_T_SPOOL_LIST TYPE TY_T_SPOOL_LIST
P_JOB_NAME TYPE BTCJOB
P_VARIANT TYPE BTCVARIANT
P_JOB_DATE TYPE BTCXDATE.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
W_VALUTAB TYPE RSPARAMS,
W_RUN_DATE TYPE CHAR10,
W_VALTAB TYPE RSPARAMS,
DOC_CHNG LIKE SODOCCHGI1,
Start of change by Sharmistha as per CCSB Request 4693276
W_RUNID TYPE ZRUN_ID,
W_DATE TYPE ZDATE,
W_TIME TYPE ZTIME,
End of change by Sharmistha
L_SLINE(255) TYPE C,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
W_TAB_LINES TYPE SYTABIX.
CHECK NOT P_T_SPOOL_LIST IS INITIAL.
objbin[] = p_t_spool_list.
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
OBJTXT = TEXT-003.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
CONCATENATE TEXT-011 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT P_JOB_NAME '''' INTO OBJTXT.
APPEND OBJTXT.
CONCATENATE TEXT-012 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE P_JOB_DATE4(2) P_JOB_DATE6(2) P_JOB_DATE+0(4) INTO
W_RUN_DATE SEPARATED BY '/'.
CONCATENATE OBJTXT W_RUN_DATE '''' INTO OBJTXT.
APPEND OBJTXT.
CLEAR OBJTXT.
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
OBJTXT = TEXT-004.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
CONCATENATE TEXT-006 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT P_JOB_NAME '''' INTO OBJTXT.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = 'ZFR_AUTOAPPROVAL_POLICY50'
VARIANT = P_VARIANT
TABLES
VALUTAB = IT_VALUTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE I004 WITH TEXT-007.
ELSE.
READ TABLE IT_VALUTAB INTO W_VALTAB WITH KEY SELNAME = 'S_SRCID'.
CONCATENATE TEXT-010 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT W_VALTAB-LOW '''' INTO OBJTXT.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
Start of change by Sharmistha as per CCSB Request 4693276
READ TABLE IT_VALUTAB INTO W_VALUTAB WITH KEY SELNAME = 'S_DATUM'.
READ TABLE IT_VALUTAB INTO W_VALTAB WITH KEY SELNAME = 'P_FTIME'.
SELECT SINGLE ZRUNID ZDATE ZTIME
FROM ZFPR_RUNTIMEHIST
INTO (W_RUNID, W_DATE, W_TIME)
WHERE ZRUNID = ( SELECT MAX( ZRUNID )
FROM ZFPR_RUNTIMEHIST ).
IF SY-SUBRC = 0.
WRITE W_DATE TO W_VALUTAB-HIGH.
W_RUNID = W_RUNID - 1.
WRITE W_TIME TO W_VALTAB-HIGH.
SELECT SINGLE ZDATE ZTIME
FROM ZFPR_RUNTIMEHIST
INTO (W_DATE, W_TIME)
WHERE ZRUNID = W_RUNID.
IF SY-SUBRC = 0.
WRITE W_DATE TO W_VALUTAB-LOW.
WRITE W_TIME TO W_VALTAB-LOW.
ENDIF.
ENDIF.
*End of change by Sharmistha
CONCATENATE TEXT-008 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT W_VALUTAB-LOW '''' INTO OBJTXT.
CONCATENATE OBJTXT '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT W_VALTAB-LOW '''' INTO OBJTXT.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
Start of change by Sharmistha as per CCSB Request 4693276
READ TABLE IT_VALUTAB INTO W_VALTAB WITH KEY SELNAME = 'P_TTIME'.
End of change by Sharmistha
CONCATENATE TEXT-009 '''' INTO OBJTXT SEPARATED BY SPACE.
CONCATENATE OBJTXT W_VALUTAB-HIGH '''' INTO OBJTXT.
CONCATENATE OBJTXT '''' INTO OBJTXT SEPARATED BY SPACE.
Start of change by Sharmistha as per CCSB Request 4693276
CONCATENATE OBJTXT W_VALTAB-LOW '''' INTO OBJTXT.
CONCATENATE OBJTXT W_VALTAB-HIGH '''' INTO OBJTXT.
*End of change by Sharmistha
APPEND OBJTXT.
CLEAR OBJTXT.
ENDIF.
ENDIF.
DESCRIBE TABLE OBJTXT LINES W_TAB_LINES.
READ TABLE OBJTXT INDEX W_TAB_LINES INTO L_SLINE.
DOC_CHNG-DOC_SIZE = ( W_TAB_LINES ) * 255 + STRLEN( L_SLINE ).
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
DOC_CHNG-OBJ_DESCR = 'Error Recon Key List'.
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
DOC_CHNG-OBJ_DESCR = TEXT-005.
ENDIF.
DOC_CHNG-OBJ_EXPDAT = '29991231'.
DOC_CHNG-SENSITIVTY = 'O'.
DOC_CHNG-OBJ_PRIO = '5'.
DOC_CHNG-EXPIRY_DAT = '29991231'.
DOC_CHNG-PROC_TYPE = 'R'.
CLEAR OBJPACK-TRANSF_BIN .
OBJPACK-HEAD_START = 0.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = W_TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
OBJPACK-OBJ_NAME = 'Error Recon Key List'.
OBJPACK-OBJ_DESCR = 'RECON KEY ERROR LIST'.
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
OBJPACK-OBJ_NAME = TEXT-005.
OBJPACK-OBJ_DESCR = 'AUTOAPPROVAL POLICY5 SPOOL LIST'.
ENDIF.
APPEND OBJPACK.
DESCRIBE TABLE objbin LINES W_TAB_LINES.
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
OBJHEAD = 'Error_recon_key.xls'. " Attachment Name
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
OBJHEAD = 'Autoapprv_policy5.xls'. " Attachment Name
ENDIF.
APPEND OBJHEAD.
Creation of the entry for the attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = w_tab_lines.
objpack-doc_type = 'XLS'.
IF ( P_JOB_NAME CP 'ERCPASS-BC_TFRRECK*_CMD' ) OR
( P_JOB_NAME CP 'RFKKGL00' ).
objpack-obj_name = 'Error Recon Key'.
objpack-obj_descr = 'Error Recon Key'.
ELSEIF ( P_JOB_NAME CP 'ERCPASS-BC_AUTOAPRV*_CMD' ) OR
( P_JOB_NAME CP 'ZFR_AUTO*_POLICY50' ).
objpack-obj_name = TEXT-005.
objpack-obj_descr = TEXT-005.
ENDIF.
objpack-doc_size = w_tab_lines * 255.
APPEND objpack.
Completing the recipient list
LOOP AT S_REC.
reclist-receiver = S_REC-LOW.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
ENDLOOP.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF SY-SUBRC = 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.
ENDFORM. " SEND_EXCEL_ATT_IN_MAIL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
SAP have created a standard program <b>RSTXPDFT4</b> to convert your Sapscripts spools into a PDF format.
See the below links for example programs
http://searchsap.techtarget.com/tip/1,289483,sid21_gci1121833,00.html
http://searchsap.techtarget.com/tip/0,289483,sid21_gci853372,00.html
See the below threads for more info
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
try fm CONVERT_OTFSPOOLJOB_2_PDF
or report RSTXPDFT4
A.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
11 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.