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: 

HOW TO UPDATE DATABASE TABLE ENTRIES in PARTICULAR FIELDS

Former Member
0 Kudos

hi everybody,

Table PLAF fields are plnum and AUFFX.

in plaf table plnum is the planned order number and AUFFX is the firming Indicator ( X or SPace).

first i am selecting the plnum from table plaf with AUFFX = 'X' and displaying in table control.

upto here working fine.

if user selects particular plnum and press close button on screen i need to set AUFFX = SPACE.

and this should be update to PLAF table.

through programming can i update database table? if its possible how to do?

6 REPLIES 6

Former Member
0 Kudos

Hi,

First you try to findout any FM will do the update or not.

if you are not get any FM, then check the it if any tables are depending on this table or not using the button 'Graphic' in the toolbar.

if it is ok then you will do the update in the standard table using the UPDATE statement.

Reference for update statement.

[http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3a94358411d1829f0000e829fbfe/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3a94358411d1829f0000e829fbfe/frameset.htm]

Regards,

SB

Former Member
0 Kudos

Hi,

Try this.

data: g_ok_code TYPE sy-ucomm.

If g_ok_code  = 'CLOSE'.
UPDATE PLAF
SET AUFFX = ' '
WHERE  plnum = p_plnum
                       .....
        IF sy-subrc EQ 0.
          COMMIT WORK.
          l_error = 'X1'.
        ELSE.
          l_error = 'X2'.
          CLEAR l_error.
          ROLLBACK WORK.
        ENDIF.
endif.

hope this helps you.

plz reward if useful.

thanks,

dhanashri.

Edited by: Dhanashri Pawar on Jun 26, 2008 7:45 AM

Edited by: Dhanashri Pawar on Jun 26, 2008 7:45 AM

kiran_k8
Active Contributor
0 Kudos

Hi,

Check this program,it updates the check box for GRIV

REPORT ZMM .

tables : EKPO.

DATA: BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE EKPO.

data:end of itab.

selection-screen : begin of block blk1 with frame title text-001.

parameters : p_BSART like EKkO-BSART.

*Indicator: GR-based invoice verification

selection-screen : begin of line.

parameters : r_grivc radiobutton group rbg1.

selection-screen : comment 5(40) text-004.

selection-screen : end of line.

selection-screen : begin of line.

parameters : r_grivn radiobutton group rbg1.

selection-screen : comment 5(44) text-005.

selection-screen : end of line.

selection-screen : end of block blk1.

start-of-selection.

*Update the value as X for Indicator: GR-based invoice verification

*WEBRE".

if r_grivc = 'X'.

select A~ebeln

b~EBELP

b~WEBRE

from ekko as a

inner join ekpo as b

on aebeln = bebeln

into corresponding fields of table ITAB

where

a~BSART = p_BSART.

sort itab.

LOOP AT ITAB.

update EKPO set WEBRE = 'X'

where EBELN = itab-EBELN

and EBELP = itab-EBELP.

endloop.

endif.

if r_grivn = 'X'.

select A~ebeln

b~EBELP

b~WEBRE

from ekko as a

inner join ekpo as b

on aebeln = bebeln

into corresponding fields of table ITAB

where

a~BSART = p_BSART.

sort itab.

LOOP AT ITAB.

update EKPO set WEBRE = ' '

where EBELN = itab-EBELN

and EBELP = itab-EBELP.

endloop.

endif.

K.Kiran.

naveen_inuganti2
Active Contributor
0 Kudos

Hi....

You can update database table.....

*select * from PLAF into table itab.*

LOOP AT itab where AUFFX = 'X' .

itab-AUFFX = ' ' .

MODIFY plaf FROM itab.

endif.

ENDLOOP.

with this code at....

OK_code = "CLOSE'

you can update databasse table...

and extend the code if you want to met any perticuler conditions, because you are used SELKZ field to select the rows..... also care at Clear itab...

Let me know if u want any futher clarification..

Thanks,

Naveen Inuganti.

Edited by: Naveen Inuganti on Jun 26, 2008 11:20 AM

Former Member
0 Kudos

You can use the event At Line-Selection

There just Read the data from your database table into the WorkArea(WA). and change the WA value of AUFFX to space.

and Modify the table content using the modify command.

Regards,

Vijaya Sankar

Former Member
0 Kudos

problem solved by own

thaks for ur replies