Skip to Content
2
Jun 04, 2015 at 03:48 AM

When will SAP realize that inconsistent behavior is a bug?

46 Views

Example 1:

Call a screen with an ALV on it, and do not create your container object before calling cl_salv_table->factory.

Everything will be fine.

Now, from a pushbutton on the ALV toolbar, call a second screen with an ALV on it, and again, do not create your container object before calling cl_salv_table->factory.

Everything is NOT fine.

Why?

Answer: on the first and only screen of a program, SAP will let you get away with not creating the container object before calling the factory method.

But if you are using more than one ALV screen within the same program, SAP gets confused unless you create the container object before calling the factory method.

What's wrong with this picture?

Duh! If it doesn't work ALL the time, it shouldn't work at all.

Example 2:

Create a sorted itab with a non-unique key containing just the first two of the key fields from VBFA - preceding doc and preceding item.

Fill this table with a FOR ALL ENTRIES that uses an itab with sales doc #'s and item #'s in it.

SOMETIMES your itab will fill with all the VBFA entries for an item ... and ...

SOMETIMES IT WON'T.

What's wrong with this picture?

Duh! If it doesn't work ALL the time, it shouldn't work at all.

(Note: solution to Example 2 involves using the COMPONENTS clause to make the itab primary_key containing all the fields of the VBFA key (except mandt, unless you need it), and then doing partial key READs with the COMPONENTS clause.)