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: 

How to display msgs in BDC thruogh an ALV?

Former Member
0 Kudos

I have written a BDC.I want to display msgs of MESSTAB in ALV.Can someone guide me on this?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hI,

every time when the messge is coming out from the bdc

it will be collected into the bdcmsgcoll table

after the bdc

display this table bdcmsgcoll using alv_grid

if you want to put only the error messages

then

loop at bdcmsgcoll where msgtyp = 'E'.

append itab from bdcmsgcoll.

endloop.

display itab.

regards,

Venkatesh

5 REPLIES 5

Former Member
0 Kudos

hI,

every time when the messge is coming out from the bdc

it will be collected into the bdcmsgcoll table

after the bdc

display this table bdcmsgcoll using alv_grid

if you want to put only the error messages

then

loop at bdcmsgcoll where msgtyp = 'E'.

append itab from bdcmsgcoll.

endloop.

display itab.

regards,

Venkatesh

Former Member
0 Kudos

READ TABLE it_messtab INDEX sy-tfill.

SELECT SINGLE * FROM t100 WHERE sprsl = it_messtab-msgspra

AND arbgb = it_messtab-msgid

AND msgnr = it_messtab-msgnr.

IF sy-subrc = 0.

l_mstring = t100-text.

IF l_mstring CS '&1'.

REPLACE '&1' WITH it_messtab-msgv1 INTO l_mstring.

REPLACE '&2' WITH it_messtab-msgv2 INTO l_mstring.

REPLACE '&3' WITH it_messtab-msgv3 INTO l_mstring.

REPLACE '&4' WITH it_messtab-msgv4 INTO l_mstring.

ELSE.

REPLACE '&' WITH it_messtab-msgv1 INTO l_mstring.

REPLACE '&' WITH it_messtab-msgv2 INTO l_mstring.

REPLACE '&' WITH it_messtab-msgv3 INTO l_mstring.

REPLACE '&' WITH it_messtab-msgv4 INTO l_mstring.

ENDIF.

CONDENSE l_mstring.

Use above code to format the messtab contents...

then fill this l)mstring in your itab and display this itab via ALV

0 Kudos

In the response above, l_mstring usually has to be quite a long field, as otherwise after 4 REPLACEs (each bringing in trailing blanks) truncation will have occurred.

I use 300 characters and have had no problems yet.

John

Former Member
0 Kudos

Thnaks for all inputs

0 Kudos

Hi,

You can use the function module POPUP_WITH_TABLE_DISPLAY also directly to display messages in ALV.