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: 

Changing the Subject of the e-mail

Former Member
0 Kudos

Hello All,

I have checked the forum well before posting this query. But none could satisfy my query. So posting a new thread.

We are using a customised output type 'YZZA' for external deliveries. The output medium is set to 5 - External send. We are getting the email. The only requirement of the client now is to have the subject modified to contain 1. Sold-to-party Name 2. Country of the sold-to-party (This data will obviously come from KNA1).

I know we can maintain the mail title in 'Mail title and text'. But I wish to have the above said two fields as well in the subject.

Please bail me out guys!

Regards,

Shaheen

1 ACCEPTED SOLUTION

atul_mohanty
Active Contributor

Hello,

If you are using custom routines in NACE for external send, you can try modifying the value of field nast-tdcovtitle with your requirement in custom routine, it should change the Subject of Email.

Let me know, if it helps you. Thanks

Edited by: Atul Mohanty on Jun 10, 2011 9:16 PM

Edited by: Atul Mohanty on Jun 11, 2011 2:54 PM

14 REPLIES 14

Former Member
0 Kudos

You can use the parameters in the Title and In the Nace for the Output type - Maintain the General data - Program & Form routine ( Replacement of text symbols ).

0 Kudos

Hello Suman,

I feel I am almost there but still not able to see it. Can you please elaborate a little. You might give the steps which I need to do once I am in NACE.

Thanks in Advance,

Shaheen

0 Kudos

Hello Suman,

I have got the path now. I am in General data tab. I see under Replacement of Text Symbol both Program and FORM routine are blank. How I can handle the situation from here on? I need to get the subject of the mail being sent in a particular format, which involves values to be fetched from KNA1.

Hope you are getting my point. Please ask me more details, if needed.

Thanks again,

Shaheen

0 Kudos

In the Mail title & texts - Title place parameters for dynamic values like &VBPA-KUNNR& along with tile and for the program and form routine, refer to Program "SAPMM06E", Form routine "TEXT_SYMBOL_REPLACE". Check for similar routine pertaining to your output type application area or use your own inline with the standard.

0 Kudos

Thanks again Suman. Your solution completely fits, but there is just one more problem. My VBPA has 7 entries in all. I want to get the customer no. based on my Delivery no. (VBELN) and also for the Part.funct. (VBPA-PARVW, here 'SH' ) ship-to-party. How can I make sure that it picks the correct KUNNR.

And please also note, after getting this KUNNR, I have to get NAME and LAND1 from KNA1, and I have to populate these values in thesubject of the mail.

0 Kudos

Implement the form routine similar to the one i mentioned earlier, there you can write you own code to populate all the parameters ( ex &VBPA-KUNNR&) refered in the Title before calling the FM "TEXT_SYMBOL_REPLACE". The FM does the replacement.

0 Kudos

Hello Suman,

This solution sounds great...I will try it and will revert back if I have doubts.

Thanks a lot again,

Shaheen

0 Kudos

Hi Suman and all,

I am giving the two function module. Which parameter I need to change in order to change the title of the mail.

Thanks in advane,

Shaheen

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = XTHEAD-TDID

LANGUAGE = XTHEAD-TDSPRAS

NAME = XTHEAD-TDNAME

OBJECT = XTHEAD-TDOBJECT

  • IMPORTING

  • HEADER =

TABLES

LINES = XTLINES

CALL FUNCTION 'TEXT_SYMBOL_REPLACE'

EXPORTING

ENDLINE = SY-TABIX

HEADER = XTHEAD

PROGRAM = CURRENTPROGRAM

IMPORTING

CHANGED = CHANGED

  • NEWHEADER =

TABLES

LINES = XTLINES.

0 Kudos

The parameters referred in the Title ( "Partner number &WA_VBPA-KUNNR&" ) must be global ( Declare WA_VBPA in the global data ) in the program and must be populated with a value within the Form routine.

Please refer to the below thread which has detailed explanation about the Form routine implmentation.

atul_mohanty
Active Contributor

Hello,

If you are using custom routines in NACE for external send, you can try modifying the value of field nast-tdcovtitle with your requirement in custom routine, it should change the Subject of Email.

Let me know, if it helps you. Thanks

Edited by: Atul Mohanty on Jun 10, 2011 9:16 PM

Edited by: Atul Mohanty on Jun 11, 2011 2:54 PM

0 Kudos

Hello Suman and Atul,

Thanks for your replies till now. Atul, I found out in my case the field TDTITLE was getting poulated with the subject of the mail. I concatenated country code and name of the customer to it. All's fine till now. But now the problem is the length of this field is only 50 chars. My client wants this length to be 255 chars.

Following are the pieces of code from my developement. I want to know how I can change the length of the field LVS_ITCPO-TDTITLE, without hampering the FM 'OPEN_FORM'.

Looking forward to your replies again.

Regards,

Shaheen

CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'

EXPORTING

PI_COMM_TYPE = LVS_COMM_TYPE

PI_COMM_VALUES = LVS_COMM_VALUES

PI_SCREEN = US_SCREEN

  • PI_NEWID =

PI_COUNTRY = US_COUNTRY

PI_REPID = LVF_PROGRAM

PI_SNAST = LVS_SNAST

IMPORTING

PE_ITCPO = LVS_ITCPO

PE_DEVICE = LVF_DEVICE

PE_MAIL_RECIPIENT = LVS_RECIPIENT

PE_MAIL_SENDER = LVS_SENDER

-


concatenate LVS_ITCPO-TDTITLE KNA1-LAND1 KNA1-NAME1 into LVS_ITCPO-TDTITLE

separated by '_'.

-


CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

ARCHIVE_INDEX = TOA_DARA

ARCHIVE_PARAMS = ARC_PARAMS

DEVICE = LVF_DEVICE

DIALOG = ' '

FORM = TNAPR-FONAM

LANGUAGE = NAST-SPRAS

OPTIONS = LVS_ITCPO

MAIL_SENDER = LVS_SENDER

MAIL_RECIPIENT = LVS_RECIPIENT

0 Kudos

Shaheen, Please refer to the [SAP Note 958426.|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_srv/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d393538343236%7d]

0 Kudos

Hi,

You can not change the length of LVS_ITCPO-TDTITLE.

Just, check the program SCR_MAIL_EX1 where it says the subject line of the mail can be 255,

0 Kudos

Thanks a lot, Suman and Atul. The problem is solved.