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: 

assignment of a particular field

Former Member
0 Kudos
84

i have a requirement of having one of the field in the internal table to be assigned to another .the internal table has already data in it . when the stage is y040 and saprefno is blank then whatever the content is in networkid must be placed in saprefno.but the problem is that when i am using append or collect the i am getting a new record but it is not updating the old record .

LOOP AT itab_input1 into wa_input1 .

IF wa_input1-saprefno EQ ' ' and wa_input1-stage EQ 'Y040'.

wa_input1-saprefno = wa_input1-networkid.

append wa_input1 TO itab_input1.

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
66

Hi,

Use MODIFY instead of APPEND or COLLECT. Check the below code...

LOOP AT itab_input1 into wa_input1 .

IF wa_input1-saprefno EQ ' ' and wa_input1-stage EQ 'Y040'.

wa_input1-saprefno = wa_input1-networkid.

MODIFY itab_input1 FROM wa_input1 TRANSPORTING saprefno.

ENDIF.

ENDLOOP.

Rgds,

Bujji

Edited by: Bujji on Jun 26, 2008 9:28 AM

3 REPLIES 3

Former Member
0 Kudos
67

Hi,

Use MODIFY instead of APPEND or COLLECT. Check the below code...

LOOP AT itab_input1 into wa_input1 .

IF wa_input1-saprefno EQ ' ' and wa_input1-stage EQ 'Y040'.

wa_input1-saprefno = wa_input1-networkid.

MODIFY itab_input1 FROM wa_input1 TRANSPORTING saprefno.

ENDIF.

ENDLOOP.

Rgds,

Bujji

Edited by: Bujji on Jun 26, 2008 9:28 AM

GauthamV
Active Contributor
0 Kudos
66

hi,

instead of append use modify statement.

check these.

- MODIFY itab FROM wa INDEX idx ASSIGNING <fs> REFERENCE INTO dref TRANSPORTING f1 ... fn.

- MODIFY TABLE itab FROM wa ASSIGNING <fs> REFERENCE INTO dref TRANSPORTING f1 ... fn.

- MODIFY itab FROM wa TRANSPORTING f1 ... fn WHERE cond.

Former Member
0 Kudos
66

Hai,

Use the clauses Appending table itab... or appending lines of... or appending corresponding fields of ....