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

update/modify in table maintenance

Former Member
0 Likes
5,951

Hi,

i have a table maintenance for a Z table. How could i use update/modify statement to update records in this Z table. Among all the columns i have one qty field which is in edit mode. In case of any change in this qty i want to update few other columns which are in non-edit mode. i tried database update in event 01 but its not working. could anybody please suggest how could i achieve this.

Rgds

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,396

Usually Event 21 is called for hidden fields (e.g. last change date, etc.)

Regards,

Raymond.

13 REPLIES 13
Read only

Former Member
0 Likes
3,396

Hii Test match

you have to write separate code to achieve your result.

first you have to select original qty..

then update / modify that field with new qty.

then again select same data which contain new qty field

and update fields u want to change accordance with new qty by using update, set statements which where clause .

regards

Gaurav

Read only

0 Likes
3,396

Hello Gaurav,

What do you mean by separate code? i want to know where should i write update or modify statement to update a non-editable field based on user input. pls advise

rgds

Read only

ashraf_usmani
Participant
0 Likes
3,396

Hi Gaurav,

Create table maintenance view for your Z Table in SE11

Then Go  Mentainence Genrator for your mentanece view in TCode SE14

the you will be able toedit your Z tables data through maintenance view.

Regards

Ashraf Usmani

Read only

0 Likes
3,396

hello Ashraf,

i want to update fields at run time. so user is making some changes in one field in SM30. when save, other field(s) should also change n background.

rgds

Read only

0 Likes
3,396

hii test match

if you already have table maintenance generator you can use tcode sm30

but der you wont be able to change non editable fields

so to change those fields along with qty you have to write separate coding i mean zprogram

Regards

Gaurav

Read only

0 Likes
3,396

Hi

As per my understanding PFB codes:

Select ZTABLE into ITAB

Loop At ITAB

"Modify ITAB according to req.."

ENDLOOP.

UPDATE ZTABLE FROM TABLE ITAB.

OR

   UPDATE ZTABLE SET NAME = ITAB-NAME

          EMP_NAME = ITAB-EMP_NAME

          EMP_DOB = ITAB-EMP_DOB

          EMP_NO = ITAB-EMP_NO

           WHERE NAME = ITAB-NAME AND

           EMP_NAME = ITAB-EMP_NAME.

      ENDIF.

OR


TYPES: BEGIN OF t_ekpo,

             ebeln TYPE ekpo-ebeln,

             ebelp TYPE ekpo-ebelp,

             statu TYPE ekpo-statu,

             aedat TYPE ekpo-aedat,

             matnr TYPE ekpo-matnr,

             menge TYPE ekpo-menge,

             meins TYPE ekpo-meins,

             netpr TYPE ekpo-netpr,

             peinh TYPE ekpo-peinh,

             END OF t_ekpo.

  DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,

            wa_ekpo TYPE t_ekpo.

START-OF-SELECTION.

select ebeln ebelp statu aedat matnr menge meins netpr peinh up to 10 rows from ekpo

into table it_ekpo

where ebeln = P_ebeln.

END-OF-SELECTION. 

loop at it_ekpo into wa_ekpo.

wa_ekpo-netpr = '100'.

MODIFY it_ekpo INDEX sy-tabix FROM wa_ekpo TRANSPORTING netpr.

endloop.

Regards

Ashraf Usmani

Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,397

Usually Event 21 is called for hidden fields (e.g. last change date, etc.)

Regards,

Raymond.

Read only

0 Likes
3,396

hello Raymond,

i don't have any hidden field. i have 3 quantity fields. these are: available qty, consumed qty & remaining qty. only consumed qty field is in edit mode. now when user change consumed qty in any row corresponding remaining qty field should update automatically by a simple formula i.e., available qty - consumed qty.

my problem is that where should i write this formula. is there any event or any other way to achieve this.

Rgds

Read only

0 Likes
3,396

Try Event 21, this event is able to change hidden fields, it should be able to update read-only fields.

(No sample available, just update the structure of the view, which is available)

Regards,

Raymond

Read only

0 Likes
3,396

we have <vim_total_struc> available. hope changing values in this structure will help me. please let me know if you have any idea about this structure.

rgds

Read only

0 Likes
3,396

This has come up a number of times before in SCN. If you search, I'm sure you will find some answers. (But I've used event 01 - when saving).

Rob

Read only

0 Likes
3,396
Read only

0 Likes
3,396

Thanks Rob. when i tried what you mentioned it was giving me some unicode conversion error. i found below link too useful.

Thanks for your time!

Rgds