cancel
Showing results for 
Search instead for 
Did you mean: 

Get Spool number for Smartform

Former Member
0 Kudos

Hi All,

I have created a smartform to print the POs created through ME21n. I have changed the config to use this smartform when a PO is changed/created. Everything is working fine. All I need is the spool number for each of the PO this is being printed. Can you please let me know how I can achieve this through the FM for smartform?

I AM USING 4.6C.

This is how I am using the function module

CALL FUNCTION FM_NAME

EXPORTING

CONTROL_PARAMETERS = CONTROL

OUTPUT_OPTIONS = OUTPUT

USER_SETTINGS = ' '

EKKO = L_DOC-XEKKO

PEKKO = L_DOC-XPEKKO

DRUVO = L_DRUVO

IMPORTING

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

EKPO = L_DOC-XEKPO

PEKPO = L_DOC-XPEKPO

XAEND = IT_XAEND

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

All your inputs are greatly appreciated.

Thanks!

Sandeep

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Chek the system fields SY-SPONO.

Or

Check the JOB_OUTPUT_INFO-SPOOLIDS

Former Member
0 Kudos

Hi,

JOB_OUTPUT_OPTIONS is of type SSFCRESOP, which does not have a SPOOLIDS field/table.

I knwo that the function module SSF_CLOSE returns the spool id in a table. But, I am not sure how to use SSF_OPEN and SSF_CLOSE. Can you please throw some light on how I can use these to get the spool numbers?

This is what I have right now.

JOB_OUTPUT_OPTIONS-TDDEST = ITCPO-TDDEST.

JOB_OUTPUT_OPTIONS-TDNEWID = 'X'.

L_FORMNAME = TNAPR-FONAM.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

  • FORMNAME = TNAPR-SFORM

FORMNAME = L_FORMNAME

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION FM_NAME

EXPORTING

CONTROL_PARAMETERS = CONTROL

OUTPUT_OPTIONS = OUTPUT

USER_SETTINGS = ' '

EKKO = L_DOC-XEKKO

PEKKO = L_DOC-XPEKKO

DRUVO = L_DRUVO

IMPORTING

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

EKPO = L_DOC-XEKPO

PEKPO = L_DOC-XPEKPO

XAEND = IT_XAEND

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

SELECT RQIDENT RQOWNER RQCRETIME FROM TSP01 INTO TABLE IT_TSP01

WHERE RQOWNER = SY-UNAME.

IF SY-SUBRC = 0.

SORT IT_TSP01 BY RQCRETIME DESCENDING.

READ TABLE IT_TSP01 INDEX 1.

SPOOLID = IT_TSP01-RQIDENT.

PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.

ENDIF.

ENDIF.

The SELECT part is wrong, I need to replace this code to get the correct spool numbers.

Thanks in advance.

Sandeep

Former Member
0 Kudos

Hi,

Smartfrom Fm has one more structure under the IMPORTING parameters i.e. JOB_OUTPUT_INFO

Which you have not used in your FM. Use that you can get the spool number returened in the JOB_OUTPUT_INFO structure.

Former Member
0 Kudos

Hi Avinash,

Thank you for your reply.

I will try right away and get back to you.

Thanks!

Sandeep

Former Member
0 Kudos

HI try this way..

CALL FUNCTION FM_NAME
EXPORTING
CONTROL_PARAMETERS = CONTROL
OUTPUT_OPTIONS = OUTPUT
USER_SETTINGS = ' '
EKKO = L_DOC-XEKKO
PEKKO = L_DOC-XPEKKO
DRUVO = L_DRUVO
IMPORTING
JOB_OUTPUT_INFO = JOB_OUTPUT_INFO                      " Add this parameter
JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
TABLES
EKPO = L_DOC-XEKPO
PEKPO = L_DOC-XPEKPO
XAEND = IT_XAEND
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.

" You can find the spool request as follows
JOB_OUTPUT_INFO-SPOOLIDS

Former Member
0 Kudos

Hi Avinash,

It solved my problem.

Thanks for your help!

Sandeep

Answers (1)

Answers (1)

Former Member
0 Kudos

hello,

check if is there parameter JOB_OUTPUT_INFO in your function module...

here are spool numbers....

regards,darek

Edited by: dariusz sobczak on Mar 2, 2009 7:15 PM