cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform for purchase order

Former Member
0 Kudos

Hi All,

I have a Smartform to print all the POs created and changed via ME21n. The print program is RSNAST00.

For each of the Purchase orders, a separate spool is created. Meaning, if 2 POs are changed, then there are 2 spools that are created; one for each.

However, When I create one PO and change another PO, only one spool is getting created (but we want 2 separate spools). We want one spool for the New PO and another spool for the changed PO.

Here is the code i have right now. Please let me know how i can go about achieving this.

ITCPO-TDCOVER = NAST-TDOCOVER.

ITCPO-TDCOPIES = NAST-ANZAL.

ITCPO-TDDATASET = NAST-DSNAM.

ITCPO-TDSUFFIX1 = NAST-DSUF1.

ITCPO-TDSUFFIX2 = NAST-DSUF2.

ITCPO-TDIMMED = NAST-DIMME.

ITCPO-TDDELETE = NAST-DELET.

ITCPO-TDSENDDATE = NAST-VSDAT.

ITCPO-TDSENDTIME = NAST-VSURA.

ITCPO-TDPROGRAM = SY-REPID.

ITCPO-TDDEST = NAST-LDEST.

ITCPO-TDNEWID = 'X'.

ITCPO-TDNOPRINT = 'X'.

ITCPO-TDPREVIEW = 'X'.

IF L_DOC-XEKKO-FRGKE NE 'C'.

  • ITCPO-TDNOPRINT = 'X'.

OUTPUT-TDNOPRINT = 'X'.

OUTPUT-TDNEWID = 'X'.

OUTPUT-TDDEST = ITCPO-TDDEST.

ENDIF.

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

JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

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.

Thanks!

Sandeep

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Your friend shout be SSFCOMPOP-TDNEWID. "New Spool YES /NO"

Or in your context OUTPUT-TDNEWID.

...

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

...

But it should be also customizable. But I don't know where sorry.

Former Member
0 Kudos

Hi,

I already set that to 'X' but it still does not give me the desired results.

Thanks!

Sandeep

Former Member
0 Kudos

Sorry. I don't noticed it.

When you have created the new message and before you change it again, is the message marked green (me22n --> goto --> header --> messages).

If the message isn't processed (nothing to do with the spooloutput) it will not work prober.

I've it's not so, set the ouput options in nace (don't forget the detail area in messages) and mn22 (i think, mn22, i've no system now) to "direct ouput" only for testing.