2006 Dec 04 1:30 PM
Hallow I doing a batch input and I wont to have all the error messege(messege and messegeid) in field like error_messege how can I do it
DATA: sucsses_messege TYPE syst-subrc.
DATA: returen_messege LIKE TABLE OF bdcmsgcoll.
DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA: wa_messtab LIKE LINE OF messtab .
DATA: error_messege(100) TYPE c.
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-osek_morsh
itab-company_name
itab-company_code.
APPEND itab.
ENDLOOP.
LOOP AT itab.
REFRESH messtab.
CLEAR messtab.
CALL FUNCTION 'YHR_VENDOR_BI'
EXPORTING
CTU = 'X'
MODE = 'N'
UPDATE = 'S'
GROUP =
USER =
KEEP =
HOLDDATE =
NODATA = '/'
lifnr_001 = 'osek_morsh'
ktokk_002 = 'Z001'
anred_003 = 'Company'
name1_004 = 'company_name'
sortl_005 = 'company_name'
land1_006 = 'IL'
spras_007 = 'HE'
stceg_008 = 'company_code'
IMPORTING
subrc = sucsses_messege
TABLES
messtab = returen_messege.
PERFORM write_message.
ENDLOOP.
ENDFORM. " get_data
&----
*& Form write_message
&----
text
----
--> p1 text
<-- p2 text
----
FORM write_message .
<b>MOVE wa_messtab TO error_messege.</b>
<b>it will help if u give me example</b>
thankes
2006 Dec 04 1:43 PM
DATA: returen_messege LIKE TABLE OF bdcmsgcoll,
wa_message like line of returen_messege.
loop at returen_messege into wa_message.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = wa_message-MSGID
LANG = SY-LANGU
NO = wa_message-MSGNO
V1 =wa_message-MSGV1
V2 = wa_message-MSGV2
V3 = wa_message-MSGV3
V4 = wa_message-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 😕 LV_MSG.
endloop.
this way also u can make it
DATA: returen_messege LIKE TABLE OF bdcmsgcoll,
wa_message like line of returen_messege.
loop at returen_messege into wa_message.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = wa_message-MSGID
LANG = SY-LANGU
NO = wa_message-MSGNO
V1 =wa_message-MSGV1
V2 = wa_message-MSGV2
V3 = wa_message-MSGV3
V4 = wa_message-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 😕 LV_MSG.
endloop.
this way also u can make it
2006 Dec 04 1:33 PM
HI,
Use <b>FORMAT_MESSAGE</b> FM ..
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
Regards,
Santosh
2006 Dec 04 1:36 PM
Hi,
Please use <b>write_message</b> or <b>Format_message</b> fucntion module to get error_messages will filled with error message.
Regards
Bhupal Reddy
2006 Dec 04 1:37 PM
Use FORMAT_MESSAGE FM ..
Ur code here.......
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 😕 LV_MSG.
ur additional code here
2006 Dec 04 1:38 PM
Hi,
You can use the FM MESSAGE_PREPARE or FORMAT_MESSAGE.
LOOP AT MESSTAB.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = MESSTAB-MSGID
V1 = MESSTAB-MSGV1
V2 = MESSTAB-MSGV2
V3 = MESSTAB-MSGV3
V4 = MESSTAB-MSGV4
IMPORTING
MSG = MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
ENDIF.
WRITE:/ MSG.
CLEAR: MSG.
ENDLOOP.Regards
Vijay
2006 Dec 04 1:40 PM
Hi antonio,
here ur passing an internal table to FM and there u will have all the error messages returned by it.so, u have to read the error message tabel and further u can do any operations like display r some thing else .
DATA: returen_messege LIKE TABLE OF bdcmsgcoll,
wa_message like line of returen_messege.
loop at returen_messege into wa_message.
write:/ wa_message-MSGID,wa_message-MSGTYP,wa_message-MSGNR,...../
endloop.
like u have more no of fields find in the bdcmsgcoll structure
2006 Dec 04 1:43 PM
DATA: returen_messege LIKE TABLE OF bdcmsgcoll,
wa_message like line of returen_messege.
loop at returen_messege into wa_message.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = wa_message-MSGID
LANG = SY-LANGU
NO = wa_message-MSGNO
V1 =wa_message-MSGV1
V2 = wa_message-MSGV2
V3 = wa_message-MSGV3
V4 = wa_message-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 😕 LV_MSG.
endloop.
this way also u can make it
2006 Dec 04 2:05 PM
hallow thankes for your time my qustion is what i put in lv_msg becouse it bring me an error and if in v1 v2 v3 i put the field tthat in itab regards
2006 Dec 04 2:14 PM
hi,
Declare it in this way..no need to create an internal table ...
*--Var to store the formatted msg.
DATA : LV_MSG(255).Regards,
Santosh
2006 Dec 04 2:13 PM
data : lv_msg like t100-text " err desc available in table t100
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |