Bdc error message in call transaction

Hi all,
        Can anyone send me a program where they have used the ' BDCMSGCOLL ' structure and format_message FM. I need only complete program, please don't send sample codings or just a part of coding.
Points are assured.
Thanks and regards,
subbu.

Hi,
Here is the BDC recording program  for updating  a custom field (out of 3 custom fields)  in CALL TRANSACTION method depends upon which value is given in text file, based on that the corresponding radio button will be selected for that PERNR in PA30.(For 3 custom fields in PA0007) created.
Flat file contains 1) PENR    2) Custom field1      3) CF2        4) CF3.
The values are like [ '636363', ' ', 'X', ' ' ] .
Here is the complete program using BDCMSGCOLL structure.
report Y0007_BDC NO STANDARD PAGE HEADING MESSAGE-ID RP LINE-SIZE 180." LINE-COUNT 28.
              DATA DECLARATION                                     *
TYPES : BEGIN OF TY_0007,
          PERNR      TYPE PERNR,      " PERNR
          SCHKZ      TYPE SCHKN,      " Work Schudule
          ZTERF      TYPE PT_ZTERF,   " Time Magmt Status
          R1         TYPE C,
          R2         TYPE C,
          R3         TYPE C,
        END OF TY_0007.
DATA  : INT_0007  TYPE STANDARD TABLE OF TY_0007 WITH HEADER LINE,
        WA_0007   TYPE TY_0007.
DATA: P_FNAME TYPE IBIPPARMS-PATH.
DATA : begin of int_out occurs 0,
  pernr type persno,
  mesg(300),
  end of int_out.
DATA : BEGIN OF int_err occurs 0,
  pernr type persno,
  mesg(300),
  end of int_err.
include bdcrecx1.
          SELECTION SCREEN                                         *
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS : P_PATH TYPE string.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN END OF BLOCK A.
      CALL FUNCTION FOR INPUT FILE NAME                            *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_path.
  CALL FUNCTION 'F4_FILENAME' 
  EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = ' '
    IMPORTING
      FILE_NAME     = P_FNAME.
  p_path = p_fname.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
start-of-selection.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME                = P_PATH
      FILETYPE                = 'ASC'
      HAS_FIELD_SEPARATOR     = 'X'
    TABLES
      DATA_TAB                = INT_0007
    EXCEPTIONS
      FILE_OPEN_ERROR         = 1
      FILE_READ_ERROR         = 2
      NO_BATCH                = 3
      GUI_REFUSE_FILETRANSFER = 4
      INVALID_TYPE            = 5
      NO_AUTHORITY            = 6
      UNKNOWN_ERROR           = 7
      BAD_DATA_FORMAT         = 8
      HEADER_NOT_ALLOWED      = 9
      SEPARATOR_NOT_ALLOWED   = 10
      HEADER_TOO_LONG         = 11
      UNKNOWN_DP_ERROR        = 12
      ACCESS_DENIED           = 13
      DP_OUT_OF_MEMORY        = 14
      DISK_FULL               = 15
      DP_TIMEOUT              = 16
      OTHERS                  = 17.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  perform open_group.
*Looping pernr values*
  LOOP AT INT_0007 INTO WA_0007.
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
*INSERTING THE PERNR VALUE*
    perform bdc_field       using 'RP50G-PERNR'
                                  WA_0007-PERNR.            "'00001011'.
    perform bdc_field       using 'RP50G-TIMR6'
                                  'X'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RP50G-CHOIC'.
    perform bdc_field       using 'RP50G-CHOIC'
                                  '0007'.
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RP50G-PERNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=INS'.
    perform bdc_field       using 'RP50G-PERNR'
                                  WA_0007-PERNR.            "'1011'.
    perform bdc_field       using 'RP50G-TIMR6'
                                  'X'.
    perform bdc_field       using 'RP50G-CHOIC'
                                  'Planned Working Time - 0007'.
    perform bdc_dynpro      using 'MP000700' '2000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPD'.
    perform bdc_field       using 'P0007-BEGDA'
                                  '12/01/2007'.
    perform bdc_field       using 'P0007-ENDDA'
                                  '12/31/9999'.
*INSERTING THE WORK SCHEDULE*
    perform bdc_field       using 'P0007-SCHKZ'
                                  WA_0007-SCHKZ.            "'N12'.
    perform bdc_field       using 'P0007-ZTERF'
                                  WA_0007-ZTERF.            "'1'.
*INSERTING THE OVERTIME CLASS*
    IF WA_0007-R1 = 'X'.
      perform bdc_field       using 'ZHQ0007-OVT_ELGBLE'
                                    'X'.
    ELSEIF WA_0007-R2 = 'X'.
      perform bdc_field       using 'ZHQ0007-OVT_NOTELG'
                                          'X'.
    ELSEIF WA_0007-R3 = 'X'.
      perform bdc_field       using 'ZHQ0007-OVT_TMPELG'
                                        'X'.
    ENDIF.
*BDC output for transaction code*
   perform bdc_transaction using 'pa30'.  (STD)
    perform f_bdc_output using 'pa30'.  (write on our own)
  ENDLOOP.
**Writing the output**
  PERFORM f_write_output.
  perform close_group.
*&      Form  f_write_output
      text
-->  p1        text
<--  p2        text
FORM f_write_output .
*For Successfull  Records*
  if int_OUT[] IS NOT INITIAL.
    WRITE : /50 TEXT-004 color 4.
    write : / sy-uline.
    LOOP AT INT_OUT.
      WRITE : /40 int_out-pernr,50 '-->',54 int_out-mesg.
    ENDLOOP.
  ENDIF.
  write / sy-uline.
  SKIP 2.
*For Error records*
  if int_err[] IS NOT INITIAL.
    WRITE /53 text-005 color 6.
    write / sy-uline.
    LOOP AT int_err.
      write :/40 int_err-pernr,50 '-->',54 int_err-mesg.
    ENDLOOP.
  endif.
  write / sy-uline.
ENDFORM.                    " f_write_output
*&      Form  f_bdc_output
      text
     -->P_0369   text
FORM f_bdc_output  USING    VALUE(P_0369).
  DATA: L_MSTRING(480).
  DATA: L_SUBRC LIKE SY-SUBRC.
  REFRESH MESSTAB.
*Capturing the output message*
  CALL TRANSACTION 'PA30' USING BDCDATA
                   MODE   CTUMODE
                   UPDATE CUPDATE
                   MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
  IF SMALLLOG <> 'X'.
    LOOP AT MESSTAB.
*Selection for capturing the text for records*
      SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
                                AND   ARBGB = MESSTAB-MSGID
                                AND   MSGNR = MESSTAB-MSGNR.
      IF SY-SUBRC = 0.
*Moving the text from T100 to local variable*
        L_MSTRING = T100-TEXT.
        IF ( MESSTAB-MSGTYP = 'W' or
            MESSTAB-MSGTYP = 'S' OR
            MESSTAB-MSGTYP = 'E' ).
*Moving the success records pernr and text to internal table*
          IF MESSTAB-MSGTYP = 'S'.
            INT_OUT-PERNR = WA_0007-PERNR.
            INT_OUT-MESG  = L_MSTRING.
            APPEND INT_OUT.
            CLEAR INT_OUT.
*Moving the success records pernr and text to internal table*
          ELSEIF MESSTAB-MSGTYP = 'E'.
*For getting the error text exactly*
            IF L_MSTRING CS '&1'.
              REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
              REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
              REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
              REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
            ELSE.
              REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
              REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
            ENDIF.
            CONDENSE L_MSTRING.
            INT_ERR-PERNR = WA_0007-PERNR.
            INT_ERR-MESG  = L_MSTRING.
            APPEND INT_ERR.
            CLEAR  INT_ERR.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDLOOP.
    SKIP.
  ENDIF.
*&     CALL FUNCTION 'BDC_OPEN_GROUP'
  IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
    IF E_GROUP_OPENED = ' '.
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          CLIENT   = SY-MANDT
          GROUP    = E_GROUP
          USER     = E_USER
          KEEP     = E_KEEP
          HOLDDATE = E_HDATE.
      E_GROUP_OPENED = 'X'.
    ENDIF.
*&     CALL FUNCTION 'BDC_INSERT'
    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        TCODE     = 'PA30'
      TABLES
        DYNPROTAB = BDCDATA.
*&     CALL FUNCTION 'BDC_CLOSE_GROUP'
    CALL FUNCTION 'BDC_CLOSE_GROUP'
      EXCEPTIONS
        NOT_OPEN    = 1
        QUEUE_ERROR = 2
        OTHERS      = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.
  REFRESH BDCDATA.
ENDFORM.                    " f_bdc_output
Hope it helps u..
Kindly reward points if helpful
Regards,
Shanthi

Similar Messages

  • Display error messages in Call transaction

    Hi Gurus,
    I have donme BDC using call transaction..can anybody help me in displaying the error messages in call transaction..
    A detailed code wud be very much helpful..
    full marks wud given
    regards
    Sahil

    hi check this,
    PERFORM Z11_BDC_VA02.
          ELSE.
            MESSAGE I013 WITH TEXT-013.
          ENDIF.
    ELSE.
              CLEAR V_FLAG.
           MESSAGE E012 WITH TEXT-012.
    ENDIF.
    FORM z11_bdc_va02 .
    *COVER 1
    perform bdc_dynpro      using 'SAPMV45A' '0102'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAK-VBELN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBAK-VBELN'
                                  wa_head_detail-vbeln.
    *COVER 2
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=T\03'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    *COVER 3
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ITNE'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-MABNR(01)'.
    *COVER 4
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-KWMENG'.
    perform bdc_field       using 'VBAP-MATNR'
                                  wa_head_detail-matnr.
    perform bdc_field       using 'RV45A-KWMENG'
                                  v_kwmeng.
    perform bdc_field       using 'VBAP-VRKME'
                                  wa_head_detail-meins.
    *COVER 5
    perform bdc_dynpro      using 'SAPLSPO2' '0101'.
    perform bdc_field       using 'BDC_OKCODE'
                                 '=OPT1'.
    call transaction 'VA02' using it_tab1 mode 'A' UPDATE 'S' MESSAGES INTO
    IT_TAB_ERROR.
    "CAlling transaction with all screen
    Loop at it_tab_error.
    if it_tab_ERROR-MSGTYP = 'E' .
    clear v_flag.
    message I014 with TEXT-014.
    else.
    clear v_flag.
    message I019 with TEXT-019.
    endif.
    endloop.
    refresh it_tab1.
    clear V_KWMENG.
    ENDFORM.                    " z11_bdc_va02
    Reward if helpful,
    Gaurav J.
    Edited by: GAURAV on Feb 4, 2008 9:10 AM

  • How to track error message when calling Transaction: va02

    Hi all,
        As we all know, when we change an order through T-Code: VA02, system will update modified data to corresponding database. Meanwhile, if our operate is not legal or incorrect on T-code: VA02, system will call corresponding error messages to us.
        Now I want to know:
       1. how to track the error messages
       2. Is there any Tcode such as: SM21 that we can see the message logs after our operation?
    Thanks.

    Hi ,
    message table for call transaction
    DATA: BEGIN OF G_T_MSG OCCURS 0.
            INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END OF G_T_MSG.
    Exucute transaction via Call Transaction
      CALL TRANSACTION  'FB01'
                     USING g_t_bdcdata
                     MODE g_l_mode
                     UPDATE 'S'
                     MESSAGES INTO g_t_msg          .
    errors will be stpored in the table g_t_msg ..
    Thanks .

  • Error message during call transaction

    Hi all,
    I want to get the message type after calling the transaction method. I've simulated an input for error, and I expect that the returned message type should be 'E' or 'W'. But it (SY-MSGTY and msgtab-MSGTYP) still returns 'S' even there is error. What's wrong ?
    Call transaction 'VL02N' USING BTAB MODE 'N' UPDATE 'S'.
    messages into msgtab.

    CALL TRANSACTION tcode USING bdcdata
                       MODE   ctumode
                       UPDATE cupdate
                       MESSAGES INTO messtab.
    LOOP AT messtab.
        msgtype = messtab-msgtyp.
    Check what the actual tranaction is giving as message for eg. mm01 does give u a sucess message saying data for the matnr is already maintained.

  • Error messages when calling RSDRI_INFOPROV_READ for more than one time

    Hello all,
    I need to write a cube, however, before I do this I need to check whether there are already data in the target cube for a certain accounting period. This I do by reading the cube via FM RSDRI_INFOPROV_READ. The following coding is called from a running program after pushing a button on the screen.
    <i>* clear internal tables.
          CLEAR gt_range.
          CLEAR gt_sfc.
    *fill internal tables
          CLEAR ls_sfc.
          ls_sfc-chanm    = '0FISCPER'.
          ls_sfc-chaalias = '0FISCPER'.
          ls_sfc-orderby  = 0.
          INSERT ls_sfc INTO TABLE gt_sfc.
          CLEAR ls_range.
          ls_range-chanm    = '0FISCPER'.
          ls_range-sign     = rs_c_range_sign-including.
          ls_range-compop   = rs_c_range_opt-equal.
          ls_range-low      = '2007001'.
          APPEND ls_range TO gt_range.
    here I do not know what exactly to do with this flag
          lf_first_call = abap_true.
          CALL FUNCTION 'RSDRI_INFOPROV_READ'
            EXPORTING
              i_infoprov             = 'T01'
              i_th_sfc               = gt_sfc
              i_th_sfk               = gt_sfk
              i_t_range              = gt_range
              i_packagesize          = 1
            IMPORTING
              e_t_data               = lt_rd_cube
              e_end_of_data          = lf_eod
            CHANGING
              c_first_call           = lf_first_call
            EXCEPTIONS
              illegal_input          = 1
              illegal_input_sfc      = 2
              illegal_input_sfk      = 3
              illegal_input_range    = 4
              illegal_input_tablesel = 5
              no_authorization       = 6
              illegal_download       = 7
              illegal_tablename      = 8
              trans_no_write_mode    = 9
              inherited_error        = 10
              x_message              = 11
              OTHERS                 = 12.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          lf_eod = abap_false.
          IF NOT lt_rd_cube IS INITIAL.
            RAISE target_data_found.
            EXIT.
          ENDIF.</i>
    When testing with a period for which data already exists, it runs through quite perfectly. The return table is filled and I know that data exists and I EXIT.
    However, if I press the button again (program is still running) I get an error message 'Nested call of RSDRI_INFOPROV_READ'. And this for each time I press the button.
    So I thought I should clear the flag lf_first_call. After having done so I get an error message 'SQL Error'. Funny is that I get this error only every second time the Function Module is processed. Every other time it works perfectly.
    How can I get rid of those error messages?
    PLEASE - can anybody help me?
    Many thanks in advance,
    Thomas

    Hi,
    you have something like:
    end_of_data = ' '.
    first_call  = 'X'.
      WHILE end_of_data = ' '.
            CALL FUNCTION 'RSDRI_INFOPROV_READ'
              EXPORTING  i_infoprov             = ....
                         i_th_sfc               = ...
                         i_th_sfk               = ...
                         i_t_range              = ...
                         i_reference_date       = ...
                         i_save_in_table        = ....
                         i_save_in_file         = ....
                         I_USE_DB_AGGREGATION   = ...
                         i_packagesize          = 100000
                         i_authority_check      = ...
              IMPORTING  e_t_data               = .....
                         e_end_of_data          = end_of_data
              CHANGING   c_first_call           = first_call
              EXCEPTIONS illegal_input          = 1
                         illegal_input_sfc      = 2
                         illegal_input_sfk      = 3
                         illegal_input_range    = 4
                         illegal_input_tablesel = 5
                         no_authorization       = 6
                         ncum_not_supported     = 7
                         illegal_download       = 8
                         illegal_tablename      = 9
                         OTHERS                 = 11.
      ENDWHILE.
    hope this helps...
    Olivier.

  • Startrfc: Error message after calling a FM/report

    Hello Experts,
    I am working on a solution to call a RFC function module from outside of SAP via startrfc. This FM opens a report displaying standard report output.
    The call via startrfc works as expected. The sapgui opens. As long as the report is open the startrfc command console hangs. When I close the SAPGUI window with the report, logoff popup is displayed. But in the console I got an error message:
    RFC Call/Exception: SYSTEM_FAILURE
    Group Error group 104
    Key RFC_ERROR_SYSTEM_FAILURE
    Message connection closed without message <CM_NO_DATA_RECEIVED>
    Does anybody kow what causes this behavior? And further on: can I change the behavior that the startrfc call blocks the console? Why does it not return immediatly?
    Any hints are welcome?
    Regards,
    Andreas

    Yes, we are using RAS. Our setup is BOE XI 3.1 on Linux. We are using the RAS/CrystalReportViewer java API to execute/view the reports from a JBoss server also running on Linux.
    We did find a CRConfig on the BOE server and it did contain a <SocketTimeout>60000</SocketTimeout> entity. We modified it to 600000 and restarted the BOE service. Unfortunately, we still the same problem ("Failed to retrieve data from the database; Error in File {B608A22A-1E54-11E0-ABFC-000E0CB8A71E}.rpt: Failed to retrieve data from the database").
    We thought that when using the CrystalReportViewer java API, rendering is done "locally" (that is, on our web server). In that case, shouldn't we have a CRConfig.xml on our web server? We're seeing conflicting information about this on the forum. If we do need CRConfig.xml on our web server, then should we copy it from the one on the BOE, and where should we put it?

  • Error message when running Transaction Code = ME84

    hi,
    i am getting an error message when running Transaction Code = ME84
    Error is 'No processing (error message P5 017), No data for chosen selection'
    can someone please guide me on this ?

    Hi Mahendra,
    There are several reasons for the release not happeneing.
    1. The issue could be in the selection of release type
    2. Scope of selection
    3. Strategy profile
    Please check whether the selection parameters are considered are right for release to happen.
    Regards,
    Harish

  • Where will store the messages in Call transaction

    Hi all,
    will the messages in call transaction stored in database? if not where it will be stored?
    Thanks for sending reply
    Venkat

    Hello Venkat,
    Messages in the Call Transaction are stored in a Internal table of type BDCMSGCOLL.They are not stored in the Database.
    We need to do the following.
    "Declare internal table of type BDCMSGCOLL
    Data : t_messages     TYPE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
        CALL TRANSACTION  ia06
                   USING  t_bdc_data
                   MODE   'A'
                   UPDATE 'S'
                  MESSAGES INTO t_messages.
    DATA: l_mstring(480).
    LOOP AT t_messages.
      SELECT SINGLE * FROM t100 WHERE sprsl = t_messages-msgspra
                                AND   arbgb = t_messages-msgid
                                AND   msgnr = t_messages-msgnr.
      IF sy-subrc = 0.
        l_mstring = t100-text.
        IF l_mstring CS '&1'.
          REPLACE '&1' WITH t_messages-msgv1 INTO l_mstring.
          REPLACE '&2' WITH t_messages-msgv2 INTO l_mstring.
          REPLACE '&3' WITH t_messages-msgv3 INTO l_mstring.
          REPLACE '&4' WITH t_messages-msgv4 INTO l_mstring.
        ELSE.
          REPLACE '&' WITH t_messages-msgv1 INTO l_mstring.
          REPLACE '&' WITH t_messages-msgv2 INTO l_mstring.
          REPLACE '&' WITH t_messages-msgv3 INTO l_mstring.
          REPLACE '&' WITH t_messages-msgv4 INTO l_mstring.
        ENDIF.
        CONDENSE l_mstring.
        WRITE: / t_messages-msgtyp, l_mstring(250).
      ELSE.
        WRITE: / t_messages.
      ENDIF.
    ENDLOOP.
    Regards,
    Arun Sambargi.

  • Error message "no accounting transaction variant assigned for FB60//GL"

    Hi Friends,
      I created a new document type for GL postings in ECC 6.0. I tried to post a document for this document in FB60.. It displays the error message "no accounting transaction variant assigned for FB60//GL". Can anyone help me solve this problem.
    Thanks
    Ramya

    You need to do the settings as follows:
    Go to extended document splitting- define business transaction variant
    Here u need to do series of settings.
    Pl check your settings here

  • Regarding error message from a transaction

    Hello all,
          I have a scenario where i need to collect all the error message from a trasaction and display it in a pop up.
          i am calling a function module and inturn calling transaction 'FB08' using bdc. i may get one or more error message. if there are more than one messages from my function module then i need to display this messages in a popup.
        Currently i am displaying one message using 'message ID' syntax at the bottom. what should i do to display error messages in a popup if there are more message
    Thanks,
    Raju N.

    use following fm.  
    CALL FUNCTION 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
          EXPORTING
          TASK             = 'DISPLAY'
            titel            = 'Creation Log'
        IMPORTING
          FUNCTION         =
          TABLES
            text_table       = i_documents_log.

  • How to store BDC error messages into oracle database table?

    Hello Experts,
    I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
    Thanks in advance.

    Hi,
    Structure of BDCMSGCOLL.
    TCODE -> BDC Transaction code
    DYNAME -> Batch input module name
    DYNUMB -> Batch input screen number
    MSGTYP ->Batch input message type
    MSGSPRA -> Language ID of a message
    MSGID -> Batch input message ID
    MSGNR -> Batch input message number
    MSGV1 -> Variable part of a message
    MSGV2 -> Variable part of a message
    MSGV3 -> Variable part of a message
    MSGV4 -> Variable part of a message
    FLDNAME -> Field name
    Ex :
    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
    hope this will help you.
    Reward if found helpfull,
    Cheers,
    Chaitanya.

  • Track error records in Call Transaction method

    Hi
    I have used call transaction method for uploading legacy data.
    I need to track the error record.
    Please help me to find out the solution.
    Thanks in advance
    Reagards
    shriraam

    HI,
    !. Obtain  the  messaged into an Interal table of type BDCMSGCOLL using Call Transaction  syntax..
                   Call Transactio <Tcode>
                           using <BDC Table>
                          mode  <A/N/P>
                          update  <A/S>
                         messages  INTO <mSGTAB>
    2. Read the Msg table for eroors and success messages
    3. Then format the messge with the help of Function Module  :'Format_messages'.
    4. Display the respective messges with the help of write statements or with the help of ALV.
    Rgds
    Umakanth

  • Caprturing error log in call transaction?

    hoiw can i get all the error in call transaction method, can any one guide me?

    see this
    *& Report ZMATERIAL
    report zmaterial_fert.
    selection-screen :begin of block bl1 with frame title  text-001.
    parameters : p_fname type rlgrap-filename,
                   p_lgort type rlgrap-filename,
                   p_update(1) default 'N',
                 p_bdcgrp(12) default 'MM_MASTER'.
    selection-screen end of block bl1.
    data: v_chr_opengrp type c,
          r_matnr like mara-matnr,
          r_werks like marc-werks,
          v_str_fname   type string.
    data : begin of bdc_itab occurs 0.
            include structure bdcdata.
    data : end of bdc_itab.
    data: begin of messtab occurs 0.
            include structure bdcmsgcoll.
    data: end   of messtab.
    data: begin of count,
            inrec(9) type n,               " input I_MATERIAL count
            create(9) type n,              " create count
            error(9) type n,               " error count
            bdc(9) type n,                 " count of BDC creates
          end of count.
    data : begin of i_material occurs 0,
         matnr(018) type c,  "Material number
         mbrsh(001) type c,  "Industry sector
         mtart(004) type c,  "Material type
         werks(004) type c,  "Plant
         lgort(004),
         lgnum(004),
         vkorg(004),
         vtweg(002),
         mtpos_mara(004),
         spart(002),
         dwerk(004),
         taxkm(001),
         versg(001),
       MTPOS(004),
         maktx(040) type c,  "Material description
         meins(003) type c,  "Base unit of measure
        matkl(009) type c,  "Material group
        bismt(018),         "old material code
        brgew(017) type c,  "Gross weight
        gewei(003) type c,  "Weight unit
        ntgew(017) type c,  "Net weight
        magrv(004) type c,  "Matl grp pack matls
        tragr(004),         "
        ladgr(004),
        prctr(007),
      EKGRP(004),
      EKWSL(004),
        chap(012),
        mattype(001),
        nogrs(001),
        outmat(018),
        valid(010),
        curr(005),
        netdeal(018),
        asess(018),
        disgr(004),
        dismm(002) type c,
        dispo(003),
       LGORT(004),
        disls(002),
        maabc(001),
       lgpro(004),
       webaz(003),
       lgfsb(004),
        plifz(003),
       STRGR(002),
        fhori(003),
        sfepr(004),
        fevor(003),
        sfcpf(006),
        beskz(001),
       perkz(001),
      VRMOD(001),
      VINT1(003),
      VINT2(003),
      ALTSL(001),
      SBDKZ(001),
      FERVOR(002),
      SFCPF(006),
       stprs(015),
      AWSLS(006),
       mtvfp(002),
    STGRP(002),
    *PRCTR(007),
      bklas(004),
      vprsv(001),
      peinh(006),
    *EKALR(015),
      verpr(015),
      hrkft(002),
    *HKMAT,
    kosgr(010),
    *LOSGR(018),
    end of i_material.
    at selection-screen on value-request for p_fname.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          program_name  = 'Z_MM_MATERIAL_UPLOAD'
          dynpro_number = '1000'
          field_name    = 'P_FNAME'
        changing
          file_name     = p_fname.
    at selection-screen on value-request for p_lgort.
    call function 'KD_GET_FILENAME_ON_F4'
        exporting
          program_name  = 'ZMATERIAL'
          dynpro_number = '1000'
          field_name    = 'P_FNAME'
        changing
          file_name     = p_lgort.
    start-of-selection.
      if p_fname is initial.
        message i016(rp) with 'Please enter a file name'.
        leave list-processing.
      else.
        move p_fname to  v_str_fname.
      endif.
      call function 'GUI_UPLOAD'
        exporting
          filetype                = 'ASC'
          filename                = v_str_fname
          has_field_separator     = 'X'
        tables
          data_tab                = i_material
        exceptions
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          others                  = 17.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      loop at i_material.
      r_matnr = i_material-matnr.
        r_werks = i_material-werks.
        add 1 to count-inrec.
        perform bdc_dynpro      using 'SAPLMGMM' '0060'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMMG1-MATNR'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'RMMG1-MATNR'
                                      i_material-matnr.
        perform bdc_field       using 'RMMG1-MTART'
                                      i_material-mtart.
        perform bdc_field       using 'RMMG1-MBRSH'
                                      i_material-mbrsh.
        perform bdc_dynpro using 'SAPLMGMM' '0070'.
    perform bdc_field using 'BDC_CURSOR'
    'MSICHTAUSW-DYTXT(17)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
    'X'.
    *PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(07)'
    *'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(08)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(06)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(09)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(10)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(11)'
    'X'.
    *PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(12)'
    *'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(14)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(16)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(17)'
    'X'.
    perform bdc_field using 'BDC_OKCODE' '=P+'.
    perform bdc_dynpro using 'SAPLMGMM' '0070'.
    perform bdc_field using 'BDC_CURSOR'
    'MSICHTAUSW-DYTXT(07)'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
    'X'.
    perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
    'X'.
        perform bdc_dynpro      using 'SAPLMGMM' '0080'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMMG1-LGNUM'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=ENTR'.
        perform bdc_field       using 'RMMG1-WERKS'
                                      i_material-werks.
        perform bdc_field       using 'RMMG1-LGORT'
                                      i_material-lgort.
        perform bdc_field       using 'RMMG1-LGNUM'
                                      i_material-lgnum.
        perform bdc_field       using 'RMMG1-VKORG'
                                      i_material-vkorg.
        perform bdc_field       using 'RMMG1-VTWEG'
                                      i_material-vtweg.
        perform bdc_dynpro      using 'SAPLMGMM' '4004'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'MAKT-MAKTX'
                                      i_material-maktx.
        perform bdc_field       using 'MARA-MEINS'
                                      i_material-meins.
        perform bdc_field       using 'MARA-MATKL'
                                      i_material-matkl.
        perform bdc_field       using 'MARA-BISMT'
                                      i_material-bismt.
        perform bdc_field       using 'MARA-BRGEW'
                                      i_material-brgew.
        perform bdc_field       using 'MARA-GEWEI'
                                      i_material-gewei.
        perform bdc_field       using 'MARA-NTGEW'
                                      i_material-ntgew.
        perform bdc_field       using 'MARA-MAGRV'
                                  i_material-magrv.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                i_material-maktx.
        perform bdc_dynpro      using 'SAPLMGMM' '4000'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'MAKT-MAKTX'
                                      i_material-maktx.
        perform bdc_field       using 'MARA-MEINS'
                                      i_material-meins.
        perform bdc_field       using 'MARA-MATKL'
                                      i_material-matkl.
         perform bdc_field       using 'MARA-SPART'
                                      i_material-spart.
        perform bdc_field       using 'MVKE-DWERK'
                                      i_material-dwerk.
        perform bdc_field       using 'BDC_CURSOR'
                                      'MG03STEUER-TAXKM(01)'.
        perform bdc_field       using 'MG03STEUER-TAXKM(01)'
                                      i_material-taxkm.
        perform bdc_dynpro      using 'SAPLMGMM' '4200'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'MAKT-MAKTX'
                                      i_material-maktx.
       perform bdc_dynpro      using 'SAPLMGMM' '4000'.
       perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
       perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                 i_material-maktx.
    perform bdc_field       using 'MARA-MTPOS_MARA'
                                  i_material-mtpos_mara.
    perform bdc_field       using 'MVKE-versg'
                                  i_material-versg.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
        perform bdc_field       using 'MARA-BRGEW'
                                      i_material-brgew.
        perform bdc_field       using 'MARA-GEWEI'
                                      i_material-gewei.
        perform bdc_field       using 'MARA-NTGEW'
                                      i_material-ntgew.
        perform bdc_field       using 'BDC_CURSOR'
                                  'MARA-MAGRV'.
      perform bdc_field       using 'MARA-MAGRV'
                                  i_material-magrv.
    perform bdc_field       using 'MARA-TRAGR'
                                  i_material-tragr.
    perform bdc_field       using 'MARC-LADGR'
                                  i_material-ladgr.
    perform bdc_field       using 'MARC-PRCTR'
                                  i_material-prctr.
    perform bdc_field       using 'MARC-MTVFP'
                                 i_material-mtvfp.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  i_material-maktx.
    perform bdc_field       using 'BDC_CURSOR'
                                  'J_1IASSVAL-J_1IVALASS'.
    perform bdc_field       using 'J_1IMTCHID-J_1ICHID'
                                  i_material-chap.
    perform bdc_field       using 'J_1IMTCHID-J_1ISUBIND'
                                 'X'..
    perform bdc_field       using 'J_1IMTCHID-J_1ICAPIND'
                                 i_material-mattype.
    perform bdc_field       using 'J_1IMTCHID-J_1IGRXREF'
                                  i_material-nogrs.
    perform bdc_field       using 'J_1IMODDET-J_1IMOOM'
                                  i_material-outmat.
    perform bdc_field       using 'J_1IASSVAL-J_1IFRDATE'
                                  i_material-valid.
    perform bdc_field       using 'J_1IASSVAL-J_1IWAERS'
                                  i_material-curr.
    perform bdc_field       using 'J_1IASSVAL-J_1IVALNDP'
                                 i_material-netdeal.
    perform bdc_field       using 'J_1IASSVAL-J_1IVALASS'
                                  i_material-asess.
    *perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    *perform bdc_field       using 'BDC_OKCODE'
                                 '/00'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'MAKT-MAKTX'.
    *perform bdc_field       using 'MAKT-MAKTX'
                                 I_MATERIAL-MAKTX.
    *perform bdc_field       using 'MVKE-MTPOS'
                                 I_MATERIAL-MTPOS.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  'ENTR'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  i_material-maktx.
    perform bdc_field       using 'MARA-MEINS'
                                  i_material-meins.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MARC-DISMM'.
    perform bdc_field       using 'MARC-DISMM'
                                  i_material-dismm.
    perform bdc_field       using 'MARC-DISPO'
                                  i_material-dispo.
    perform bdc_field       using 'MARC-DISLS'
                                  i_material-disls.
    perform bdc_field       using 'MARC-MAABC'
                                  i_material-maabc.
    perform bdc_field       using 'MARC-DISGR'
                                  i_material-disgr.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
    perform bdc_field       using 'MAKT-MAKTX'
                                  i_material-maktx.
    perform bdc_field       using 'MARC-FHORI'
                                  i_material-fhori.
    perform bdc_field       using 'MARC-LGPRO'
                                  i_material-lgpro.
    perform bdc_field       using 'MARC-LGFSB'
                                  i_material-lgfsb.
    perform bdc_field       using 'MARC-PLIFZ'
                                      i_material-plifz.
    *perform bdc_field       using 'MARC-STRGR'
                               I_MATERIAL-STRGR.
    perform bdc_field       using  'MARC-BESKZ'
                                 i_material-beskz.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    *perform bdc_field       using 'MARC-STRGR'
                               I_MATERIAL-STRGR.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
       perform bdc_field       using 'MARC-SAUFT'
                                  'X'.
    perform bdc_field       using 'MARC-SFEPR'
                                  i_material-sfepr.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_field       using 'MArc-FEVOR'
                                  i_material-fevor.
    perform bdc_field       using 'MARC-SFCPF'
                                  i_material-sfcpf.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
                                   perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                    i_material-maktx.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MBEW-BKLAS'.
    perform bdc_field       using 'MBEW-BKLAS'
                                  i_material-bklas.
    perform bdc_field       using 'MBEW-VPRSV'
                                  i_material-vprsv.
    perform bdc_field       using 'MBEW-PEINH'
                                  i_material-peinh.
    perform bdc_field       using 'MBEW-STPRS'
                                  i_material-stprs.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    perform bdc_field       using 'Mbew-kosgr'
                                   i_material-kosgr.
    perform bdc_field       using 'Mbew-HKMAT'
                                 'X'.
    perform bdc_field       using 'Mbew-HRKFT'
                                  i_material-hrkft.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    perform bdc_field       using 'MAKT-MAKTX'
                                   i_material-maktx.
    *perform bdc_field       using 'Mbew-KOSGR'
                                 I_MATERIAL-KOSGR.
        perform bdc_dynpro      using 'SAPLSPO1' '0300'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=YES'.
        perform post_transaction.
        refresh bdc_itab.
        clear   bdc_itab.
      endloop.
    end-of-selection.
      perform finalization.
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdc_itab.
      bdc_itab-program  = program.
      bdc_itab-dynpro   = dynpro.
      bdc_itab-dynbegin = 'X'.
      append bdc_itab.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> ''.
        clear bdc_itab.
        bdc_itab-fnam = fnam.
        bdc_itab-fval = fval.
        append bdc_itab.
      endif.
    endform.                    "bdc_field
    *&      Form  POST_TRANSACTION
    form post_transaction.
      refresh messtab.
      clear   messtab.
      call transaction 'MM01' using bdc_itab
                  mode p_update
                update 'S'
              messages into messtab.
    submit zrpt_plantext with flatfile = p_lgort
                          with p_matnr = r_matnr
                          with p_werks = r_werks and return.
      read table messtab with key msgtyp = 'E'.
      if sy-subrc eq 0.
        perform process_error_messages.
        add 1 to count-bdc.
        if v_chr_opengrp is initial.
          perform bdc_open_group.
        endif.
        call function 'BDC_INSERT'
          exporting
            tcode          = 'MM01'
          tables
            dynprotab      = bdc_itab
          exceptions
            internal_error = 1
            not_open       = 2
            queue_error    = 3
            tcode_invalid  = 4
            others         = 5.
        if sy-subrc <> 0.
          case sy-subrc.
            when 1.
              write: / 'Internal error'.
            when 2.
              write: / 'Not open error'.
            when 3.
              write: / 'queue error'.
            when 4.
              write: / 'tcode invalid error'.
            when others.
              write: / 'other error'.
          endcase.
        endif.
      else.
        add +1 to count-create.
        format intensified off.
        format color col_normal.
        format color col_normal off.
      endif.
      clear   bdc_itab.
      refresh bdc_itab.
    endform.                               " POST_TRANSACTION
    *&      Form  PROCESS_ERROR_MESSAGES
    form process_error_messages.
      data: begin of loc_aux_message.
              include structure message.
      data: end of loc_aux_message.
      data : msgno type sy-msgno.
      loop at messtab.
        move messtab-msgnr to msgno.
        call function 'WRITE_MESSAGE'
          exporting
            msgid  = messtab-msgid
            msgno  = msgno
            msgty  = messtab-msgtyp
            msgv1  = messtab-msgv1
            msgv2  = messtab-msgv2
            msgv3  = messtab-msgv3
            msgv4  = messtab-msgv4
          importing
            messg  = loc_aux_message
          exceptions
            others = 1.
        if sy-subrc eq 0.
          format color col_negative on.
          write: /10 i_material-matnr.
          write: /10 loc_aux_message.
          format color col_negative off.
        else.
          format color col_negative on.
          write: /10 i_material-matnr.
          write: / 'Error creating message'.
          format color col_negative off.
          exit.
        endif.
      endloop.
    endform.                               " PROCESS_ERROR_MESSAGES
    *&      Form  BDC_OPEN_GROUP
    form bdc_open_group.
      call function 'BDC_OPEN_GROUP'
        exporting
          client              = sy-mandt
          group               = p_bdcgrp
          holddate            = sy-datum
          keep                = 'X'
          user                = sy-uname
        exceptions
          client_invalid      = 1
          destination_invalid = 2
          group_invalid       = 3
          group_is_locked     = 4
          holddate_invalid    = 5
          internal_error      = 6
          queue_error         = 7
          running             = 8
          system_lock_error   = 9
          user_invalid        = 10
          others              = 11.
      if sy-subrc eq 0.
        v_chr_opengrp = 'X'.
      endif.
    endform.                               " BDC_OPEN_GROUP
    *&      Form  FINALIZATION
    form finalization.
      if v_chr_opengrp = 'X'.
        call function 'BDC_CLOSE_GROUP'
          exceptions
            not_open    = 1
            queue_error = 2
            others      = 3.
      endif.
      get time.
      skip 2.
      write: / 'Time', sy-uzeit.
      skip.
      format color col_total on.
      write: / 'Total Records: ',           40 count-inrec.
      write: / 'PERNR not of Emp Group 6 ', 40 count-error.
      write: / 'Records Created: ',         40 count-create.
      write: / 'BDC Create in group: ',     40 count-bdc.
      if v_chr_opengrp = 'X'.
        skip 1.
        format intensified on.
        format color col_negative on.
        write: / 'PLEASE USE TRANSACTION "SM35" ',
                 'TO PROCESS THE GENERATED BDC SESSION ... ',
                 p_bdcgrp.
      endif.
    endform.                               " FINALIZATION

  • BDC error messages

    Hi Guys
         how can we trab error messages in BDC . We make use of BDCMSGCOLL .
    can anybody expalin me how can we capture them , I have to display the messages after running the BDC. i am running BDC on transaction sm30 .. view name is vusrextid. Add new enties ,type is NT and put external users as asian\hhh
    then SAPUSER  then click activate and lastly click save . Waiting for reply.

    Hi,
    Use:
    internal table to handle messages
    DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : V_MESG(50).
    CALL TRANSACTION 'MM01' USING IT_BDCDATA MODE 'N' UPDATE 'S'
                                       MESSAGES INTO IT_MESSAGES.
    all messages wiull come into it_messages and display them like:
    FORM ERROR_MESSAGES.
        CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
                 ID        = SY-MSGID
                 LANG      = '-D'
            IMPORTING
                 MSG       = V_MESG
            EXCEPTIONS
                 NOT_FOUND = 1
                 OTHERS    = 2.
      LOOP AT IT_MESSAGES WHERE MSGTYP = 'E'.
        WRITE : / 'Message :'(I06) ,V_MESG.
        CLEAR IT_MESSAGES.
      ENDLOOP.
    reward if useful
    regards,
    Anji

  • BDC error message

    Hello,
    I am uploading data for FB05 using bdc for 10 customers.but if i get error for the 1st customer it stops further processing for other customer.Can i do something like it gives list of errors for customers which are having fault other should be uploaded finely.i am using call transaction for this.

    hi,
    check this piece of code..
    *Calling Transaction FB50 .
        call transaction 'FB50' using BDCDATA mode 'N' messages into MESSTAB.
    *Reading Internal Table MESSTAB.
        read table MESSTAB.
        if SY-SUBRC = 0.
    *Selecting TEXT From Table T100 Into Variable V_TEXT.
          select single TEXT into V_TEXT from T100  where SPRSL = MESSTAB-MSGSPRA
                                      and   ARBGB = MESSTAB-MSGID
                                      and   MSGNR = MESSTAB-MSGNR.
          if SY-SUBRC = 0.
            V_LMSTRING = V_TEXT.
            if V_LMSTRING cs '&1'.
              replace '&1' with MESSTAB-MSGV1 into V_LMSTRING.
              replace '&2' with MESSTAB-MSGV2 into V_LMSTRING.
              replace '&3' with MESSTAB-MSGV3 into V_LMSTRING.
              replace '&4' with MESSTAB-MSGV4 into V_LMSTRING.
            else.
              replace '&' with MESSTAB-MSGV1 into V_LMSTRING.
              replace '&' with MESSTAB-MSGV2 into V_LMSTRING.
              replace '&' with MESSTAB-MSGV3 into V_LMSTRING.
              replace '&' with MESSTAB-MSGV4 into V_LMSTRING.
            endif.
            condense V_LMSTRING.
    *Checking The Message Type and Display The Message Accordingly.
            if MESSTAB-MSGTYP = 'E'.
              V_ERROR = V_ERROR + C_INCREMENT.
              IT_RESULT-MEGTYPE = 'Error'.
              IT_RESULT-MESSAGE = V_LMSTRING.
            endif.
            if MESSTAB-MSGTYP = 'S'.
              V_SUCCESS = V_SUCCESS + C_INCREMENT.
              IT_RESULT-MEGTYPE = 'Successful'.
              IT_RESULT-MESSAGE = V_LMSTRING.
            endif.
          else.
         write: / MESSTAB.
          endif.
        endif.
    *Appending Table IT_RESULT.
        append IT_RESULT.
    *Delete Rows of  Internal Table MESSTAB.
        refresh MESSTAB.
    *Clear Header of MESSTAB.
        clear MESSTAB.
      endloop.
    thanks
    Ashu SIngh

Maybe you are looking for

  • I didn't safely eject my external hard-drive and now my files are not showing up on my other computer?

    I didn't safely eject my external hard-drive as my imac was in sleep mode and I thought it was shut-down. Now I have turned up to uni and plugged my hard-drive into the uni computers (apple) and the word document I was working on last night (before m

  • Problem in file and socket fd

    Hi I am using TCP sockets for communication.I create a server which blocks on the accept method to listen for new connections. The problem is that if I open a file descriptor in the program ,then the server does not block on accept method but instead

  • Pin a folder of videos to home screen?

    My 30-year-old son, who has autism and is nonverbal, has  used iPad since it first came out. Right now he has the iPad Air.  He takes it to day program, where staff are often not tech-savvy. It's a shame, because more individuals are going to be show

  • How can I filter a table by Calendar weeks

    I have a table categorised by Category and Name as my primary. I have added a column with a date range per calendar week. How can I best setup the table where i can view it in as per schedule calendar week. Should i create a second table and access t

  • Very urgent-----help in performance tuning

    hai all, I had used inner join for getting data from 5 tables. performance is very low in this case. now i want to increase the performance. how can i do this. coding for the select statement is ...... SELECT agpnr bname1 bname2 bpstlz bort01 bstras