Reg BDC

Hi,
    In BDC, Call transaction method how to store error in bdcmsgcoll table.
Thank you,

Hi,
when you write this automatically the error messages will be populated in table  ITAB , you can loop at that table and get the messages
DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
CALL TRANSACTION 'SE38'  USING BDCDATA  MODE 'N'
                         MESSAGES INTO ITAB.
You can loop at the messages and get the description
loop at itab.
CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
       EXPORTING
            LANGU = SY-LANGU
            MSGID = itab-MSGID
            MSGNO = itab-MSGNO
            MSGV1 = itab-MSGV1
            MSGV2 = itab-MSGV2
            MSGV3 = itab-MSGV3
            MSGV4 = itab-MSGV4
       IMPORTING
            TEXT  = ERR_MSG.
write : ERR_MSG.
endloop.
Message was edited by:
        Chandrasekhar Jagarlamudi

Similar Messages

  • Reg : BDC issue while updating infotype 40 inside BADI class method

    Hi Friends,
         Actually in my badi class, there is a method where i need to save the infotype fields including comment fields.. So with BDC recording i recorded screen fields and passing the pernr internal table values to recorded pernr values.. by doing this im getting error and so BDC is not upadting the data.. moreover if i pass directly pernr number within single quotes, BDC is working fine and data is getting updated..
    bdc_field        'RP50G-PERNR'   pernr.  --> Error Message while calling transaction through BDC
    bdc_field        'RP50G-PERNR'   '00001234'  ---> updating successfully..
    1. Tell me whether the issue is with BADI or wat ? means we cant able to use BDC inside badi ?
    2. I also tried changing my internal table value of pernr to type 'C' of length 8.. eventhough its showing error..
    Please tell me what i need to do .... ?

    Hi  Dilek Ersoz Adak ,
      I also tried with that, but getting same error..  Below is my error im getting while updating BDC through call transaction,
    1     PA30     SAPMP50A     1000     E     K     PBAS_SERVICE     001     HRADMIN     EPPRELE 00000121     HRAdministrator          CTU     RP50G-PERNR
              Person is treated already by the HR Administrator

  • Reg BDC rec code

    hi guru's,
    i have done with the bdc recording.
    now to handle the enter code ( i.e.. in my actual target program while executing it, the pressing of enter in the transaction screen should not be there).
    What ever the default views selected in trn mm03 should be dynamically done without user interface.. Pressing of enter should also be avoided.
    here is my code snippet.
    perform bdc_dynpro      using 'SAPLMGMM' '0060'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'RMMG1-MATNR'
                                  wa_final-matnr.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(02)'.
    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_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(15)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(15)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(13)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MSICHTAUSW-KZSEL(13)'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DEF_SAVE'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'USRM1-AAUSW'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DEF_SKIP'.
    perform bdc_field       using 'USRM1-AAUSW'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMGMM' '0070'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'USRM1-AAUSW'
                                  'X'.
    perform bdc_dynpro      using 'SAPLMGMM' '0080'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-WERKS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DEF_SAVE'.
    perform bdc_field       using 'RMMG1-WERKS'
                                  plant.
    perform bdc_dynpro      using 'SAPLMGMM' '0080'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-WERKS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'RMMG1-WERKS'
                                  'Z201'.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_dynpro      using 'SAPLMGMM' '4004'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_dynpro      using 'SAPLMGMM' '4000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'MM03'.
    please help me.
    *HOW TO HANDLE THE ENTER CODE.
    WHAT CHANGES SHOULD I MAKE IN THE ABOVE CODE AND WHAT ARE THE CORRESPONDING DATA DECLARATIONS TO BE MADE.*

    See The sample code
    It consist of Item data and Header data .
    REPORT zfv11
           NO STANDARD PAGE HEADING LINE-SIZE 255.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    TABLES : t100.
    DATA: BEGIN OF record OCCURS 0,
    data element: KSCHA
            kschl(004),               "Condition Type
    data element: SELKZ_LIST
          selkz(001),
    data element: WERKS_D
            werks(004),               "Plant
    data element: ELIFN
            lifnr(010),               "Vendor
    data element: MATNR
            matnr(018),               "Material No.
    data element: KBETR_KOND
            kbetr(016),               "Amount
    data element: KODATAB
            datab(010),               "Condition Validity Date from
    data element: KODATBI
            datbi(010),               "Condition Validity To
    data element: MWSKZ
            mwsk1(002),
          END OF record.
    DATA : BEGIN OF it_new OCCURS 0,                    " Internal Table for Header Data
           kschl(004),
           werks(004),
           lifnr(010),
           END OF it_new.
    DATA : BEGIN OF it_item OCCURS 0,                  " Internal table for Item Data
          werks(004),
          lifnr(010),
          matnr(018),
          kbetr(016),
          datab(010),
          datbi(010),
          mwsk1(002),
          END OF it_item.
    DATA : cnt(2) TYPE n,
           fld(25) TYPE c.
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    DATA : n TYPE n.
    DATA:
         BEGIN OF t_data OCCURS 0,
               data TYPE string,
         END   OF t_data.
    DATA:BEGIN OF it_mess OCCURS 0,
      msgtyp(5),
       lms(200),
       msgv1(50),
        END OF it_mess.
    DATA : p_mode    TYPE c.
    DATA:it_msgtab TYPE STANDARD TABLE OF  bdcmsgcoll WITH HEADER LINE,
       it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
    DATA :  l_mstring(150).
    DATA : BEGIN OF bdcdata OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdcdata.
    PARAMETERS : p_file1 LIKE rlgrap-filename.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      PERFORM file_selection.
      PERFORM data_upload.
      PERFORM table_control.
      LOOP AT it_new.
        REFRESH bdcdata.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV13A-KSCHL'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RV13A-KSCHL'
                                      it_new-kschl.
        PERFORM bdc_dynpro      USING 'SAPLV14A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV130-SELKZ(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=WEIT'.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KONP-KBETR(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'KOMG-WERKS'
                                      it_new-werks.
        PERFORM bdc_field       USING 'KOMG-LIFNR'
                                      it_new-lifnr.
    DATA: "X(5) TYPE N,
             N(5) TYPE N.
       N = 0.
       LOOP AT it_item.
         N = N + 1.
       ENDLOOP.
       "X = 1.
       CNT = 1.
       DO N TIMES.
         IF CNT > 19.
           perform bdc_field       using 'BDC_OKCODE' 'KOMG-MATNR(01)'.
           perform bdc_field       using 'BDC_OKCODE' '=P+'.
           PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
           CNT = 1.
         ENDIF.
        cnt = 1.
        LOOP AT it_item WHERE werks EQ it_new-werks AND lifnr EQ it_new-lifnr . "FROM x TO x.
          CONCATENATE 'KOMG-MATNR(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-matnr.
          CONCATENATE 'KONP-KBETR(' cnt')' INTO fld.
          PERFORM bdc_field USING fld it_item-kbetr.
          CONCATENATE 'RV13A-DATAB(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-datab.
          CONCATENATE 'RV13A-DATBI(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-datbi.
          CONCATENATE 'KONP-MWSK1(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-mwsk1.
          cnt = cnt + 1.
          if cnt = 20.
            perform bdc_field       using 'BDC_OKCODE' 'KOMG-MATNR(19)'.
            perform bdc_field       using 'BDC_OKCODE' '=P+'.
            PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
            CNT = 1.
           endif.
    CLEAR it_item.
        ENDLOOP.
       ENDDO.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KONP-MWSK1(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SICH'.
        CALL TRANSACTION 'FV11' USING bdcdata MODE 'A'
                                            UPDATE 'S'
                                           MESSAGES  INTO it_msgtab.
        CLEAR bdcdata[].
        PERFORM error.
      ENDLOOP.
           Start new screen   -Subroutine     for screen s                                      *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field        -Subroutine   for field s                                         *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  file_selection
    FORM file_selection .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = 'P_FILE1'
        IMPORTING
          file_name     = p_file1.
    ENDFORM.                    " file_selection
    *&      Form  data_upload
    FORM data_upload .
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
       EXPORTING
        I_FIELD_SEPERATOR        =
           i_line_header            =  'X'
           i_tab_raw_data           =  it_raw
           i_filename               =  p_file1
         TABLES
           i_tab_converted_data     = record
        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.
    ENDFORM.                    " data_upload
    *&      Form  error
    FORM error .
      LOOP AT it_msgtab.
        IF it_msgtab-msgtyp = 'E'.
          SELECT SINGLE * FROM t100 WHERE sprsl = it_msgtab-msgspra
                                    AND   arbgb = it_msgtab-msgid
                                    AND   msgnr = it_msgtab-msgnr.
          IF sy-subrc = 0.
            l_mstring = t100-text.
            IF l_mstring CS '&1'.
              REPLACE '&1' WITH it_msgtab-msgv1 INTO l_mstring.
              REPLACE '&2' WITH it_msgtab-msgv2 INTO l_mstring.
              REPLACE '&3' WITH it_msgtab-msgv3 INTO l_mstring.
              REPLACE '&4' WITH it_msgtab-msgv4 INTO l_mstring.
            ELSE.
              REPLACE '&' WITH it_msgtab-msgv1 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv2 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv3 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv4 INTO l_mstring.
            ENDIF.
            CONDENSE l_mstring.
            it_mess-msgtyp = it_msgtab-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = it_msgtab-msgv1.
            APPEND it_mess.
           WRITE: / it_msgtab-msgtyp, l_mstring(150).
          ELSE.
           WRITE: / it_msgtab.
            it_mess-msgtyp = it_msgtab-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = it_msgtab-msgv1.
            APPEND it_mess.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " error
    *&      Form  table_Control
    FORM table_control .
    SORT record BY lifnr matnr.
      LOOP AT record.
        ON CHANGE OF record-lifnr.
          MOVE-CORRESPONDING record TO it_new.
          APPEND it_new.
        ENDON.
        MOVE-CORRESPONDING record TO it_item.
        APPEND it_item.
      ENDLOOP.
    ENDFORM.                    " table_Control
    Reward if helpful
    Thanks
    Jagadeesh.G

  • Reg BDC Upload prog

    Hi Experts,
    I have one issue in my BDC program, this prog is upload Journal entry. my Journal entry file name is like "378040". its number. its a cost center. now client requirement is different they want in front of the file added four zeros(0000). so now my file name is 0000378040. so how can i added 0000 in front of the file????
    Can u give me suggetion.
    Vishal.

    I believe I did. What are you looking for? Is this what you need:
    REPORT ztest MESSAGE-ID 00.
    DATA: kostl TYPE csks-kostl VALUE '378040',
          kostl_bdc(10).
    WRITE: /001 'Input:  ', kostl.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = kostl
      IMPORTING
        output = kostl_bdc.
    WRITE: /001 'Output: ', kostl_bdc.
    Rob
    Edited by: Rob Burbank on Jan 7, 2008 4:05 PM

  • Reg : BDC for OM

    Hi,
    I want to write BDC for OM Tcode : ppoc_old.
    But the process gets stopped in the first screen itself.
    Can anyone help me out ??

    You can create any OM object via PP01.
    You can create all the relationships between ant OM objects via PP01.
    What I do is, for creation of organizational units I create a separate BDC (as their keys are determined after creation).
    Then I write the second BDC and make the necessary connections for the org unit by using the keys determined at the end of the first batch input run.
    For all of them I use PP01.
    Regards,
    Dilek
    Edited by: Dilek Ersoz Adak on Dec 14, 2009 8:23 AM

  • Problem Reg BDC

    hii,
    as iam working on a BDC.
    Iam facing a problem during the tcode execution.
    During execution whenver i add a record that is allowing only when there is already an existing record.
    If there is no record in that it is not allowing the ok code.
    so please suggest any remedy for this.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Aug 6, 2008 1:47 PM

    hii,
    hope this code may useful to u.
    FORM load_data .
      IF t_soft_succ[] IS NOT INITIAL.
        PERFORM open_group.
       perform insert_data.
        LOOP AT t_soft_succ INTO w_soft_temp.
          w_soft = w_soft_temp.
          AT NEW doknr.
            SELECT COUNT(*) FROM ztemst1 INTO w_count WHERE doknr = w_soft-doknr.
          ENDAT.
          PERFORM bdc_dynpro      USING 'SAPMZEST' '9000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=ENTR'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'ZSEMST-DOKNR'.
          PERFORM bdc_field       USING 'ZSEMST-DOKNR'
                                        w_soft-doknr.
          IF w_count > 0.
    *IF ALREADY THE ENTRIES ARE EXISTING THEN IT WILL EXECUTE THIS PART OF THE CODE.
            PERFORM bdc_dynpro      USING 'SAPMZEST' '9001'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=ADD'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                           '%#AUTOTEXT012'.
          ENDIF.
          PERFORM bdc_dynpro      USING 'SAPMZEST' '9001'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SAVE'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'ZSEMST-MSMXV(01)'.
    *THIS PART OF THE CODE IS USED FOR DESELCTING THE ROW WHEN WE ADD NEW ENTRIES.
          perform bdc_field       using 'T_SOFT1-FLAG(01)'
          PERFORM bdc_field       USING 'ZSEMST-IPCN(01)'
                                        w_soft-ipcn.
          PERFORM bdc_field       USING 'ZSEMST-ATWRT(01)'
                                        w_soft-atwrt.
          PERFORM bdc_field       USING 'ZSEMST-ATNAM(01)'
                                        w_soft-atnam.
          PERFORM bdc_field       USING 'ZSEMST-MSMNV(01)'
                                        w_soft-msmnv.
          PERFORM bdc_field       USING 'ZSEMST-MSMXV(01)'
                                        w_soft-msmxv.
          PERFORM bdc_dynpro      USING 'SAPMZEST' '9001'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/EBACK'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        '%#AUTOTEXT012'.
          PERFORM bdc_dynpro      USING 'SAPLSPO1' '0100'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=YES'.
          PERFORM bdc_dynpro      USING 'SAPMZEST' '9000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/EBACK'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'ZSEMST-DOKNR'.
       PERFORM bdc_transaction USING 'ZE01'.
          CALL FUNCTION 'BDC_INSERT'
            EXPORTING
              tcode            = 'ZE01'  "TCODE
            TABLES
              dynprotab        = bdcdata[]
            EXCEPTIONS
              internal_error   = 1
              not_open         = 2
              queue_error      = 3
              tcode_invalid    = 4
              printing_invalid = 5
              posting_invalid  = 6
              OTHERS           = 7.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CLEAR :w_soft, w_soft_temp.
          REFRESH bdcdata.
          AT NEW doknr.
            w_count = w_count + 1.
          ENDAT.
          AT END OF doknr.
            CLEAR w_count.
          ENDAT.
        ENDLOOP.
        PERFORM close_group.
       SUBMIT rsbdcsub WITH mappe = 'ZSOFT_BS' AND RETURN.
      ENDIF.
    ENDFORM.                    " LOAD_DATA

  • Re:Reg  BDC's

    Hi,
              Iam very confused with BDC's,very new to this topic, i need any one's guidance from scratch,when to go to SHDB for recording ,when to write BDC program , I need different BDC example codes with explanations and steps
              I hope experts u can help me

    Hi,
    Check this sample code...
    report zsd_bict_customer
           no standard page heading line-size 255.
    selection screen
    selection-screen begin of block b1 with frame.
    parameters : p_fname type rlgrap-filename obligatory.
    parameters ctumode like ctu_params-dismode obligatory default 'N'.
    parameters e_group(12).             "group name of error-session
    selection-screen end of block b1.
    types declaration
    types: begin of ty_cust,
             ktokd type rf02d-ktokd,
             name1 type kna1-name1,
             sortl type kna1-sortl,
             ort01 type kna1-ort01,
             land1 type kna1-land1,
             pstlz type kna1-pstlz,
             spras type kna1-spras,
           end of ty_cust.
    data declaration
    data: wa_cust type ty_cust,
          it_cust like table of wa_cust with header line.
    data : session value '',
           ctu value 'X',
           group(12),
           user(12),
           cupdate value 'S',
           keep,
           holddate like sy-datum,
           e_user(12),
           e_keep value 'X',
           e_hdate like sy-datum,
           nodata,
           smalllog.
    *--Batchinputdata of single transaction
    data:bdcdata like bdcdata    occurs 0 with header line.
    *--messages of call transaction
    data:messtab like bdcmsgcoll occurs 0 with header line.
    *--error session opened (' ' or 'X')
    data:e_group_opened.
    *--message texts
    tables: t100.
    initialization.
      user = sy-uname.
      e_user = sy-uname.
    start-of-selection.
      data:v_fname type string.
      v_fname = p_fname.
      call function 'GUI_UPLOAD'
        exporting
          filename                = v_fname
          filetype                = 'ASC'
          has_field_separator     = 'X'
        tables
          data_tab                = it_cust
        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.
      loop at it_cust.
    screen number 100
        perform bdc_dynpro      using 'SAPMF02D' '0100'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'RF02D-KTOKD'
                                      it_cust-ktokd. "Account group
    screen number 110
        perform bdc_dynpro      using 'SAPMF02D' '0110'.
        perform bdc_field       using 'BDC_OKCODE'
                                      'VW'.
        perform bdc_field       using 'KNA1-NAME1'
                                      it_cust-name1. " Name
        perform bdc_field       using 'KNA1-SORTL'
                                      it_cust-sortl. " Search term
        perform bdc_field       using 'KNA1-ORT01'
                                      it_cust-ort01. " City
        perform bdc_field       using 'KNA1-LAND1'
                                      it_cust-land1. " Land/Country
        perform bdc_field       using 'KNA1-PSTLZ'
                                      it_cust-pstlz. " Postal code
        perform bdc_field       using 'KNA1-SPRAS'
                                      it_cust-spras. " Language
    screen number 120
        perform bdc_dynpro      using 'SAPMF02D' '0120'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=VW'.
    screen number 125
        perform bdc_dynpro      using 'SAPMF02D' '0125'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=VW'.
    screen number 360
        perform bdc_dynpro      using 'SAPMF02D' '0360'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=VW'.
        perform bdc_transaction using 'XD01'.
      endloop.
      perform close_group.
      create batchinput session                                          *
      (not for call transaction using...)                                *
    form open_group.
      if session = 'X'.
        skip.
        write: /(20) 'Create group'(i01), group.
        skip.
      open batchinput group
        call function 'BDC_OPEN_GROUP'
          exporting
            client   = sy-mandt
            group    = group
            user     = user
            keep     = keep
            holddate = holddate.
        write: /(30) 'BDC_OPEN_GROUP'(i02),
                (12) 'returncode:'(i05),
                     sy-subrc.
      endif.
    endform.                    "open_group
      end batchinput session                                             *
    (call transaction using...:  error session)                         *
    form close_group.
      if session = 'X'.
    *close batchinput group
        call function 'BDC_CLOSE_GROUP'.
        write: /(30) 'BDC_CLOSE_GROUP'(i04),
                (12) 'returncode:'(i05),
                     sy-subrc.
      else.
        if e_group_opened = 'X'.
          call function 'BDC_CLOSE_GROUP'.
          write: /.
          write: /(30) 'Fehlermappe wurde erzeugt'(i06).
          e_group_opened = ' '.
        endif.
      endif.
    endform.                    "close_group
           Start new transaction according to parameters                 *
    form bdc_transaction using tcode.
      data: l_mstring(480).
      data: l_subrc like sy-subrc.
    batch input session
      if session = 'X'.
        call function 'BDC_INSERT'
          exporting
            tcode     = tcode
          tables
            dynprotab = bdcdata.
        if smalllog <> 'X'.
          write: / 'BDC_INSERT'(i03),
                   tcode,
                   'returncode:'(i05),
                   sy-subrc,
                   'RECORD:',
                   sy-index.
        endif.
    call transaction using
      else.
        refresh messtab.
        call transaction tcode using bdcdata
                         mode   ctumode
                         update cupdate
                         messages into messtab.
        l_subrc = sy-subrc.
        if smalllog <> 'X'.
          write: / 'CALL_TRANSACTION',
                   tcode,
                   'returncode:'(i05),
                   l_subrc,
                   'RECORD:',
                   sy-index.
          loop at messtab.
            select single * from t100 where sprsl = messtab-msgspra
                                      and   arbgb = messtab-msgid
                                      and   msgnr = messtab-msgnr.
            if sy-subrc = 0.
              l_mstring = t100-text.
              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.
              write: / messtab-msgtyp, l_mstring(250).
            else.
              write: / messtab.
            endif.
          endloop.
          skip.
        endif.
    Erzeugen fehlermappe ************************************************
        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'
            exporting
              tcode     = tcode
            tables
              dynprotab = bdcdata.
        endif.
      endif.
      refresh bdcdata.
    endform.                    "bdc_transaction
           start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> nodata.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.                    "bdc_field
    Regards,
    Swathi

  • Reg: BDC & Exits

    Hello All,
            For the TCode ME31L we are using some User Exits for populating some of the Import screens data.
    Now I'm creating a BDC Program for the same TCode ME31L.
    My QN is : Whether the User exits will be triggered  in my BDC or not ?
    If not What shud I do to make them trigger ?
    Regards,
    Deepu.K

    hello Deepu.
    sure it will be trigger.
    when u doing BDC u need save the some of the screen.when u save the screen or doing entry it must trigger the exit( if the exit is there).
    to see the just keep a break-point in the exits then u can view the process.
    try it will happen ...
    Deepu nice task plz let know it is happening or not .

  • Reg:BDC session method

    Hi Friends,
    In call transaction we can display both updated and error records separately in a report.
    Like that in session method i want to capture and display in a separate report both error and updated records.
    Please let me know  if you have any ideas
    Thanks and Regards
    V.Raja sekaran

    hi,
    Use the BDC_OPEN_GROUP function module to create a new session. Once you have created a session, then you can insert batch input data into it with BDC_INSERT.
    You cannot re-open a session that already exists and has been closed. If you call BDC_OPEN_GROUP with the name of an existing session, then an additional session with the same name is created.
    A batch input program may have only one session open at a time. Before opening a session, make sure that any sessions that the program closes any sessions that it previously had opened.
    BDC_OPEN_GROUP takes the following EXPORTING parameters:
    ·        CLIENT
    Client in which the session is to be processed.
    Default: If you don't provide a value for this parameter, the default is the client under which the batch input program runs when the session is created.
    ·        GROUP
    Name of the session that is to be created. May be up to 12 characters long.
    Default: None. You must specify a session name.
    ·        HOLDDATE
    Lock date. The session is locked and may not be processed until after the date that you specify.  Only a system administrator with the LOCK authorization for the authorization object Batch Input Authorizations can unlock and run a session before this date.
    Format: YYYYMMDD (8 digits).
    Default: No lock date, session can be processed immediately. A lock date is optional.
    ·        KEEP
    Retain session after successful processing. Set this option to the value X to have a session kept after it has been successfully processed. A session that is kept remains in the input/output queue until an administrator deletes it.
    Sessions that contain errors in transactions are kept even if KEEP is not set.
    Default: If not set, then sessions that are successfully processed are deleted. Only the batch input log is kept.
    ·        USER
    Authorizations user for background processing. This is the user name that is used for checking authorizations if a session is started in background processing. The user must be authorized for all of the transactions and functions that are to be executed in a session. Otherwise, transactions will be terminated with “no authorization” errors.
    The user can be of type dialog or background. Dialog users are normal interactive users in the SAP system. Background users are user master records that are specially defined for providing authorizations for background processing jobs.
    check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/fa/097126543b11d1898e0000e8322d00/frameset.htm
    Regards,
    pankaj

  • Reg: is there any transaction for whcich bdc cannot be done

    Dear Friends,
    I would like to know if there is any transaction for which bdc cannot be done.
    I would like to know the reason, if there is any transaction like that.
    I have been asked the same in an session by a senior person.
    Reg
    Ravi.

    Hi RaviShankar,
      There are so many tcodes for which BDC cannot be done. There many be several reasons for that.
    Here is an example for that.
    The Tcode FIBPU. If you enter vendor or custome details along with hose bank details. You will get an interactive report data, if you click it will take you to the respective line related information screen. For each line the data will be different along with screens. But for this BDC is not possible.
    Thanks
    Manju.

  • Doubt in bdc and ale reg

    using we can transfer the data from one system and another system. in ale also we can do same thing. what is the need of using ale

    BDC is used in scenarios where a company decides to do away with an existing ERP system and choses to use a SAP R/3 system in its place(Like from Oracle to SAP, or from any legacy system to SAP).
    In the process, the company wil store all the legacy data in flat files before discarding the original system.
    The flat file data, will have to be uploaded into the R/3 System again. It such cases BDCs/ Batch Iput programs are used.
    ALEs are used in a totally different scenario.
    If the company is using two loosely coupled sap systems, and the same data is to be maintained in both the systems, then you will use ALE concept.
    It is like latching them together and changes made to one system are automatically refelected in the other system as well.
    Regards,
    Ravi

  • Reg: ME21 Purchase Order Creation BDC Codes

    Hi All,
    Ritenow Im working with ME21 purchase order creation,
    i have to create a upload program for this past twodays im geting hectic with this prog, if i create a prog using me21n transaction it is not running, and in ME21 i cant record in SHDB( it throws error messg as fill mandatory flds, but i dont hav data for that flds).
    Anyone plz let me know, how to record it and how to use step loop in item overview/details, i would like ot close it ASP.
    Thanks in advance.

    hi
    Creating an ABAP program from a BDC recording
    Step 1
    Execute transaction recorder, transaction SHDB or recording button via transaction SM35.
    Step 2
    Enter name for recording (can be anything)
    Step 3
    Enter transaction to be executed
    Step 4
    The transaction will now be executed, simply perform the actions you want to record. enter some values for the mandatory fields.
    Step 5
    Once you have finished the recording and selected the save button or exited the transaction you
    Will be presented with the following information. This details the screens and fields that have been
    Processed during the recording and will be used as a basis to create BDC ABAP program.

  • Reg : Error in flat file in BDC

    hi friends...
    let consider 10 records in my flat file...
    suppose 5th record is error means
    In BDC Session method, what happen records before and after the error record, its get update or not ? like
    In BDC Call Transaction method, what happen records before and after the error record, its get update or not ?
    please give me some detail...
    Regards
    Selva

    Hi,
    In call transaction method you will have an option of Displaying No screens, all screens and Error screens,
    If you select No screens all other records except error records will be process and messages will be collected by an internal table of type bdcmsgcoll.
    In all screens you need to process each screen manually yourself by selecting the OK code. It is kinda like debugging. So when you encounter the error screen you can change the error data and proceed.
    When you select error screens it will stop when the error occurs. So you need to correct the error and continue with the further processing.
    Regards,
    Pramod

  • Reg:how to post the parked documents using BDC

    Duplicate message in General deleted.  Please do not post the same question in more than one forum.
    Hi
    I am creating parked Documents using FV50. I am able to check them using FBV0, I am able to select and post the documents using the same transaction. Its working fine. However I want to post the selected parked documents using BDC. I am having problems as the output in FBV0 is in ALV report format. HAving problems selcting the parked documents to be posted. As there any way to post the selected parked documents using BDC.
    Please suggest me a solution for this.
    Thanks,
    Satish
    Edited by: Matt on Dec 3, 2008 7:40 PM

    Hi Rob,
    Thank you for ur reply, can u send that code how u post the parked documents using BDC for FBV0 transaction.  Please send the code.
    Thanks,
    Satish

  • Reg. Update and CATT mode in BDC

    Hello friends,
    Whn we create new BDC recording in that recording parameters having update mode and CATT mode. so I want to know abt Update mode (Asynchronous, synchronous and local) and CATT mode in BDC.
    Thanks.
    Marmik

    Hi
    CATTMODE
    CATT mode (controlling a CATT procedure)
    The CATT mode can have the following values:
    ' ' No CATT procedure active
    'N' CATT procedure without single screen control
    'A' CATT procedure with single screen control
    UPDATE upd
    Effect
    The specified update mode upd defines the update type. This can have one of the following values:
    'A' Asynchronous update
    'S' Synchronous update
    If the addition UPDATE is not specified, the processing mode is set to 'A' .
    synchronous update
    In synchronous update, you do not submit an update request using CALL FUNCTION... IN UPDATE TASK. Instead, you use the ABAP statement COMMIT WORK AND WAIT. When the update is finished, control passes back to the program. Synchronous update works in the same way as bundling update requests in a subroutine (PERFORM ON COMMIT). This kind of update is useful when you want to use both asynchronous and synchronous processing without having to program the bundles in two separate ways.
    Asynchronous update
    A typical SAP system installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. If, in a dialog work process, the function modules stored in interim storage through CALL FUNCTION ... IN UPDATE TASK are released for processing by means of the ABAP statement COMMIT WORK, the dialog work process will not wait for the update process to finish. This kind of update is called asynchronous update.

Maybe you are looking for