INSERT and APPEND with ASSIGNING FIELD-SYMBOL

The harsh truth, at all costs, is that structures are out of date. Nowadays FIELD-SYMBOLS are in.
When you make a LOOP to an internal table of course that you also use ASSIGNING FIELD-SYMBOL instead of INTO Structure,correct?
But what was screwing everything over was APPEND and INSERT. I did not know how to use a structure to add records
Because of that, until a few days ago, I was still doing something like this:
DATA: T_ABC TYPE STANDARD TABLE OF ZABC,
W_ABC LIKE LINE OF T_ABC.
W_ABC-XYZ = 'Olá'.
APPEND W_ABC TO T_ABC.
Which was a pity because, there you go, using structures…well…it’s like still having Windows 7 when Windows 8 is already out more than a week ago. Or like still listening to Madonna now that Lady Gaga exists. Or even listening to Lady Gaga now that Die Antwoord exists.
But everything changed when recently Sérgio Fraga showed me that after all you can use FIELD-SYMBOLS with INSERT and APPEND:
DATA: T_ABC TYPE STANDARD TABLE OF ZABC.
FIELD-SYMBOLS: <ABC> LIKE LINE OF T_ABC.
INSERT INITIAL LINE INTO TABLE T_ABC ASSIGNING <ABC>.
<ABC>-XYZ = 'Olá'.
Thank you Sérgio Fraga because this is so good, and I mean so good, that it feels like finding a table needed for register/records to be inserted to go and use this right now.
Thank you mscaprikell for the photo.
Greetings from Abapinho.
13 de November de 2012 às 09:15 AM
Excelente dica! Esta também não conhecia e de facto é muito bom!
Mereces um like só pelo Die Antwoord! (demasiado alternativo para ser considerado o que seja)
23 de November de 2012 às 05:37 PM
fiz um teste aqui(que pode estar errado), dando loop numa tabela e alimentando outra, um dava append e o outro utilizava esse segundo método usando field-symbol. Incrivelmente o teste se mostrou mais rápido usando append do que o field-symbol!
23 de November de 2012 às 05:39 PM
Ui a sério? Podes meter o código online no gist (https://gist.github.com/) ou algo do género para outros poderem testar?
23 de November de 2012 às 06:42 PM
Segue: https://gist.github.com/4136775
verifiquei uma diferença se o código for feito corretamente no primeiro loop, colocando um clear na work area no começo do loop os dois tempos ficam relativamente semelhantes.
posso elaborar mais em cima do código(obter média e desvio padrão), mas isso já da pra começar a discussao=P
11 de January de 2013 às 11:34 AM
E Então senhores, alguém (Além do nosso Amigo Fawcs) de fato testou essa questão da performance? Se sim, podem compatilhar os resultados?
Abs.
16 de January de 2013 às 10:53 AM
Olá, há vontade, mas estou há um mês com uma tendinite no ombro e como tal tenho reduzido ao mínimo indispensável a minha interacção com teclados. Hei-de, quando ficar melhor.