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: 

Modify Database table

Former Member
0 Kudos

Hi all

i have a int .table(T_ZVXX) that has a status field .

my code is

select *

from ZVXX (ZVXX has matnr,inv.no. is key field)

into t_zvxx

where status is null.

now i have certain proceesing after thati m doing like that

concatenate 'Screen'

T_ZVXX-matnr

'Business Area'

'100'

T_ZVXX-maktx

into T_OUTPUT-line.

Append t_output

clear t_output

concatenate 'Message'

T_ZVXX-vbeln

sy-datum

'500'

T_ZVXX-matnr

into T_OUTPUT-line.

Download T_OUTPUT to a unix file.

***Main problem is i have to update a table(set the Staus to X initialy it was null )for the records which is downloaded successfully.

How can modify the Data base table ZVXX for the successfully downloaded record.

since it is concatenation i can not detect the key fields bcoz i have different conditions for concatenate(i.e sequence of Concatenate changes always)

Thanks

Saurabh Tiwari

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello Saurabh

If I understand correctly you get for certain entries in T_ZVXX a corresponding concatenated entry in T_OUTPUT.

To solve your problem I would define a third itab like that:

DATA:
  ld_idx     TYPE sy-tabix,
  lt_index   TYPE TABLE OF sytabix.

Every time that you process an entry of T_ZVXX you write its index into this itab:

LOOP AT t_zvxx INTO ls_zvxx.
  ld_idx = syst-tabix.

  IF ( <condition is true> ).
*   do concatenation into t_output
    APPEND ld_idx TO lt_index.  " collect indices
  ELSE.
    continue.
  ENDIF.

ENDLOOP.

Finally, loop over your index itab and modify the status of the corresponding entry in t_zvxx, then DB update.

Regards

Uwe

0 Kudos

hi,

use :

update ZVXX  
       set status = 'X'
       where Status = space
        and
          ...

A.

Message was edited by: Andreas Mann

former_member184495
Active Contributor
0 Kudos

hi,

after you give statement to modify your table,

give 'Commit work' statement.

cheers,

Aditya.