Application Development and Automation 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: 
Read only

internal table selection

Former Member
0 Likes
457

hi experts,

I have a situation regarding internal tables. I have different records with the same order no in a internal table. There is a filed for completion which has possible values X or ' '. The values will be different for this field for the records with the same oredr no. I need to move only those records which does not have 'an X' at all in the completion field for any of the record with the order no. I am not able figure out the logic. Plz help me in this regard,

thanks

3 REPLIES 3
Read only

ci985642
Explorer
0 Likes
433

Hi anirvesh,

Assuming that the original internal table is ITAB1 and the fields are ORDNR, XFELD. Your intention is to get ITAB3 loaded.

The solution could look like -

ITAB2[] = ITAB1[].

SORT ITAB2 BY ORDNR.

DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING ORDNR.

LOOP AT ITAB2.

LORDNR = ITAB2-ORDNR.

LOOP AT ITAB1 WHERE ORDNR = LORDNR AND XFELD = ' '.

ITAB3 = ITAB1.

APPEND ITAB3.

ENDLOOP. " ITAB1.

ENDLOOP. " ITAB2.

More inputs would be helpful to clearly understand your requirements.

Thanks,

Chaps.

Read only

Former Member
0 Likes
433

Hi,

Try this.


* Create another internal table which is the same structure your original internal 
*  table..Let's assume your original internal table is ITAB 
DATA: ITAB_FINAL LIKE TABLE OF ITAB.

* Move the values to the itab_final from itab.
itab_final[] = itab[].

* Delete the records that are not X
delete itab_final where completion_field <> 'X'. 

* Now the itab_final will have the records that do not have X

Thanks

Naren

Read only

0 Likes
433

Duplicate post

Locking thread...

Blag.