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

Delete Reference for field symbol

Former Member
0 Likes
2,350

Hi

i have thes code

FUNCTION Z_DEMO.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(INCLUDE_STRUCTURE) TYPE  TABNAM
*"  TABLES
*"      DATA_PACKAGE_TA
*"----------------------------------------------------------------------

  DATA: it_data       TYPE REF TO data.
  FIELD-SYMBOLS: <fs_itab>         TYPE STANDARD TABLE.

  CREATE DATA it_data TYPE STANDARD TABLE OF (INCLUDE_STRUCTURE).
  ASSIGN it_data->* TO <fs_itab>.

  assign  DATA_PACKAGE_TA[] to <fs_it_dp>.

  sort <fs_itab> by ('COSTCENTER') ('CALMONTH') ('CURRENCY').


  delete adjacent duplicates
    from <fs_itab>
    comparing  ('COSTCENTER') ('CALMONTH') ('CURRENCY').


(1) Its workes good but it delete lines from DATA_PACKAGE_TA also how i can delete just from

the field symbol <fs_itab> and keep the itab without change ????

(2) How I can build an another itab like DATA_PACKAGE_TA ??????

Thanks and regardes .

(

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,186

Try something like this way


DATA: it_data       TYPE REF TO data.
  FIELD-SYMBOLS: <fs_itab>         TYPE STANDARD TABLE.
  FIELD-SYMBOLS: <fs_itab1>         TYPE STANDARD TABLE. "<<<
  CREATE DATA it_data TYPE STANDARD TABLE OF (INCLUDE_STRUCTURE).
  ASSIGN it_data->* TO <fs_itab>.
  ASSIGN it_data->* TO <fs_itab1>.  "<<<
 
  assign  DATA_PACKAGE_TA[] to <fs_it_dp>.
  <fs_itab>[] = <fs_itab1>[]    "<<<
 
  sort <fs_itab> by ('COSTCENTER') ('CALMONTH') ('CURRENCY').
 
  delete adjacent duplicates
    from <fs_itab>
    comparing  ('COSTCENTER') ('CALMONTH') ('CURRENCY').
 
   DATA_PACKAGE_TA[] = <fs_itab1>[]. "<<<

a®

4 REPLIES 4
Read only

Former Member
0 Likes
1,186

Hi

U can't do it, because after assigning an object to a field-symbols: the field-symbol and the object are the same thing.

A field-symbol is only a pointer.

U need to move in another table.

Read only

0 Likes
1,186

I can't define another table .....

Read only

Former Member
0 Likes
1,186

hi!

instead of:

assign  DATA_PACKAGE_TA[] to <fs_itab>.

just do like this:

<fs_itab>[] =  DATA_PACKAGE_TA[].

then you can delete from <fs_itab> without deleting the other internal table.

Bye,

Andrew83.

Hope this help you.

Read only

former_member194669
Active Contributor
0 Likes
1,187

Try something like this way


DATA: it_data       TYPE REF TO data.
  FIELD-SYMBOLS: <fs_itab>         TYPE STANDARD TABLE.
  FIELD-SYMBOLS: <fs_itab1>         TYPE STANDARD TABLE. "<<<
  CREATE DATA it_data TYPE STANDARD TABLE OF (INCLUDE_STRUCTURE).
  ASSIGN it_data->* TO <fs_itab>.
  ASSIGN it_data->* TO <fs_itab1>.  "<<<
 
  assign  DATA_PACKAGE_TA[] to <fs_it_dp>.
  <fs_itab>[] = <fs_itab1>[]    "<<<
 
  sort <fs_itab> by ('COSTCENTER') ('CALMONTH') ('CURRENCY').
 
  delete adjacent duplicates
    from <fs_itab>
    comparing  ('COSTCENTER') ('CALMONTH') ('CURRENCY').
 
   DATA_PACKAGE_TA[] = <fs_itab1>[]. "<<<

a®