Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

A couple of questions about sorted tables and field-symbols...

Hello experts,

I am currently trying to optimize a report since it is really slow. Here are my questions:

1. in the original program, there is an itab named it_alv and after appending records to it, the original programmer made this:

sort it_alv by saknr lifnr budat.

Now, the itab it_alv is a standard table so I tried to use sorted table to skip the sort statement he used. This is what I did:

types: BEGIN OF s_alv,

saknr LIKE bsik-saknr,

lifnr LIKE bsak-lifnr,

name1 LIKE lfa1-name1,

sgtxt LIKE bsik-sgtxt,

budat LIKE bsik-budat,

belnr LIKE bsik-belnr,

dmbtr LIKE bsik-dmbtr,

rtntn LIKE bsik-dmbtr,

balnc LIKE bsik-dmbtr,

curr LIKE bsik-dmbtr,

mon02 LIKE bsik-dmbtr,

mon36 LIKE bsik-dmbtr,

mon79 LIKE bsik-dmbtr,

mo112 LIKE bsik-dmbtr,

mon12 LIKE bsik-dmbtr,


ppnam LIKE bkpf-ppnam,

usnam LIKE bkpf-usnam,

END OF s_alv.

data: it_alv type sorted table of s_alv with non-unique key saknr lifnr budat with header line.

So, is my statement above correct? is it the same as sorting the itab by saknr lifnr budat?And also, I debugged the program and it seems that I cannot use the command append it_alv.

2. This is my 2nd question:

In the original report, I noticed there wasn't any field-symbols so I tried to play around with it. I used field-symbols as header of the itabs declared in the report compared in using a header line. I assigned the field-symbols during loops. So, is this faster?

3. this is my 3rd question:

I am doing a validation and I am confused on what is the fastest.Here are my choices(please add as necessary)

check not itab[] is initial

if not itab[] is initial

describe table itab lines n

4. this is my 4th question:

I tried to play around with indexes(for BSIK and BSAK) and I went to SE11, clicked the indexes button, created my own index and declared certain fields. Now, how can I use my index?

Thanks guys and take care!

Not what you were looking for? View more on this topic or Ask a question