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: 

delete specific row from internal table type any

Former Member
0 Kudos
2,484

Hi,

I want to delete specific table row from table type any and I getting dump,

there is specified way to do that for table type any?

Regards,

joy

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,042

Hi

It depends on the command you're using to delete the record.

The type ANY means the internal table could be STANDARD, SORTED and HASHED, so you can't use command to manage internal table uses the INDEX, but the key only:

FORM DELETE_TAB  USING    P_TAB TYPE ANY TABLE.

   DATA WA TYPE CHAR10.

   DELETE TABLE P_TAB WITH TABLE KEY (WA) = 'AAAA'.

ENDFORM.                    " DELETE_TAB

bu you need to define the key of course

Max

3 REPLIES 3

Former Member
0 Kudos
1,043

Hi

It depends on the command you're using to delete the record.

The type ANY means the internal table could be STANDARD, SORTED and HASHED, so you can't use command to manage internal table uses the INDEX, but the key only:

FORM DELETE_TAB  USING    P_TAB TYPE ANY TABLE.

   DATA WA TYPE CHAR10.

   DELETE TABLE P_TAB WITH TABLE KEY (WA) = 'AAAA'.

ENDFORM.                    " DELETE_TAB

bu you need to define the key of course

Max

amy_king
Active Contributor
0 Kudos
1,042

Hi Joy,

You could also delete by index, e.g.,

DELETE itab INDEX some_index.

Or if you were looping through your table,

LOOP AT itab...

    DELETE itab. " deletes the current loop index

ENDLOOP.

Cheers,

Amy

Former Member
0 Kudos
1,042

Hi joy

You can use delete statement to delete data from internal table different variant of delete statement are {-

DELETING Records:

Single Record: DELETE <ITAB> INDEX <N>.

Multiple Record: DELETE <ITAB> WHERE <Condition>

DELETE <ITAB> FROM <N1> TO <N2>.

DELETING ADJACENT DUPLICATES:

NOTE: Make Sure that the Duplicates should be Adjacent, which can be done through SORTING.

So that, Sorting the <ITAB> is Mandatory.

NOTE: The Duplication of Records(s) depends on the comparing fileds.

DELETE ADJACENT DUPLICATES FROM <ITAB>

Thanks

Anshul Mishra

COMPARING <F1><F2>……..