2010 Jul 12 3:15 PM
Hi,
I have created a standard text in SO10
This text contains the body of an email message that i will be system generated when employee data changes
E.g.,
here has been an organizational re-assignment performed for Employee No.&P0001-PERNR&
Now i want to include some more information after comparing it with the HRP tables
E.g.,
I want to take P0001-PLANS (position id) and use it to filter certain data from HRP1000 and then print it in the body of the email.
Can this be done in SO10?
thanks
2010 Jul 12 3:45 PM
I am not sure if it is possible, but there is an alternative which will work.
Use perform in SAPScrpit
PERFORM get_so10 IN PROGRAM yread_sol10 CHANGING &text1&
CHANGING &text2&.
FORM get_so10 TABLES lt_in STRUCTURE itcsy
lt_out STRUCTURE itcsy.
CALL FUNCTION 'READ_TEXT' 'Call the Object related to SO10
* modify and export the values to lt_out.
ENDFORM.
I am not sure if it is possible, but there is an alternative which will work.
Use perform in SAPScrpit
PERFORM get_so10 IN PROGRAM yread_sol10 CHANGING &text1&
CHANGING &text2&.
FORM get_so10 TABLES lt_in STRUCTURE itcsy
lt_out STRUCTURE itcsy.
CALL FUNCTION 'READ_TEXT' 'Call the Object related to SO10
* modify and export the values to lt_out.
ENDFORM.
2010 Jul 12 3:45 PM
I am not sure if it is possible, but there is an alternative which will work.
Use perform in SAPScrpit
PERFORM get_so10 IN PROGRAM yread_sol10 CHANGING &text1&
CHANGING &text2&.
FORM get_so10 TABLES lt_in STRUCTURE itcsy
lt_out STRUCTURE itcsy.
CALL FUNCTION 'READ_TEXT' 'Call the Object related to SO10
* modify and export the values to lt_out.
ENDFORM.
2010 Jul 12 3:50 PM
Do you mean when it exports, my required values or text will be available in lt_out in SO10?
thanks
2010 Jul 12 3:56 PM
No, SO10 values will be the same as it was. The values will be available in &TEXT1& and &TEXT2& in your SAPScript.
2010 Jul 12 3:59 PM
So how will i get to use &TEXT1& in the Text Name (MAIL_FOR_I0001_A)
which actually is going to be the body of the email message i am trying to generate?
thanks
2010 Jul 12 4:16 PM
Oops, Sorry. I thought that you wanted to use the values from SO10 inside the SAPScript. IF all you want is to generate the email message based on SO10.
Use the FM "READ_TEXT" to read SO10 values into the internal table
data: lt_tline type standard table of tline,
wa_line like line of lt_tline.
* get the values for LV_ID, lv_langu, lv_OBJECT from SO10, you can get this values from Goto -> header inside SO10.
CALL FUNCTION 'READ_TEXT' "Item Text
EXPORTING
id = lv_id
language = lv_langu
name = lv_text
object = lv_object
TABLES
lines = lt_tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
loop at lt_tline into wa_tline.
* replace relevant values from WA_TLINE with your values.
replace '&P0001-PERNR&' into wa_tline with lv_pernr
* modify lt_tline from wa_tline.
endloop.Now you have the actual values in table LT_TLINE.. do what ever you want to do with it.
2010 Jul 12 4:29 PM
Maybe i am not good at explaining my question and thanks for your patience with that
Actually, i am already generating the email message and receiving the email based on the content in SO10 object.
As of now, i have some simple text in the SO10 object + some commands
The body of the email looks like this:
-
Hello,
This is an automated alert to let you know that employee number &P0001-PERNR& has resigned.
-
Now i want to add some more data into this email body.
E.g.,
-
Hello,
This is an automated alert to let you know that employee number &P0001-PERNR& is reporting to [xxxxxx]
-
where [xxxxxx] will be the position id of the manager which is obtained from the tables HRP1000 & HRP1001.
I know how to get the manager id through a z program. It would take a couple of select statements. But how will i pass it back to the object in SO10 so that i gets printed in the email?
thanks
2010 Jul 12 4:39 PM
Hi,
Have a look at the example [Calling ABAP Subroutines: PERFORM|http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm]
Regards
2010 Jul 12 5:03 PM
Well, it's confusing. Please paste the code where you are generating the email message with the values from SO10 text.
2010 Jul 25 2:12 PM
Hi Ramesh,
Sorry for disappearing
Well, it wouldn't be confusing if you have worked on the HR module and that is why i didn't mention the full scenario before. The email is triggered through a 'dynamic action'. The standard text object (SO10) is called through a feature M0001 (transaction PE03). And the actual text output is all setup in SO10.
I have used some data fields from PA tables in the text object as follows:
Employee no.: &P0001-PERNR&
Position: &P0001-PLANS&
Department: &P0001-ORGEH&
Now what i need to do is some more in-depth coding. E.g., for the following logic:
->Get position id for employee number
->Get position id(mgr) of reports-to (from HRP1001)
->Get employee number(mgr) for position id(mgr)
->Print name of of employee number (mgr)
Can you help with this?
thanks
Zubair
2010 Jul 12 3:56 PM
>
> This text contains the body of an email message that i will be system generated when employee data changes
> here has been an organizational re-assignment performed for Employee No.&P0001-PERNR&
Can you explain where is this long text being called & how is the value of &P0001-PERNR& populated ?
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |