Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get Spool ID after PO release. (To send PDF for ext E-mail)

Former Member
0 Kudos
298

Hi Experts,

I am new to Email sending from SAP.

I am facing a big problem from many days. I am in a new support project.

I have a issue that when ever a PO is released from ME23N or ME28 it should send a mail to vendor.

This is working fine in Development including delivery report or failed report back to approver...

I dont know where is PRD and who is doing that,

But my support manager says that only some PO's are sent to vendors not all...

everytime they approve only some emails sent to vendors...!

But every PO is same and for same vendor's...

Even failure & delivery messages are missing for (sent failed email's)

But after all I observed only one thing that we have a select statement....

DATA: GS_RESULT TYPE ITCPP.

DATA : L_DATE(9).

DATA : BEGIN OF LT_TSP01 OCCURS 0,

RQIDENT LIKE TSP01-RQIDENT,

RQCRETIME LIKE TSP01-RQCRETIME,

DATE(8),

TIME(8) TYPE N,

END OF LT_TSP01.

SELECT RQIDENT RQCRETIME FROM TSP01 INTO CORRESPONDING FIELDS OF

TABLE LT_TSP01 WHERE RQCRETIME LIKE L_DATE

AND RQIDENT EQ GS_RESULT-TDSPOOLID.

IF SY-SUBRC = 0.

-


(All Email sending code)(including delivery & failure delivery)

Endif.

So I suspect it is not picking up the Spool request from this Table TSP01 or may be not updated to this table.

I have searched in SCN, I have seen may E-mail Codings

But every one says to get Spool- ID & Convert to PDF,,,

My Question is How to get Spool ID correctly and tell me how it is updated. when a PO released by ME23N or ME28.

please any one clear my doubt as I am completely helpless here.

Thanks in advance,

Dunlop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
104

Hi,

Is it a SMart form.....

If it is a smartform, then Smartfom interface itself has a spool id parameter....

you can directly het that from this parameter...

CALL FUNCTION "FMa Name'

EXPORTING

control_parameters = wsl_control

output_options = wsl_outpt

user_settings = ''

wtg_itemdetails = tl_itemdet

wtg_vttp = l_vttp

IMPORTING

job_output_info = sl_spooldet

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

The inporting parameter sl_spolldet will have the Spool id.

and you fetch by, using the below mentioned way..........

READ TABLE wsl_spooldet-spoolids INTO wsl_wa_spool INDEX 1.

IF sy-subrc = 0.

Convert it into PDF using 'CONVERT_OTFSPOOLJOB_2_PDF'

then attach it and send a mail.....with all properties set such as Delivery report....

endif.

If you have any issues, please let me know........

Thanks & Regards,

Vamsi

7 REPLIES 7

Former Member
0 Kudos
104

Hi Dunlop,

Try to retrieve with this.

SELECT RQIDENT RQCRETIME FROM TSP01 INTO CORRESPONDING FIELDS OF

TABLE LT_TSP01 WHERE RQOWNER = SY-UNAME AND

RQCRETIME LIKE L_DATE.

" RQ2NAME = 'PURCHASE ORD'.

Thanks & regards,

Dileep .C

Former Member
0 Kudos
105

Hi,

Is it a SMart form.....

If it is a smartform, then Smartfom interface itself has a spool id parameter....

you can directly het that from this parameter...

CALL FUNCTION "FMa Name'

EXPORTING

control_parameters = wsl_control

output_options = wsl_outpt

user_settings = ''

wtg_itemdetails = tl_itemdet

wtg_vttp = l_vttp

IMPORTING

job_output_info = sl_spooldet

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

The inporting parameter sl_spolldet will have the Spool id.

and you fetch by, using the below mentioned way..........

READ TABLE wsl_spooldet-spoolids INTO wsl_wa_spool INDEX 1.

IF sy-subrc = 0.

Convert it into PDF using 'CONVERT_OTFSPOOLJOB_2_PDF'

then attach it and send a mail.....with all properties set such as Delivery report....

endif.

If you have any issues, please let me know........

Thanks & Regards,

Vamsi

0 Kudos
104

Hi Vamsi,

Thanks For your reply But we are using a SAP Script.

Hi Dilep,

Its already commented in our code. But I need the procedure how Spool Id is updated in table after

PO release, since its working fine development.

Thanks,

Dunlop.

0 Kudos
104

Are yu using any check conditions in your program.

if so check the conditions, as it might be same in dev and may be changing in PRD.

Thanks,

Dileep .C

0 Kudos
104

Hi Experts,

Is there anyone to help me out,

Hi Dileep,

yes we are using check statements but one for SY-TCODE & another for werks,

They both are working fine.

Thanks,

Dunlop.

0 Kudos
104

Hi Dunlop,

Do like this, Check with th user how he is releasing the PO's.

all at a time or 1 by one,,,

If all at a time, I think you should have a commit work before your above querry,

you can see the PO release strategy in Sap Techinical Tutorials,,,

Thanks & Regards,

Dileep .C

0 Kudos
104

Hi dilep,

Thanks, commit work (wait upto 5 seconds) these were the solutions.