sap abap alv report fill gap between documents

2020-05-09 13:12发布

问题:

I was trying to challenge myself to make an ALV report that displays all the data by company code. but some document number has a gap.

I want to fill the gap between missing number

For example:

last index value: 20012 then next value is: 20014

How do I able to insert 20013 in the grid if the report is using all the data that exist in internal tables?

Thanks.

回答1:

This is just blind text typing, but I hope you are able to understand it ... should be quite simple. Dont expect complete code, unless your are not even providing ANY code.

DATA: lv_current type i,
      lv_next type i.

SORT lt_internalTable by BUKRS ascending.

LOOP AT lt_internalTable into ls_internalTable.
MOVE sy-tabix to lv_current.
READ TABLE lt_internalTable into ls_tempinternalTable INDEX sy-tabix + 1.
MOVE sy-tabix to lv_next.

IF (lv_next - lv_current) > 1.
 ... do your stuff
ENDIF.

CLEAR: ls_internalTable, lv_current, lv_next.
ENDLOOP.


标签: sap abap alv