Application Development and Automation 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: 
Read only

Z table

Former Member
0 Likes
967

Hi,

I had created a z table with fields order type, allowable values, changed by(sy-user) and sy-datum.

In new entries user wants to enter only 2 fields order type and allowable values, and remaining 2 fields sy-user and date should pickup when press save button.

all 4 fileds data should be there in table.

Could any one suggust me regarding this problem

regards,

sridhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
932

Sridhar,

You can generate table maintenance and use the events of table maint. to write the code to populate those fields.

See the document that will illustrate the same.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Regards,

Ravi

Note- Please mark all the helpful answers

7 REPLIES 7
Read only

Former Member
0 Likes
932

Hi sridhar.

In PAI Module, add the following piece of code.

Case SY-comm.
when 'SAVE'.
   Z_TABLE-CHANGED_BY = Sy-uname.
   Z_TABLE-CHANGED ON = Sy-datum.
   insert  ZTABLE  from Z_TABLE.
   IF sy-subrc NE 0.
      Message 'Error while saving the data'  TYPE 'E'.
   ENDIF.
when '...'.
.......................
.......................
endcase.

Regards

Bhupal Reddy

Read only

0 Likes
932

Reddy,

thank u, i dont know much abt module pool.

i will try with your suggested code.

thanks .

sreedhar

Read only

Former Member
0 Likes
933

Sridhar,

You can generate table maintenance and use the events of table maint. to write the code to populate those fields.

See the document that will illustrate the same.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Regards,

Ravi

Note- Please mark all the helpful answers

Read only

0 Likes
932

ravi,

thank u very much.

i will do accordingly.

thank once again.

sreedhar

Read only

0 Likes
932

Sridhar,

Please mark the helpful answers and close the thread by marking "Problem Solved" against the thread which helped you the most.

Regards,

Ravi

Read only

0 Likes
932

Hi Ravi,

Very Very thank u.

I am new to this SDN. So i cold not able to mark 10. Today i made it.

Document which given by you is really very good.

Thank u very much.

Sreedhar.

Read only

Former Member
0 Likes
932

Hi Sridhar,

If you are inserting values through SM30 then you need to change the standard program ( provided you need to have an access key).

What I can suggest you is create a form with all your fields using module pool and assign a transaction for it and give it to your users.

In PAI module check is the user has entered any value for the changed by(sy-user) and sy-datum fields and then update the table.

Code:

Case SY-comm.

when 'SAVE'.

check Z_TABLE-CHANGED_BY eq ' '.

check Z_TABLE-CHANGED_ON eq ' '.

Z_TABLE-CHANGED_BY = Sy-uname.

Z_TABLE-CHANGED ON = Sy-datum.

insert ZTABLE from Z_TABLE.

IF sy-subrc NE 0.

Message 'Error while saving the data' TYPE 'E'.

ENDIF.

.