Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Alv Block list Append & Block display

Former Member
0 Kudos

Hi All,

Iam trying to use the block list to display a list. But Iam calling the same fieldcatalog, layout , append list in the loop. Iam calling the alv block display outside the loop.

But the data is being displayed for only the last loop contents. I think the refreshing the internal table is causing this. But without refreshing, iam not able to append data for new set of record.

the requirement is like this

for every new vbeln, i need to display a new set of details.

Iam not getting all the blocks. Only the last set of data in the internal table is being displayed.

If anybody could tell me if their is a requirement for writng a dynamic internal table which will solve the problem of refreshing the internal table.

Iam posting code .

<b>FIELDCAT-FIELDNAME = 'VBELN'.

FIELDCAT-COL_POS = 1."6.

FIELDCAT-OUTPUTLEN = 10.

FIELDCAT-SELTEXT_M = 'SALES ORDER #'.

APPEND FIELDCAT.

clear FIELDCAT.

FIELDCAT-FIELDNAME = 'MATNR'.

FIELDCAT-COL_POS = 1."6.

FIELDCAT-OUTPUTLEN = 18.

FIELDCAT-SELTEXT_M = 'Plan'.

APPEND FIELDCAT.

clear FIELDCAT.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

  • I_CALLBACK_PF_STATUS_SET = 'STAN'

  • I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

.

G_LAYOUT-NO_INPUT = 'X'.

G_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

G_LAYOUT-TOTALS_TEXT = 'TOTALS'(255).

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = G_LAYOUT

IT_FIELDCAT = FIELDCAT[]

I_TABNAME = 'I_VBAP1'

IT_EVENTS = G_EVENTS

  • IT_SORT =

I_TEXT = text-001

TABLES

T_OUTTAB = I_VBAP1[]

EXCEPTIONS

PROGRAM_ERROR = 1

MAXIMUM_OF_APPENDS_REACHED = 2

OTHERS = 3

.

LOOP AT I_VBAP1.

IF SY-TABIX = 1.

MOVE-CORRESPONDING I_VBAP1 TO I_VBAP2.

APPEND I_VBAP2.

I_VBELN = I_VBAP1-VBELN.

ELSEIF I_VBAP1-VBELN = I_VBELN.

MOVE-CORRESPONDING I_VBAP1 TO I_VBAP2.

APPEND I_VBAP2.

I_VBELN = I_VBAP1-VBELN.

ENDIF.

on change of i_vbap1-vbeln.

IF SY-TABIX > 1.

i_vbap3[] = i_vbap2[].

I_vbeln = i_vbap1-vbeln.

endif.

ENDon.

if not i_vbap3[] is initial.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = G_LAYOUT

IT_FIELDCAT = FIELDCAT[]

I_TABNAME = 'I_VBAP2'

IT_EVENTS = G_EVENTS

  • IT_SORT =

I_TEXT = text-001

TABLES

T_OUTTAB = I_VBAP2[]

EXCEPTIONS

PROGRAM_ERROR = 1

MAXIMUM_OF_APPENDS_REACHED = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear i_vbap3.

refresh i_vbap3.

REFRESH I_VBAP2.

clear i_vbap2.

MOVE-CORRESPONDING I_VBAP1 TO I_VBAP2.

APPEND I_VBAP2.

endif.

ENDLOOP.

GT_PRINT-RESERVE_LINES = 2.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

IS_PRINT = gt_print

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.</b>

Iam not able to see all the blocks. can anyone tell me how to do this.

Thanks

Roopa

1 ACCEPTED SOLUTION

Ashwin
Active Contributor
0 Kudos

Hi Roopa!

i think this is not the right section to post this question.. You post this in ABAP forums ..there will be lot of people who can help you there ...

with regards

ashwin

1 REPLY 1

Ashwin
Active Contributor
0 Kudos

Hi Roopa!

i think this is not the right section to post this question.. You post this in ABAP forums ..there will be lot of people who can help you there ...

with regards

ashwin