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: 

Getting the original values in table maintenance and the new one and send t

aris_hidalgo
Contributor
0 Kudos

Hello experts,

In table maintenance, I need to capture the original values in that selected column/field and

also the new one and send it to email. For example, I have a field in my z table named zaddress and whenever

the user changes the contents of that selected row I need to get/fecth the original value and the new and send it to email.

So the email will be something like this:

Dear Admin,

Changes were made to ztable. Here are the changes:

Customer : Customer 1

Order no : 1

Original Address : example address A

New Address : example address B

NOTE: Do not reply to this email.

Again, thank you guys and have a nice day!

2 REPLIES 2

Former Member
0 Kudos

Hi,

With so many customization my suggestion would be to build your own table maintenance using a Editable ALV Grid. The reason being, if some regenerates the table maintenance all your code will be gone.

Regards

Ravi

venkat_o
Active Contributor
0 Kudos

Hi Vijay,

<b>1</b>.

If u r using Modulepool programming to change the field contents ,u just capture field value into one variable .This is possible in <b>PBO</b>.before displaying .once u change the field value and press something ,now capture changed value in another variable .This is possible in <b>PAI</b>.After pressing something to modify Database.

I think u can get one idea after reading this .

<b>2</b>.

For sending mail it is not a problem.

You can check the following code.

*-------Mail related tables ,structures and variables

DATA:

w_subject LIKE sodocchgi1,

i_pack_list LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,

i_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,

i_contents_text LIKE solisti1 OCCURS 10 WITH HEADER LINE,

i_cont_bin LIKE solisti1 OCCURS 10 WITH HEADER LINE,

i_objhex LIKE solix OCCURS 10 WITH HEADER LINE,

i_receiver LIKE somlreci1 OCCURS 1 WITH HEADER LINE,

i_listobject LIKE abaplist OCCURS 1 WITH HEADER LINE,

pdf LIKE tline OCCURS 100 WITH HEADER LINE,

content_out LIKE solisti1 OCCURS 0 WITH HEADER LINE.

DATA:

tab_lines TYPE i,

doc_size TYPE i,

att_type LIKE soodk-objtp,

obj_desc LIKE w_subject-obj_descr,

sent_to_all LIKE sonv-flag,

client LIKE tst01-dclient,

name LIKE tst01-dname,

objtype LIKE rststype-type,

type LIKE rststype-type,

is_otf TYPE c ,

no_of_bytes TYPE i,

pdf_spoolid LIKE tsp01-rqident,

jobname LIKE tbtcjob-jobname,

jobcount LIKE tbtcjob-jobcount,

pn_begda LIKE sy-datum,

val(1) TYPE c,

pripar TYPE pri_params,

arcpar TYPE arc_params,

lay TYPE pri_params-paart,

lines TYPE pri_params-linct,

cols TYPE pri_params-linsz,

spool_name TYPE pri_params-plist.

CLEAR :w_subject,

sent_to_all,

i_pack_list[],

i_objhead[],

i_cont_bin[],

i_contents_text[],

i_receiver[].

i_cont_bin = ' | '.

APPEND i_cont_bin.

*----


Subject of the mail.

obj_desc = 'Outstanding Appraisals' .

w_subject-obj_name = 'MAIL_ALI'.

w_subject-obj_descr = obj_desc.

*----


Body of the mail

DATA :head_desc LIKE i_contents_text,

body_desc LIKE i_contents_text.

i_contents_text = space.

APPEND i_contents_text.

CLEAR i_contents_text.

CONCATENATE

'Please refer to the attached list of appraisal(s) that require your'

'attention. Please log in to the eHR System and use the eAppraisal'

'function to work on it.'

INTO body_desc

SEPARATED BY space.

i_contents_text = body_desc.

APPEND i_contents_text.

CLEAR i_contents_text.

CLEAR body_desc.

i_contents_text = 'Thank You.'.

APPEND i_contents_text.

CLEAR i_contents_text.

i_contents_text = space.

APPEND i_contents_text.

CLEAR i_contents_text.

CONCATENATE '(Note: This is system generated message, please'

'do not reply'

'to this Email.)'

INTO i_contents_text

SEPARATED BY space.

APPEND i_contents_text.

CLEAR i_contents_text.

*----


Write Packing List (Body)

DESCRIBE TABLE i_contents_text LINES tab_lines.

READ TABLE i_contents_text INDEX tab_lines.

w_subject-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(

i_contents_text ).

CLEAR i_pack_list-transf_bin.

i_pack_list-head_start = 1.

i_pack_list-head_num = 0.

i_pack_list-body_start = 1.

i_pack_list-body_num = tab_lines.

i_pack_list-doc_type = 'RAW'.

APPEND i_pack_list.

CLEAR i_pack_list.

*----


Create receiver list

i_receiver-receiver = g_email_next_man.

i_receiver-rec_type = 'U'.

APPEND i_receiver.

CLEAR i_receiver.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_subject

put_in_outbox = 'X'

commit_work = 'X'

IMPORTING

sent_to_all = sent_to_all

TABLES

packing_list = i_pack_list

object_header = i_objhead

contents_bin = i_cont_bin

contents_txt = i_contents_text

receivers = i_receiver

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

IF sy-subrc NE 0.

ENDIF.

I think it helps u something.

<b>Thanks,

Venkat.O</b>