10-23-2006 2:23 PM
Hi All!
I just start to learn ABAP ...so this question maybe is not difficult but I didn't find an answer on my own. I have the ABAP code:
.....
SELECT AVBELN AFKART AVKORG AVTWEG AKKBER ASPART
AKUNAG AFKDAT AERNAM AERZET B~WERKS
INTO table IT_VBRK
FROM VBRK AS A INNER JOIN
VBRP AS B ON
AVBELN = BVBELN
WHERE FKDAT = DATAF.
SORT IT_VBRK BY VBELN.
LOOP AT IT_VBRK.
AT NEW VBELN.
WRITE : /5 IT_VBRK-VBELN , IT_VBRK-FKDAT , IT_VBRK-FKART .
ENDAT.
AT END OF VBELN.
ENDAT.
ENDLOOP.
......
And the result is:
.........
90080973 *..*** ****
90080974 *..*** ****
90080975 *..*** ****
.........
Why the system don't write the date and the type of the invoices? It's something wrong with the SELECT statement?
Thank you very much.
Florina
10-23-2006 2:26 PM
Hi Florina,
Your select is Good.
The Culprit is the at new statement.
you should read the internal table immediatley after a at new statement.
SORT IT_VBRK BY VBELN.
LOOP AT IT_VBRK.
AT NEW VBELN.
<b>read table it_vbrk index sy-tabix.</b>
WRITE : /5 IT_VBRK-VBELN , IT_VBRK-FKDAT , IT_VBRK-FKART .
ENDAT.
AT END OF VBELN.
ENDAT.
ENDLOOP.
Make the highlighted change.
Regards,
Ravi
10-23-2006 2:25 PM
Why the system don't write the date and the type of the invoices? It's something wrong with the SELECT statement?
There is nothing wrong with the select statement..it is due to the control statement AT NEW.
Basically, the way AT NEW event works is that it asteriks all the fields to the right of the defined field. So in your case AT NEW VBELN all the fields to the right of VBELN in the internal table are replaced be asterix. To get the value you can initialise another field string similar to itab and move that before AT event and you can use the values from field strings.
Message was edited by: Anurag Bankley
10-23-2006 2:26 PM
Hi Florina,
Your select is Good.
The Culprit is the at new statement.
you should read the internal table immediatley after a at new statement.
SORT IT_VBRK BY VBELN.
LOOP AT IT_VBRK.
AT NEW VBELN.
<b>read table it_vbrk index sy-tabix.</b>
WRITE : /5 IT_VBRK-VBELN , IT_VBRK-FKDAT , IT_VBRK-FKART .
ENDAT.
AT END OF VBELN.
ENDAT.
ENDLOOP.
Make the highlighted change.
Regards,
Ravi
10-23-2006 2:26 PM
The effect is coming from the AT NEW statement, you can get around it by doing this. Define a wa, and move the line into it before the AT NEW, and use the WA to write out the data.
<b>data: wa_vbrk like line of it_vbrk.</b>
LOOP AT IT_VBRK.
<b>wa_vbrk = it_vbrk.</b>
AT NEW VBELN.
<b>WRITE : /5 wa_VBRK-VBELN , wa_VBRK-FKDAT , wa_VBRK-FKART .</b>
ENDAT.
AT END OF VBELN.
ENDAT.
ENDLOOP.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
10-23-2006 2:43 PM
Thank you all!
Maybe was a stupid question but asking stupid question I'm learning .
I hope I didn't offend you ;).
Thanks again.
Florina
10-23-2006 2:45 PM
"There are no stupid questions. There are only questions"-- Anonymous
10-23-2006 2:45 PM
10-23-2006 2:55 PM
Thank you.
There is an transaction to measure the report performance?
Florina
10-23-2006 2:57 PM
Yes .
se30 is the tcode for performance analysis of programs.
regards,
ravi
10-23-2006 2:57 PM
10-23-2006 3:02 PM