Skip to Content
0
Former Member
Sep 01, 2006 at 04:36 PM

Modify Database table

58 Views

Hi All

I know my code will not work since Modify doesn,t support where,but my problem is like that..can u suggest how can i get the same result

I ahve to modify the TAble "JEST' there are 3 cases

i have a internal table T_OBJLIST having a single field

objid.

Actually JEST has 4 Fields OBJNR,STAT,INCTV,CHGNR

DATA : E_JEST type JEST .

Loop at T_OBJLIST.

clear e_jest.

MOVE : T_OBJLIST-OBJID TO E_JEST-OBJNR ,

C_E0001 TO E_JEST-STAT ,

SPACE TO E_JEST-INACT .

CASE1-MODIFY only INACT if it is X and OBJID in JEST & STATUS is E0001 do,nt change CCHGNR of Jest.

But below query changes CHGNR also.

MODIFY JEST FROM E_JEST WHERE OBJNR EQ T_OBJLIST-OBJID

AND STAT EQ E0001

AND INACT EQ C_X .

IF SY-SUBRC EQ 0.

COMMIT WORK.

ELSE.

ROLLBACK WORK..

ENDIF.

Case2-Modify only when Objid is Same but STSUS is not E0001

MODIFY JEST FROM E_JEST WHERE OBJNR eq T_OBJLIST-OBJID

AND STAT NE C_E0001 .

Case 3- Modify when OBJID not found in JEST

MOVE : C_001 TO E_JEST-CHGNR .

MODIFY JEST FROM E_JEST WHERE OBJNR NE E_JEST-OBJNR .

Thanks

SAurabh Tiwari