‎2009 Dec 23 12:20 PM
I need access to an internal table from the call stack. So how do I use the ASSIGN statement to grab the contents of a table and then start looping at the table within my subroutine?
‎2009 Dec 24 12:56 AM
Just tip, apart from above replies:
Check for SY-SUBRC value as 0, immediately after ASSIGN, other wise, it throws dump (OR) catch the system exception at root level and handle it.
Also, at the end use UNASSIGN for performence reasons.
thanq
‎2009 Dec 23 3:45 PM
here is how to do it:
DATA: mem_name TYPE char60 VALUE '(REPID)TABNAME[]'.
FIELD-SYMBOLS: <table> TYPE ANY TABLE,
<struc> TYPE ANY.
ASSIGN (mem_name) TO <table>.
LOOP AT <table> ASSIGNING <struc>.
ENDLOOP.
‎2009 Dec 23 9:45 PM
... and for simplification please write
FIELD-SYMBOLS:
<table> TYPE TABLE,
<struc> TYPE ANY.
ASSIGN ('(REPID)TABNAME[]') TO <table>.
LOOP AT <table> ASSIGNING <struc>.
ENDLOOP.Regards,
Clemens
P.S. It was release 4.something that it was in the ABAP online help with the hint that it should not be used because it may be changed in the next release. They did not change anything since then but removed the documentation
‎2009 Dec 23 10:32 PM
> They did not change anything since then but removed the documentation
Are you sure? There have been a lot of changes in ABAP and I heard that (dirty ('(assign's) where on a list somewhere.
Certainly they have been security considerations...
Cheers,
Julius
‎2009 Dec 23 4:02 PM
<misunderstanding_removed_by_moderator>
Edited by: Julius Bussche on Dec 23, 2009 11:33 PM
‎2009 Dec 23 4:34 PM
david,
no offense but please go though this to know about call stacks..
François has given a very good response to it...
@modos: please do the needful
‎2009 Dec 23 6:31 PM
‎2009 Dec 24 12:56 AM
Just tip, apart from above replies:
Check for SY-SUBRC value as 0, immediately after ASSIGN, other wise, it throws dump (OR) catch the system exception at root level and handle it.
Also, at the end use UNASSIGN for performence reasons.
thanq