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: 

BDC for GB01

Bema
Active Participant
0 Kudos
168

Hi All,

I have written a bdc code for transaction GB01 transaction. But I am not getting the error which shows in the tcode GB01 ,while running the bdc program .

This error should be displayed after I press enter in the first screen.

Appreciate your help.

Regards,

Beena

1 REPLY 1

Former Member
0 Kudos
92

Hi,

You need to work with the MESSTAB functionality of BDC to display such messages..

The piece of code relevant to you is:

DATA: IT_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

        CALL TRANSACTION 'GB01' USING IT_BDCDATA
                         MODE   MODE
                         UPDATE UPDATE
                         MESSAGES INTO IT_MESSTAB.

DATA: L_MSTRING(480).

      LOOP AT IT_MESSTAB.
        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.
          WRITE: / IT_MESSTAB-MSGTYP, L_MSTRING(250).
        ELSE.
          WRITE: / IT_MESSTAB.
        ENDIF.
      ENDLOOP.

Also dont forget to include

TABLES: T100.

at the beginning.

Regards.