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 insert internal table values into ztable

former_member226520
Participant
0 Kudos

Dear Friends ,

My purpose is to insert the values of internal table into ztable , If ztable does not have any value then insert first time

and vise versa then update the recods of ztable ,

Here I have to insert the values of it_final_age this internal table into ZOUTSTANDING , In debugging mode

ZOUTSTANDING-KUNNR=  IT_FINAL_AGE-KUNNR.

i am getting the values in IT_FINAL_AGE-KUNNR but ZOUTSTANDING-KUNNR this is blank .

code is here .

DATA: BEGIN OF it_final_age OCCURS 0,

      KUNNR LIKE KNVP-KUNNR,

      CURRBAL LIKE  bsid-dmbtr,

      CRDR(6),

      END OF it_final_age.

SELECT * FROM ZDATA INTO CORRESPONDING FIELDS OF TABLE it_final_age .

DATA : IT_OUT TYPE ZOUTSTANDING OCCURS 0 WITH HEADER LINE.

SELECT * FROM ZOUTSTANDING INTO CORRESPONDING FIELDS OF TABLE IT_OUT .

if IT_OUT[] is initial.

LOOP AT IT_FINAL_AGE  .

ZOUTSTANDING-KUNNR    =  IT_FINAL_AGE-KUNNR.

ZOUTSTANDING-CURRBAL  = IT_FINAL_AGE-CURRBAL.

ZOUTSTANDING-CRDR     = IT_FINAL_AGE-CRDR.

  

INSERT ZOUTSTANDING .

ENDLOOP.

ELSE.

LOOP AT IT_FINAL_AGE.

UPDATE ZOUTSTANDING set

CURRBAL = IT_FINAL_AGE-CURRBAL

CRDR =    IT_FINAL_AGE-CRDR

WHERE KUNNR EQ IT_FINAL_AGE-KUNNR.

ENDLOOP.

ENDIF.

Where is my mistake Pls help me.

Moderator Message: Basic question. Thread locked.

Message was edited by: Suhas Saha

2 REPLIES 2

former_member222709
Contributor
0 Kudos

Hi,

Please use F1 help on MODIFY statement in the ABAP Editor.

Former Member
0 Kudos

hi,

use

MODIFY  ztable(database table)  from table LIT_FINAL(internal).

Thanks.