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

create field with error messege

Former Member
0 Likes
1,002

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
970

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

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

9 REPLIES 9
Read only

Former Member
0 Likes
970

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

Read only

Former Member
0 Likes
970

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

Read only

Former Member
0 Likes
970

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

Read only

Former Member
0 Likes
970

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

Read only

Former Member
0 Likes
970

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

Read only

Former Member
0 Likes
971

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

Read only

0 Likes
970

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

Read only

0 Likes
970

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

Read only

Former Member
0 Likes
970

data : lv_msg like t100-text " err desc available in table t100