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

error msgs not coming to bdcmsgcoll internal table

Hi experts,

In BDC while using call transaction method Error messages not coming to BDCMSGCOLL internal table loop at fallowing code and tell me if you find any mistake if possible.

r.txt.zip (755 B)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Dec 25, 2013 at 12:35 PM

    Please check in the table msgtb1.

    Add a comment
    10|10000 characters needed characters exceeded

    • Can you please give like this.

      Redfine your defeniton as

      *Used to stores error information from CALL TRANSACTION Function Module

      data: begin of messtab occurs 0.

      include structure bdcmsgcoll.

      data: end of messtab.


      data: begin of msgtb1 occurs 0.

      include structure bdcmsgcoll.

      data: end of msgtb1.

      CALL TRANSACTION 'SM34' USING bdcdata_tab

      MODE 'S' UPDATE 'S' MESSAGES INTO msgtb1.

  • Posted on Dec 25, 2013 at 01:12 PM

    Also, make sure taht you are not refreshing the table msgtb1 inside your loop.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 25, 2013 at 01:28 PM

    Hi Rajendra,

    i have seen your recording , and have done necessary changes, just do one thing more here

    In place of field1, field2 and field3, put your primary data field through you wants to see error or success

    messages, please do it .It will fulfill your requirements.

    report ZFB01_POST_DOCUMENT

    no standard page heading line-size 255.

    TYPE-POOLS : TRUXS.

    TYPES: BEGIN OF ty_input,

    (Here just change your all input fields)

    here are the sample how you have to write your fields, whose values is to be filled through BDC.

    Please do it,

    bldat(10) TYPE c, "Document Date in Document

    blart(02) TYPE c, "Document Type

    bukrs(04) TYPE c, "Company Code

    budat(10) TYPE c, "Posting Date in the Document

    monat(2) TYPE c, "Period

    waers(5) TYPE c, "Currency key

    xblnr(16) TYPE c, "REFERENCE NUM

    newbs(02) TYPE c, "Posting Key for the Next Line Item

    newko(17) TYPE c, "Account or Matchcode for the Next Line Item

    wrbtr(18) TYPE c, "Amount

    gsber(04) TYPE c, "Business Area

    END OF ty_input.

    DATA : BEGIN OF options.

    INCLUDE STRUCTURE ctu_params.

    DATA : BEGIN OF options.

    INCLUDE STRUCTURE ctu_params.

    DATA : END OF options.DATA: i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,

    l_message LIKE bapiret2-message.

    DATA: p_mode TYPE c.DATA BEGIN OF it_error OCCURS 1.DATA : text(100) TYPE c.DATA END OF it_error.DATA BEGIN OF it_success OCCURS 1.DATA: text(100) TYPE c.DATA END OF it_success.DATA: it_raw TYPE truxs_t_text_data.

    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.SELECTION-SCREEN SKIP 1.*parameters: Customer radiobutton group G1,* Vendor radiobutton group G1.PARAMETERS : p_path LIKE rlgrap-filename OBLIGATORY.SELECTION-SCREEN : END OF BLOCK b1.SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.SELECTION-SCREEN SKIP 1.PARAMETERS : mode_a RADIOBUTTON GROUP r1,

    mode_n RADIOBUTTON GROUP r1.

    SELECTION-SCREEN : END OF BLOCK b2.*--------------------------------------------------------------------** AT SELECTION SCREEN*--------------------------------------------------------------------*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. CALL FUNCTION 'F4_FILENAME' EXPORTING

    field_name = 'P_FILE '

    IMPORTING

    file_name = p_path.

    START-OF-SELECTION. CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' EXPORTING

    i_line_header = 'X'

    i_tab_raw_data = it_raw " WORK TABLE

    i_filename = p_path

    TABLES

    i_tab_converted_data = it_input[] "ACTUAL DATA

    EXCEPTIONS

    conversion_failed = 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.

    LOOP AT it_input.

    IF sy-tabix EQ 1 . "for first row

    CONTINUE.

    ENDIF.

    ENDLOOP.

    *--------------------------------------------------------------------*\

    * start of selection

    *--------------------------------------------------------------------*

    START-OF-SELECTION.

    PERFORM upload_data.

    * Report for success

    PERFORM success_text.

    * Report for Error

    PERFORM error_text.

    END-OF-SELECTION.

    *

    * PERFORM bdc_transaction USING 'FB01'.

    *

    * PERFORM close_group.

    *&---------------------------------------------------------------------*

    *& Form UPLOAD_DATA

    *&---------------------------------------------------------------------*

    * text

    *----------------------------------------------------------------------*

    * --> p1 text

    * <-- p2 text

    *----------------------------------------------------------------------*

    form UPLOAD_DATA .

    * PERFORM open_group.

    IF mode_a EQ 'X'.

    p_mode = 'A'.

    ELSEIF mode_n EQ 'X'.

    p_mode = 'N'.

    ENDIF.

    options-defsize = 'X'.

    options-updmode = ''.

    options-dismode = p_mode.

    LOOP AT it_input INTO wa_input.

    PERFORM zz1bdc_dynpro USING 'SAPMSVMA' '0200'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'VCLDIR-VCLNAME'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=UPD'.

    PERFORM zz1bdc_field USING 'VCLDIR-VCLNAME'

    'VC_T012'."VCLNAME_001.

    PERFORM zz1bdc_dynpro USING 'SAPLSVIX' '0100'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'D0100_FIELD_TAB-LOWER_LIMIT(01)'.

    PERFORM zz1bdc_field USING 'D0100_FIELD_TAB-LOWER_LIMIT(01)' '0001'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=OKAY'.

    PERFORM zz1bdc_dynpro USING 'SAPLFHBANKC' '0100'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'V_T012-BUKRS'.

    PERFORM zz1bdc_field USING 'V_T012-BUKRS'

    'AP01'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=NEWL'.

    PERFORM zz1bdc_dynpro USING 'SAPLFHBANKC' '0101'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'V_T012-BANKL'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=SAVE'.

    PERFORM zz1bdc_field USING 'V_T012-HBKID'

    wa1-f3." HBKID_002.

    PERFORM zz1bdc_field USING 'V_T012-BANKS'

    wa1-f4. " BANKS_003.

    PERFORM zz1bdc_field USING 'V_T012-BANKL'

    wa1-f5." BANKL_004.

    PERFORM zz1bdc_dynpro USING 'SAPLBANK' '0100'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'BNKA-BNKLZ'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=ENTR'.

    PERFORM zz1bdc_field USING 'BNKA-BANKA'

    wa1-f6." BANKA_005.

    PERFORM zz1bdc_field USING 'BNKA-PROVZ'

    wa1-f7."

    PERFORM zz1bdc_field USING 'BNKA-STRAS'

    wa1-f8."

    PERFORM zz1bdc_field USING 'BNKA-ORT01'

    wa1-f9."

    PERFORM zz1bdc_field USING 'BNKA-BRNCH'

    wa1-f10."

    PERFORM zz1bdc_field USING 'BNKA-SWIFT'

    wa1-f11."

    PERFORM zz1bdc_field USING 'BNKA-BGRUP'

    wa1-f12."

    PERFORM zz1bdc_field USING 'BNKA-XPGRO'

    wa1-f13."

    PERFORM zz1bdc_field USING 'BNKA-BNKLZ'

    wa1-f14."

    PERFORM zz1bdc_dynpro USING 'SAPLSTRD' '0300'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'KO008-TRKORR'.

    PERFORM zz1bdc_field USING 'KO008-TRKORR'

    'IDSK901135'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=LOCK'.

    PERFORM zz1bdc_dynpro USING 'SAPLFHBANKC' '0101'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'V_T012-BANKL'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=UEBE'.

    PERFORM zz1bdc_dynpro USING 'SAPLFHBANKC' '0100'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'V_T012-BUKRS'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '=BACK'.

    PERFORM zz1bdc_dynpro USING 'SAPMSVMA' '0200'.

    PERFORM zz1bdc_field USING 'BDC_OKCODE'

    '/EBACK'.

    PERFORM zz1bdc_field USING 'BDC_CURSOR'

    'VCLDIR-VCLNAME'.

    wa_ctuparams-racommit = 'X'.

    wa_ctuparams-dismode = 'A'.

    wa_ctuparams-updmode = 'S'.

    CALL TRANSACTION 'FB01' USING bdcdata

    OPTIONS FROM options

    MESSAGES INTO i_messtab.

    IF SY-SUBRC NE 0. CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'

    EXPORTING

    id = sy-msgid

    number = sy-msgno

    language = sy-langu

    textformat = 'ASC'

    message_v1 = sy-msgv1

    message_v2 = sy-msgv2

    message_v3 = sy-msgv3

    message_v4 = sy-msgv4

    IMPORTING

    message = l_message.

    .

    CONCATENATE l_message '-' wa_input-field1 wa_input-field2 wa_input-field3 INTO it_error-text

    SEPARATED BY ' '.

    APPEND it_error.

    ELSE.

    CONCATENATE 'DATA UPLOADED SUCCESSFULLY :' wa_input-field1 wa_input-field2 wa_input-field3

    INTO it_success-text SEPARATED BY ' '.

    APPEND it_success.

    ENDIF.

    REFRESH bdcdata.

    CLEAR: wa_input,l_message.

    ENDLOOP.

    ***ENDLOOP.

    endform.

    " UPLOAD_DATA

    FORM success_text .

    LOOP AT it_success. AT FIRST.

    WRITE :/10 'Following records successfully uploaded'.

    ULINE.

    ENDAT. WRITE :/10 it_success-text. ENDLOOP.

    ENDFORM.

    FORM error_text .

    LOOP AT it_error. AT FIRST.

    WRITE :/10 'Following records are not uploaded'.

    ULINE.

    ENDAT.

    WRITE :/10 it_error-text.

    ENDLOOP.ENDFORM.
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 25, 2013 at 01:40 PM

    Hi Rajendra,

    Please Make sure that you are refreshing your internal table BDCDATA within the loop.

    For example :

    Loop at bdcdata.

    call transaction -------

    refresh bdcdata.

    endloop.

    Thanks

    Pavan.N

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 04:10 AM

    i refresh the data but still problem didn't resolved

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 04:32 AM

    hi,

    you just specify like this program u can solve ur problem.

    LOOP AT IT INTO WA.
    refresh it_bdcdata.
    perform bdc_dynpro using 'SAPMF02B' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'BNKA-BANKL'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'BNKA-BANKS'
    WA-banks.
    perform bdc_field using 'BNKA-BANKL'
    WA-bankl.
    perform bdc_dynpro using 'SAPMF02B' '0110'.
    perform bdc_field using 'BDC_CURSOR'
    WA-brnch.
    perform bdc_field using 'BDC_OKCODE'
    '=BACK'.
    perform bdc_field using 'BNKA-BANKA'
    WA-banka.
    perform bdc_field using 'BNKA-STRAS'
    WA-stras.
    perform bdc_field using 'BNKA-ORT01'
    WA-ort01.
    perform bdc_field using 'BNKA-BRNCH'
    WA-brnch.
    perform bdc_dynpro using 'SAPLSPO1' '0100'.
    perform bdc_field using 'BDC_OKCODE'
    '=YES'.
    call TRANSACTION 'FI01' using IT_BDCDATA
    mode 'A' update 'S' MESSAGES INTO it_bdcmsgcoll.
    *perform bdc_transaction using 'FI01'.

    *perform close_group.
    CLEAR WA.
    ENDLOOP.
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
    CLEAR wa_BDCDATA.
    wa_BDCDATA-PROGRAM = PROGRAM.
    wa_BDCDATA-DYNPRO = DYNPRO.
    wa_BDCDATA-DYNBEGIN = 'X'.
    APPEND wa_BDCDATA to it_bdcdata.
    ENDFORM.

    *----------------------------------------------------------------------*
    * Insert field *
    *----------------------------------------------------------------------*
    FORM BDC_FIELD USING FNAM FVAL.
    * IF FVAL <> NODATA.
    CLEAR wa_BDCDATA.
    wa_BDCDATA-FNAM = FNAM.
    wa_BDCDATA-FVAL = FVAL.
    APPEND wa_BDCDATA to it_bdcdata.
    * ENDIF.
    ENDFORM.




    Regards,

    gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 04:55 AM

    Sorry guy's even the data is not updated in NODISPLAY mode

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Rajendra,

      Try with this.

      CALL TRANSACTION 'SM34' USING bdcdata MODE 'N'
      UPDATE 'A'
      MESSAGES INTO messtab.

      LOOP AT messtab WHERE msgtyp = 'E'.
      IF messtab-msgtyp = 'E'.

      MOVE:messtab-msgv1 TO gv_var1,
      messtab-msgv2 TO gv_var2,
      messtab-msgv3 TO gv_var3,
      messtab-msgv4 TO gv_var4.
      CALL FUNCTION 'MESSAGE_PREPARE'
      EXPORTING
      language = 'E'
      msg_id = messtab-msgid
      msg_no = messtab-msgnr
      msg_var1 = gv_var1
      msg_var2 = gv_var2
      msg_var3 = gv_var3
      msg_var4 = gv_var4
      IMPORTING
      msg_text = gv_msg_txt
      EXCEPTIONS
      function_not_completed = 1
      message_not_found = 2
      OTHERS = 3.

      CONCATENATE messtab-msgtyp
      gv_msg_txt INTO wa_line SEPARATED BY c_con_cret .
      APPEND wa_line TO i_line.
      CLEAR:wa_line .
      endif.
      endloop.

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.