Application Development and Automation 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: 
Read only

How to capture BDC errors

Former Member
0 Likes
543

Hi,

I have a BDC program for Address change VD02, here I am getting 2 errors saying that there a gap in the zip code. I checked the input file and found out from where the error is comming but user is asking is there any way, we can we can display this error with the customer number of incorrect transaction. In the log it just gave me the error, I want to find out from which store number the error is comming.

Here are the input fields and error log.

Thanks,

veni.



TYPES: BEGIN OF type_infile,
         KUNNR(10) TYPE c,  "Customer Number
         NAME1(35) TYPE c,                                  "Name1
         STRAS(35) TYPE c,  "street
         ORT01(35) TYPE c,  "City
         REGIO(03) TYPE c,  "Region
         PSTLZ(10) TYPE c,  "Postal Code
         GLNNO(20) TYPE c.  "Global Location Number

TYPES: END OF type_infile.

 Time    Message                                                         TransactIndex Modul       ScreenIndeT    ID        No.       
 15:27:31Changes have been made                                          VD02    74    SAPMF02D    0125  4   S    F2        056       
 15:27:31Transaction was processed successfully                          VD02    74                      0   S    00        355       
 15:27:32Changes have been made                                          VD02    75    SAPMF02D    0125  4   S    F2        056       
 15:27:32Transaction was processed successfully                          VD02    75                      0   S    00        355       
 15:27:32Postal Code must not contain any gaps                           VD02    76    SAPMF02D    0110  2   E    AR        105       
 15:27:32Transaction error                                               VD02    76                      0   S    00        357       
 15:27:32Changes have been made                                          VD02    77    SAPMF02D    0125  4   S    F2        056       
 15:27:32Transaction was processed successfully                          VD02    77                      0   S    00        355       

4 REPLIES 4
Read only

Former Member
0 Likes
498

use bdcmsgcoll structure :

sample code

DATA: itab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

CALL TRANSACTION tcode USING bdcdata MODE mod MESSAGES INTO itab.

*get text to bdc-message

if sy-subrc <> 0.

...

LOOP AT itab WHERE msgtyp = 'E'.

*fill errtab

CLEAR errtab.

MOVE p_kunnr TO errtab-kunnr.

MOVE p_bukrs TO errtab-bukrs.

MOVE p_kde TO errtab-kde.

MOVE p_bkz TO errtab-bkz.

*

MOVE itab-msgnr TO errtab-msgnr.

MOVE itab-msgid TO errtab-msgid.

MOVE itab-fldname TO errtab-fieldn.

*fill protocol

CLEAR prot.

MOVE-CORRESPONDING itab TO prot.

MOVE-CORRESPONDING errtab TO prot.

MOVE itab-fldname TO prot-feld.

SELECT SINGLE text FROM t100 INTO prot-text

WHERE sprsl = sy-langu

AND arbgb = prot-msgid

AND msgnr = prot-msgnr.

CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'

EXPORTING

langu = sy-langu

msgid = itab-msgid

msgno = prot-msgnr

msgv1 = prot-msgv1

msgv2 = prot-msgv2

msgv3 = prot-msgv3

msgv4 = prot-msgv4

IMPORTING

text = prot-text.

APPEND prot.

ENDLOOP.

...

endif.

Read only

Former Member
0 Likes
498

Hi ,

Make use of the FM FORMAT_MESSAGE to get the detailed info of the message .

Also make a search with the above said FM in SDN and you will see BDC program examples which have made use fo this FM .

Hope this helps .

Thanks ,

Varun .

Read only

Former Member
0 Likes
498

You appear to be using the session method, so I don't think there's much you can do. You could convert it to CALL TRANSACTION and give more meaningfull messages.

Rob

Read only

Former Member
0 Likes
498

Hi

This is for ur info. All the zip codes are related with Address table. Please check with with country and state with ur zip code in Address table. U can check this in zipcode domain level.

Reward me if itd useful.

Regards

Ravi