Skip to Content
author's profile photo Former Member
Former Member

Handle errors in call transaction....

hi guys how can i handle errors in call transaction method.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2007 at 08:18 AM

    DATA class_name TYPE c LENGTH 30 VALUE 'CL_SPFLI_PERSISTENT'.

    DATA: bdcdata_wa TYPE bdcdata,

    bdcdata_tab TYPE TABLE OF bdcdata.

    DATA opt TYPE ctu_params.

    DATA msgtab TYPE TABLE OF BDCMSGCOLL.

    CLEAR bdcdata_wa.

    bdcdata_wa-program = 'SAPLSEOD'.

    bdcdata_wa-dynpro = '1000'.

    bdcdata_wa-dynbegin = 'X'.

    APPEND bdcdata_wa TO bdcdata_tab.

    CLEAR bdcdata_wa.

    bdcdata_wa-fnam = 'BDC_CURSOR'.

    bdcdata_wa-fval = 'SEOCLASS-CLSNAME'.

    APPEND bdcdata_wa TO bdcdata_tab.

    CLEAR bdcdata_wa.

    bdcdata_wa-fnam = 'SEOCLASS-CLSNAME'.

    bdcdata_wa-fval = class_name.

    APPEND bdcdata_wa TO bdcdata_tab.

    CLEAR bdcdata_wa.

    bdcdata_wa-fnam = 'BDC_OKCODE'.

    bdcdata_wa-fval = '=CIDI'.

    APPEND bdcdata_wa TO bdcdata_tab.

    opt-dismode = 'E'.

    opt-defsize = 'X'.

    CALL TRANSACTION 'SE24' USING bdcdata_tab OPTIONS FROM opt messages into msgtab.

    All the messages will come into MSGTAB. you can check the errors with MSGTYP eq 'E'.

    Message was edited by:

    Jyothi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 19, 2007 at 09:01 AM

    hi,

    u need to declare one table :

    data : it type table of BDCMSGCOLL With header line.

    now in call transaction...

    call trandaction 'xxxx' mode 'x' update 'x' messages into IT.

    now at

    end-of-selection.

    loop at it.

    if it-msgtyp = 'e'.

    write:/ 'message'.

    endif.

    endloop.

    IN table it , all errors will come..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 05:17 AM

    Hi midathala karthik ,

    We can handle the Errors in Call transaction method through <b>BDCMSGCOLL</b> Strcture and one Important function module is <b>Format_message</b>.

    <b>For Example :</b>

    DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,

    BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.

    CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.

    IF SY-SUBRC <> 0.

    PERFORM ERR.

    CLEAR I_MSG.

    REFRESH I_MSG.

    ENDIF.

    &----


    *& Form ERR

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form ERR .

    DATA V_MSG(255) TYPE C.

    READ TABLE I_MSG WITH KEY MSGTYP = 'E'.

    IF SY-SUBRC = 0.

    CALL FUNCTION 'FORMAT_MESSAGE'

    EXPORTING

    ID = I_MSG-MSGID

    LANG = 'E'

    NO = I_MSG-MSGNR

    V1 = I_MSG-MSGV1

    V2 = I_MSG-MSGV2

    V3 = I_MSG-MSGV3

    V4 = I_MSG-MSGV4

    IMPORTING

    MSG = V_MSG

    • EXCEPTIONS

    • NOT_FOUND = 1

    • OTHERS = 2

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    WRITE V_MSG. " Error Message Displayed Here.

    CLEAR V_MSG.

    ENDIF.

    endform. " ERR

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 20, 2007 at 09:24 AM

    u need to declare one internal table with structure of BDCMSGCOLL:

    data : it type table of BDCMSGCOLL With header line.

    now in call transaction...

    call trandaction 'T.CODE' using bdcdata mode 'x' update 'x' messages into IT.

    now at

    loop at it.

    call function module 'formate_message'

    give import,export ,table

    write:/ ' internal table fields'.

    fields are msgid,msgtyp,msgvar1,msgvar2........

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.