‎2006 Nov 29 2:10 PM
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
‎2006 Nov 29 2:22 PM
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.
Regards,
Ravi
Note- Please mark all the helpful answers
‎2006 Nov 29 2:20 PM
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
‎2006 Nov 29 2:25 PM
Reddy,
thank u, i dont know much abt module pool.
i will try with your suggested code.
thanks .
sreedhar
‎2006 Nov 29 2:22 PM
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.
Regards,
Ravi
Note- Please mark all the helpful answers
‎2006 Nov 29 2:27 PM
ravi,
thank u very much.
i will do accordingly.
thank once again.
sreedhar
‎2006 Nov 29 2:31 PM
Sridhar,
Please mark the helpful answers and close the thread by marking "Problem Solved" against the thread which helped you the most.
Regards,
Ravi
‎2006 Dec 05 11:11 AM
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.
‎2006 Nov 29 2:27 PM
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.
.