BDC Follow UP

Hi Folks,
After creating the BDC Recording and Generating a Program. Don't Know what modification should i do to proceed further. Could anyone please give the follow up proceedings for the BDC recording for Transaction MM02.
Here is the Code Generated by the BDC Recording for Transaction MM02.
What modification should i do to this code to upload a flat file.
REPORT zvkbdcdemo3
       NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
START-OF-SELECTION.
  PERFORM open_group.
  PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                'RMMG1-MATNR'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=AUSW'.
  PERFORM bdc_field       USING 'RMMG1-MATNR'
                                '100-100'.
  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 'MSICHTAUSW-KZSEL(01)'
                                'X'.
  PERFORM bdc_dynpro      USING 'SAPLMGMM' '4004'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=BU'.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                'MAKT-MAKTX'.
  PERFORM bdc_field       USING 'MAKT-MAKTX'
                                'Casing'.
  PERFORM bdc_field       USING 'MARA-MEINS'
                                'PC'.
  PERFORM bdc_field       USING 'MARA-MATKL'
                                '001'.
  PERFORM bdc_field       USING 'MARA-SPART'
                                '01'.
  PERFORM bdc_field       USING 'MARA-PRDHA'
                                '001000010500000115'.
  PERFORM bdc_field       USING 'MARA-MTPOS_MARA'
                                'NORM'.
  PERFORM bdc_field       USING 'MARA-BRGEW'
                                '3'.
  PERFORM bdc_field       USING 'MARA-GEWEI'
                                'KG'.
  PERFORM bdc_field       USING 'MARA-NTGEW'
                                '3'.
  PERFORM bdc_transaction USING 'MM02'.
  PERFORM close_group.
Kindly provide me with some code
Edited by: Sivaram  Naga on Apr 9, 2008 12:12 AM

hello Sivaram-
Before recording the transaction:
types:begin of  ty_tab,
******fields required,
        end of ty_tab.       
data:i_tab type table of ty_tab,
       w_tab type ty_tab.
**1) Upload the flat file to an internal table using FM:ws_upload.
loop i_tab into w_tab.
***pass the w_itab fields to the screen fields
PERFORM open_group.
  PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
  PERFORM bdc_field          USING 'BDC_CURSOR'
                                                     'RMMG1-MATNR'.
  PERFORM bdc_field         USING 'BDC_OKCODE'
                                                     '=AUSW'.
  PERFORM bdc_field       USING 'RMMG1-MATNR'
                                                    '100-100'.
  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 'MSICHTAUSW-KZSEL(01)'
                                'X'.
  PERFORM bdc_dynpro      USING 'SAPLMGMM' '4004'.
  PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=BU'.
  PERFORM bdc_field       USING 'BDC_CURSOR'
                                'MAKT-MAKTX'.
  PERFORM bdc_field       USING 'MAKT-MAKTX'
                                'Casing'.
  PERFORM bdc_field       USING 'MARA-MEINS'
                                'PC'.
  PERFORM bdc_field       USING 'MARA-MATKL'
                                '001'.
  PERFORM bdc_field       USING 'MARA-SPART'
                                '01'.
  PERFORM bdc_field       USING 'MARA-PRDHA'
                                '001000010500000115'.
  PERFORM bdc_field       USING 'MARA-MTPOS_MARA'
                                'NORM'.
  PERFORM bdc_field       USING 'MARA-BRGEW'
                                '3'.
  PERFORM bdc_field       USING 'MARA-GEWEI'
                                'KG'.
  PERFORM bdc_field       USING 'MARA-NTGEW'
                                '3'.
  PERFORM bdc_transaction USING 'MM02'.
  PERFORM close_group.
endloop.

Similar Messages

  • Follow-up question for Chris H on longtext in BDC for IW31

    Chris -
    Here's the relevant part of my code:
    PERFORM DYNPRO USING:
    'X' 'SAPLCOIH'          '3000',            "
    ' ' 'CAUFVD-KTEXT   '   SCRN_PROBLEM1,     " 1st line problem text
    ' ' 'CAUFVD-ANLZU   '   CAUFVD-ANLZU,      " System condition
    ' ' 'BDC_OKCODE'       '=LTXK'.            "
    LOOP AT i_txt INTO wa_txt.
      v_txtln_ctr_n = sy-tabix + 2.    " Chris - note that I'm bumping to "3" here
      v_txtln_ctr_c = v_txtln_ctr_n.
      CONCATENATE 'RSTXT-TXLINE('
                  v_txtln_ctr_c
             INTO v_bdc_txtln_lit.
      CONDENSE v_bdc_txtln_lit NO-GAPS.
      PERFORM DYNPRO USING:
        'X' 'SAPLSTXX'          '1100',              "
        ' ' v_bdc_txtln_lit     wa_txt,              " line of problem text
        ' ' 'BDC_OKCODE'        '=ENTR'.             "
    ENDLOOP.
    This actually works - it creates an order in which the long text begins with what is in the variable SCRN_PROBLEM1 and continues with what is in i_txt concatenated together.  So I get, for example:
    "This is the short description. a b c d e"
    where:
    scrn_problem1 = 'This is the short description'
    row 1 of i_txt = 'a'
    row 2 of i_txt = 'b'
    row 3 of i_txt = 'c'
    row 4 of i_txt = 'd'
    row 5 of i_txt = 'e'
    The only problem is that the BDC doesn't go thru on its own.  When I change 'N' to 'E', the BDC brings up a screen with the title:
    "Change order text header Alternative Language EN"
    Then, when I just "back-arrow" from this, the BDC does complete successfully and I can see the correct text saved for the order in IW32.
    What am I doing wrong to cause this "change order text header" screen to come up?  Is it the "LTXK" value of the OK-CODE in the first dynpro call above?
    Or maybe something with my default user parameters?  I had to set quite a few of these in order to get the BDC to go with just a system, priority, and short text/long text.
    I'm really hoping you can see what's going on here because I'm at a loss.
    Thanks for whatever help you can provide.  You seem to have coded this BDC before, so that's why I'm directing this question to you.
    BTW, I'd try the BAPI except the documentation specifically says it won't observe user default parameters and this is a must in our situation.
    Thanks again
    Dave

    Chris/Rich -
    My suspicion was correct.  In the last loop over the longtext itab, the ok_code must be 'TXBA', not 'ENTR'.
    Here's the code that works without any 'E' interruptions:
    PERFORM DYNPRO USING:
    'X' 'SAPLCOIH'          '3000',            "
    ' ' 'CAUFVD-KTEXT   '   SCRN_PROBLEM1,     " 1st line problem text
    ' ' 'CAUFVD-ANLZU   '   CAUFVD-ANLZU,      " System condition
    ' ' 'BDC_OKCODE'       '=LTXK'.            "
    DESCRIBE TABLE i_txt LINES v_txt_cnt.
    LOOP AT i_txt INTO wa_txt.
      v_txtln_ctr_n = sy-tabix + 2.
      v_txtln_ctr_c = v_txtln_ctr_n.
      CONCATENATE 'RSTXT-TXLINE('
                  v_txtln_ctr_c
             INTO v_bdc_txtln_lit.
      CONDENSE v_bdc_txtln_lit NO-GAPS.
      IF sy-tabix = v_txt_cnt.
        v_txt_ok = '=TXBA'.                    " no more text lines coming
      ELSE.
        v_txt_ok = '=ENTR'.                    " more text lines coming
      ENDIF.
      PERFORM DYNPRO USING:
        'X' 'SAPLSTXX'          '1100',       
        ' ' v_bdc_txtln_lit     wa_txt,        " line of problem text
        ' ' 'BDC_OKCODE'        v_txt_ok.      " ok_code
    ENDLOOP.
    The result is that the longtest display in IW32 will be what's in "SCRN_PROBLEM1" followed by all the lines that are in i_txt.
    Reagrds
    djh

  • Query on availability of BDC/BADI for following enhancement

    Hi,
    I want to know whether any user exit/BADI/BDC is available for the following Scenario:
    I have a PO having 80 Project materials. The PO will be created with reference to a PR which will have all the Project Materials.  The Client doesn't want to maintain conditions and the Tax code at line item level (conditions cannot be maintained at Header level as these are different for the condition types) for 80 Project materials in a single PO as it is too laborious.  Instead he want's to populate the fields thro' an excel file where he will be maintain the values for the condition type and tax code.
    My question's are:-
    Is this Possible?
    How? using BDC/BADI ?
    Solution to the Problem ?
    Please treat this as urgent and respond.

    Yes it is possible by doing some development work.
    Create a new transaction code which can list down all the PR's for a vendor to be converted into a PO. dispaly all the line items in a ALV Grid format whcoh can be downloaded so that the user can populate the PO price and tax code in differnt columns for the lines and provide an updload functionality which will then update the table. Once updated , you need to provide a selection icon for creating the PO whcih will invoke the BAPI - BAPI_PO_CREATE1 for creating the PO using the fields from the screen.
    Hope this helps.
    Thanks & Regards
    Kishore

  • Data is not uploding for the following code in bdc

    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,
            cosp.
    *** Generated data section with specific formatting - DO NOT CHANGE  ***
    DATA: BEGIN OF record OCCURS 0,
    * data element: KPP_VALUE
            bdc00(032),                              "Cost Center
    * data element:
            bdc01(032),                              "Cost Element
    * data element:
            bdc02(032),                              "January
    * data element:
            bdc03(032),                              "february
    * data element:
            bdc04(032),                              "March
    * data element:
            bdc05(032),                              "April
    * data element:
            bdc06(032),                              "may
    * data element:
            bdc07(032),                              "june
    * data element:
            bdc08(032),                              "july
    * data element:
            bdc09(032),                              "august
    * data element:
            bdc10(032),                              "september
    * data element:
            bdc11(032),                              "october
    * data element:
            bdc12(032),                              "november
    * data element:
            bdc13(032),                              "december
          END OF record.
    *** End generated data section ***
    DATA: g_file TYPE string,                        "Input file var for FM
          g_count(4) TYPE n VALUE 0000,              "Counter
          g_flag(1),                                 "Flag
          g_bdc01(11),
          g_bdc02(11),
          g_bdc03(11),
          g_bdc04(11),
          g_bdc05(11),
          g_bdc06(11),
          g_bdc07(11),
          g_bdc08(11),
          g_bdc09(11),
          g_bdc10(11),
          g_bdc11(11),
          g_bdc12(11),
          g_bdc13(11).
    DATA: g_objnr LIKE cosp-objnr. "Object Number
    DATA: g_record TYPE string,    "work area to read from app server
          g_tab TYPE string.       "tab variable to separate the columns
    *   Selection Screen Variables
    PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'A' OBLIGATORY.
    PARAMETERS: user(12) DEFAULT sy-uname OBLIGATORY.     "user for session in batch
    PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L' OBLIGATORY.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file(256) LOWER CASE OBLIGATORY,   "Input file
                p_ver(3) OBLIGATORY,                 "version
                p_gjahr(4) OBLIGATORY,               "Fiscal Year
                p_prof(8) OBLIGATORY,                "Planner Profile
                p_lines(4) OBLIGATORY,               "No. of Lines
                p_kokrs(4) OBLIGATORY.               "Controlling area
    SELECTION-SCREEN END OF BLOCK b1.
    *   Initialization
    INITIALIZATION.
    *Shiva-Change -01/03/2007 Costom Authorization check.
    INITIALIZATION.
      INCLUDE zauthocheck.
    *End.
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      g_tab = cl_abap_char_utilities=>horizontal_tab.
    *  Start of Selection
    START-OF-SELECTION.
    *Set the Controlling area
      PERFORM bdc_dynpro USING 'SAPLSPO4'     '0300'.
      PERFORM bdc_field  USING 'SVALD-VALUE(001)' p_kokrs. "Contr.area
      PERFORM bdc_transaction USING 'OKKS'.
    *Set the planner profile
      PERFORM bdc_dynpro USING 'SAPLKPP6'     '1007'.
      PERFORM bdc_field  USING 'RKPP6-PLPROF' p_prof. "Planner profile
      PERFORM bdc_transaction USING 'KP04'.
    *Number of lines
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = p_lines
        IMPORTING
          output = p_lines.
    *For use in FM g_file should be of type string
       g_file = p_file.
    *Open the app server file
      PERFORM sub_get_data.
    *read all data one by one
    *  DO.
    *    READ DATASET p_file INTO g_record.
    *    IF sy-subrc <> 0.
    *      EXIT.
    *    ENDIF.
    **Split the record at tab
    *    SPLIT g_record AT g_tab INTO
    *     record-bdc00 record-bdc01 record-bdc02
    *     record-bdc03 record-bdc04 record-bdc05
    *     record-bdc06 record-bdc07 record-bdc08
    *     record-bdc09 record-bdc10 record-bdc11
    *     record-bdc12 record-bdc13.
    *    IF sy-subrc = 0.
    *      APPEND record.
    *      CLEAR record.
    *    ENDIF.
    *  ENDDO.
    *For every new cost center, check whether there is already some plan data
    *that is existing. If yes, delete them and replace with new plan data. Else,
    *upload the new data.
      LOOP AT record.
    *Start of every new transaction
        AT NEW bdc00.
          READ TABLE record INDEX sy-tabix.
          CLEAR cosp.
          CONCATENATE 'KS' p_kokrs record-bdc00 INTO g_objnr.
          SELECT SINGLE * FROM cosp WHERE objnr = g_objnr AND
                                          gjahr = p_gjahr AND
                                          wrttp = '01' AND
                                          vrgng = 'RKP1'.
          IF sy-subrc = 0.
            PERFORM bdc_dynpro      USING 'SAPLKPP0' '1000'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'KPP0B-VALUE(03)'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=CSUB'.
            PERFORM bdc_field       USING 'KPP0B-VALUE(01)'
                                          p_ver.
            PERFORM bdc_field       USING 'KPP0B-VALUE(02)'
                                          p_gjahr.
            PERFORM bdc_field       USING 'KPP0B-VALUE(03)'
                                          record-bdc00.
            PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'Z-BDC02(01)'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=CMAL'.
            PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'Z-BDC02(01)'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=CDEL'.
            PERFORM bdc_dynpro      USING 'SAPLSPO1' '0200'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=YES'.
            PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          'Z-BDC02(01)'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=CBUC'.
            PERFORM bdc_transaction USING 'KP06'.
          ENDIF.
    *The line count should be set to 0001 first
          g_count = 0001.
          PERFORM bdc_dynpro      USING 'SAPLKPP0' '1000'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KPP0B-VALUE(03)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CSUB'.
          PERFORM bdc_field       USING 'KPP1B-ONLY'
                                        'X'.
          PERFORM bdc_field       USING 'KPP0B-VALUE(01)'
                                        p_ver.
          PERFORM bdc_field       USING 'KPP0B-VALUE(02)'
                                        p_gjahr.
          PERFORM bdc_field       USING 'KPP0B-VALUE(03)'
                                        record-bdc00.
        ENDAT.
    *End of every new transaction
    *If the line count increases what was specified in sel screen, reset it to 1
        IF g_count > p_lines.
          g_count = 0001.
          g_flag = 'X'.
        ENDIF.
        CONCATENATE 'Z-BDC01(' g_count+2(2) ')' INTO g_bdc01.
        CONCATENATE 'Z-BDC02(' g_count+2(2) ')' INTO g_bdc02.
        CONCATENATE 'Z-BDC03(' g_count+2(2) ')' INTO g_bdc03.
        CONCATENATE 'Z-BDC04(' g_count+2(2) ')' INTO g_bdc04.
        CONCATENATE 'Z-BDC05(' g_count+2(2) ')' INTO g_bdc05.
        CONCATENATE 'Z-BDC06(' g_count+2(2) ')' INTO g_bdc06.
        CONCATENATE 'Z-BDC07(' g_count+2(2) ')' INTO g_bdc07.
        CONCATENATE 'Z-BDC08(' g_count+2(2) ')' INTO g_bdc08.
        CONCATENATE 'Z-BDC09(' g_count+2(2) ')' INTO g_bdc09.
        CONCATENATE 'Z-BDC10(' g_count+2(2) ')' INTO g_bdc10.
        CONCATENATE 'Z-BDC11(' g_count+2(2) ')' INTO g_bdc11.
        CONCATENATE 'Z-BDC12(' g_count+2(2) ')' INTO g_bdc12.
        CONCATENATE 'Z-BDC13(' g_count+2(2) ')' INTO g_bdc13.
    *Trigger a new page when the limit reaches.
        IF g_flag = 'X'.
          PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        g_bdc01.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CP+'.
          g_flag = space.
        ENDIF.
        PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                        g_bdc01.
        PERFORM bdc_field       USING g_bdc01
                                      record-bdc01.
        PERFORM bdc_field       USING g_bdc02
                                      record-bdc02.
        PERFORM bdc_field       USING g_bdc03
                                      record-bdc03.
        PERFORM bdc_field       USING g_bdc04
                                      record-bdc04.
        PERFORM bdc_field       USING g_bdc05
                                      record-bdc05.
        PERFORM bdc_field       USING g_bdc06
                                      record-bdc06.
        PERFORM bdc_field       USING g_bdc07
                                      record-bdc07.
        PERFORM bdc_field       USING g_bdc08
                                      record-bdc08.
        PERFORM bdc_field       USING g_bdc09
                                      record-bdc09.
        PERFORM bdc_field       USING g_bdc10
                                      record-bdc10.
        PERFORM bdc_field       USING g_bdc11
                                      record-bdc11.
        PERFORM bdc_field       USING g_bdc12
                                      record-bdc12.
        PERFORM bdc_field       USING g_bdc13
                                      record-bdc13.
        g_count = g_count + 1.
    *at end of all records of a transaction
        AT END OF bdc00.
          PERFORM bdc_dynpro      USING 'SAPLKPP2' '0106'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        g_bdc13.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=CBUC'.
          SKIP.
          WRITE:/ 'Cost Center:', 15 record-bdc00.
          PERFORM bdc_transaction USING 'KP06'.
        ENDAT.
      ENDLOOP.
    *&      Form  sub_get_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM sub_get_data .
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = g_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = record
        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.
    ENDFORM.                    " sub_get_data
    *   open dataset                                                       *
    *FORM open_dataset USING p_dataset.
    *  OPEN DATASET p_dataset
    *               FOR INPUT IN TEXT MODE
    *               ENCODING DEFAULT.
    *  IF sy-subrc <> 0.
    *    WRITE: / text-e00, sy-subrc.
    *    STOP.
    *  ENDIF.
    *ENDFORM.                    "OPEN_DATASET
    **   close dataset                                                      *
    *FORM close_dataset USING p_dataset.
    *  CLOSE DATASET p_dataset.
    *ENDFORM.                    "CLOSE_DATASET
    *        Start new transaction according to parameters                 *
    FORM bdc_transaction USING tcode.
      DATA: l_mstring(480).
      DATA: l_subrc LIKE sy-subrc.
    * batch input session
    * call transaction using
      REFRESH messtab.
      CALL TRANSACTION tcode USING bdcdata
                       MODE   ctumode
                       UPDATE cupdate
                       MESSAGES INTO messtab.
      l_subrc = sy-subrc.
      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.
      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.
    from the flat file its reading first record in to the tab strip but not the second record for  the same costcenter

    So your sparse upper level members are dynamically calculated?
    I wonder if that is interacting with the calc order of the attribute dimension and not valuing the way you want.
    The DBAG has lots of good stuff on attributes: http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_dbag/dattrib.htm
    You might want to think about making the upper level members in Function stored/never share and see if you get the result you're looking for. If Function is sparse, I would think long and hard about whether I really want those members to be dynamically calculated because of retrieval performance impact.
    Regards,
    Cameron Lackpour

  • MULTIPLE ITEM PROBLEM IN VL31N BDC

    hI FRIENDS ,
        I AM POSTING A BDC OF TRANSACTION VL31N ,ie FOR SCHEDULE AGREEMENT INBOUND DELIVERY.I CREATE A FUNCTIONAL MODULE OF THE SAME AND CALL IT FROM AN ASP PAGE,IN THAT THERE IS PO NUMBER 5500000986 WHICH HAS TWO ITEMES 62 AND 95 RESPECTIVLY OF SAME MATARIAL NUMBER R010230123041002 AND DIE NUMBER 2304P,NOW THE PROBLEM IS THIS BDC IS WORKING WHEN THERE IS ONLY ONE ITEM BUT GIVES AN ERROR "CANT CREAT INBOUND DELIVERY FOR PO NO ...' WNEN IT HAS MULTIPLE ITEM.WHAT SHOULD I DO ? I ALSO USED LOOP BUT IT ALSO DOSENT WORK AS IT WILL ADD ALL OPEN QTY OF PO 986 AND UPDATE AGAINST ITEM NO 95.
    CODE IS AS FOLLOWS:.........
    FUNCTION y_synie_bdcinbdly.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(CTU) LIKE  APQI-PUTACTIVE DEFAULT 'X'
    *"     VALUE(MODE) LIKE  APQI-PUTACTIVE DEFAULT 'N'
    *"     VALUE(UPDATE) LIKE  APQI-PUTACTIVE DEFAULT 'L'
    *"     VALUE(GROUP) LIKE  APQI-GROUPID OPTIONAL
    *"     VALUE(USER) LIKE  APQI-USERID OPTIONAL
    *"     VALUE(KEEP) LIKE  APQI-QERASE OPTIONAL
    *"     VALUE(HOLDDATE) LIKE  APQI-STARTDATE OPTIONAL
    *"     VALUE(NODATA) LIKE  APQI-PUTACTIVE DEFAULT '/'
    *"     VALUE(EXTNID) LIKE  MAKT-MAKTG
    *"     VALUE(VENDORNO) LIKE  LFA1-LIFNR
    *"     VALUE(PONUMBER) LIKE  EKKO-EBELN
    *"     VALUE(ITEMNUMBER) LIKE  LIPS-VGPOS
    *"     VALUE(MATERIAL) LIKE  MAKT-MAKTG
    *"     VALUE(DLYQTY) LIKE  LIPS-LFIMG
    *"     VALUE(BTCHNO) LIKE  LIPS-CHARG
    *"     VALUE(POSLR) LIKE  EKES-EBELP OPTIONAL
    *"  EXPORTING
    *"     VALUE(SUBRC) LIKE  SYST-SUBRC
    *"     VALUE(INDELYNO) LIKE  SY-MSGV2
    *"     VALUE(MSG1) LIKE  SY-MSGV1
    *"     VALUE(MSG2) LIKE  SY-MSGV2
    *"     VALUE(MSG3) LIKE  SY-MSGV3
    *"     VALUE(MSG4) LIKE  SY-MSGV4
    *"  TABLES
    *"      MESSTAB STRUCTURE  BDCMSGCOLL
    *"      ERRTAB STRUCTURE  YSYNERRMSGS
    *"      INDLYTAB STRUCTURE  YSYN_QTYTAB
    Updated by ANAND SYNISE 19.1.2007
      DATA: BEGIN OF bdctab OCCURS 0.
              INCLUDE STRUCTURE bdcdata.
      DATA: END OF bdctab.
      DATA: datenow(10) TYPE c,
            fldvar(30)  TYPE c,
            fldno       TYPE i,
            flditoc(6)  TYPE c,
            qty(13)     TYPE c.
      DATA maxposnr LIKE lips-posnr.
      DATA testposnr TYPE posnr.
      DATA itemnoint TYPE i.
      CONCATENATE sy-datum6(2) '.' sy-datum4(2) '.' sy-datum+0(4) INTO datenow.
      CLEAR bdctab.
      REFRESH bdctab.
      PERFORM open_group      USING group user keep holddate ctu.
           CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '4007'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'RV50A-VERUR_LA'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '/00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-LIFNR'.
           bdctab-fval = vendorno.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LV50C-BSTNR'.
           bdctab-fval = ponumber.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-VERUR_LA'.
           bdctab-fval = extnid.
           APPEND bdctab.
       CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '1000'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '=MKAL_T'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'LIKP-BLDAT'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-BLDAT'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '1000'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
       CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '=POPO_T'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-BLDAT'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'LIPS-POSNR(01)'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '0111'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'RV50A-PO_MATNR'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = 'WEIT'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-PO_MATNR'.
           bdctab-fval = material.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '1000'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '=POLO_T'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-BLDAT'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'LIPS-POSNR(01)'.
           APPEND bdctab.
    *ADDED BY ANAND ON 22-01-2007
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval =  ITEMNUMBER .     "ITEMNUMBER = LIPS-VGPOS
           APPEND bdctab.
    ************ENDED***********************
    ADDED BY MILIND 19.01.2007
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval =  poslr .
           APPEND bdctab.
    *    ENDED * *
       CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LIPS_SELKZ(01)'.
           bdctab-fval = ''.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
       CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '1000'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '/00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-BLDAT'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'LIPS-CHARG(01)'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
          QTY = INDLYTAB-DLYQTY.
            qty = dlyqty.
           bdctab-fnam = 'LIPSD-G_LFIMG(01)'.
           bdctab-fval = QTY.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIPS-CHARG(01)'.
    *     BDCTAB-FVAL = INDLYTAB-BTCHNO.
           bdctab-fval = btchno.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
       CLEAR bdctab.
           bdctab-program = 'SAPMV50A'.
           bdctab-dynpro = '1000'.
           bdctab-dynbegin = 'X'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_OKCODE'.
           bdctab-fval = '=SICH_T'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'LIKP-BLDAT'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_CURSOR'.
           bdctab-fval = 'LIPS-MATNR(02)'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFDAT_LA'.
           bdctab-fval = datenow.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'RV50A-LFUHR_LA'.
           bdctab-fval = '00:00'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
           CLEAR bdctab.
           bdctab-fnam = 'BDC_SUBSCR'.
           bdctab-fval = 'SAPMV50A'.
           APPEND bdctab.
      CALL TRANSACTION 'VL31N' USING bdctab MODE 'N'  MESSAGES INTO messtab.
      subrc = sy-subrc.
      PERFORM close_group USING     ctu.
      CLEAR bdctab.
      REFRESH bdctab.
      IF sy-subrc EQ 0.
        indelyno = sy-msgv2.
      ENDIF.
      LOOP AT messtab.
        MOVE: messtab-msgid TO errtab-msgid,
              messtab-msgnr TO errtab-msgnr,
              messtab-msgv1 TO errtab-msg1,
              messtab-msgv2 TO errtab-msg2,
              messtab-msgv3 TO errtab-msg3,
              messtab-msgv4 TO errtab-msg4.
        APPEND ERRtab.
      ENDLOOP.
      LOOP AT errtab.
        SELECT SINGLE text FROM t100
          INTO errtab-errmsg
          WHERE msgnr EQ errtab-msgnr AND arbgb EQ errtab-msgid
          AND sprsl EQ sy-langu.
        MODIFY errtab.
      ENDLOOP.
    ENDFUNCTION.

    Hi,
    Check this code:
    REPORT Z_CUSTOMER_UPLOAD .
                  D A T A         D E C L A R A T I O N S                *
    DATA:BEGIN OF IT_CUSTOMER OCCURS 0,
         KUNNR LIKE MV10A-KUNNR,
         VKORG LIKE MV10A-VKORG,
         VTWEG LIKE MV10A-VTWEG,
         MATNR LIKE MV10A-MATNR,
         KDMAT LIKE MV10A-KDMAT,
         MEGRU LIKE MV10A-MEGRU,
         SELKZ TYPE C value 'X',
         LPRIO LIKE MV10A-LPRIO,
         ANTLF LIKE MV10A-ANTLF,
         END OF IT_CUSTOMER.
    DATA:BEGIN OF IT_success OCCURS 0,
         KUNNR LIKE MV10A-KUNNR,
         VKORG LIKE MV10A-VKORG,
         VTWEG LIKE MV10A-VTWEG,
         MATNR LIKE MV10A-MATNR,
         KDMAT LIKE MV10A-KDMAT,
         MEGRU LIKE MV10A-MEGRU,
         SELKZ TYPE C value 'X',
         LPRIO LIKE MV10A-LPRIO,
         ANTLF LIKE MV10A-ANTLF,
         END OF IT_success.
    DATA:BEGIN OF IT_error OCCURS 0,
         KUNNR LIKE MV10A-KUNNR,
         VKORG LIKE MV10A-VKORG,
         VTWEG LIKE MV10A-VTWEG,
         MATNR LIKE MV10A-MATNR,
         KDMAT LIKE MV10A-KDMAT,
         MEGRU LIKE MV10A-MEGRU,
         SELKZ TYPE C value 'X',
         LPRIO LIKE MV10A-LPRIO,
         ANTLF LIKE MV10A-ANTLF,
         END OF IT_error.
    DATA: L_INDEX TYPE SY-TABIX.
    DATA:IT_BDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
    IT_DATA TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    ERROR MESSAGE TABLE
    DATA:IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : C_S TYPE C VALUE 'S',
            C_E TYPE C VALUE 'E'.
    *DATA: IT_SUCCESS LIKE IT_CUSTOMER OCCURS 0,
         IT_ERROR LIKE IT_CUSTOMER  OCCURS 0.
    DATA : V_RECTOT TYPE I,
            V_RECERR TYPE I,
            V_RECSUC TYPE I.
                  S E L E C T I O N  -  S C R E E N                      *
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER        : P_FILE LIKE RLGRAP-FILENAME .
    SELECTION-SCREEN : END OF BLOCK B1.
               A T  S E L E C T I O N  -  S C R E E N                    *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    to get F4 help for p_file
      PERFORM F4_FILENAME USING P_FILE.
                S T A R T   O F   S E L E C T I O N                      *
    START-OF-SELECTION.
    Uploading data from flat file into it_tab
      PERFORM BDC_UPLOAD USING P_FILE.
      PERFORM PROCESS_DATA.
      PERFORM POPULATE_BDC.
                E N D  O F   S E L E C T I O N                           *
    *END-OF-SELECTION.
    PERFORM DISPLAY_REPORT.
    *&      Form  F4_FILENAME
          text
         -->P_P_FILE  text
    FORM F4_FILENAME USING    P_P_FILE.
    DATA:L_FILE TYPE IBIPPARMS-PATH.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = L_FILE .
       P_P_FILE = L_FILE.
    ENDFORM.                    " F4_FILENAME
    *&      Form  BDC_UPLOAD
          text
         -->P_P_FILE  text
    FORM BDC_UPLOAD USING    P_P_FILE.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = P_P_FILE
        I_BEGIN_COL                   = 1
        I_BEGIN_ROW                   = 1
        I_END_COL                     = 8
        I_END_ROW                     = 1000
      TABLES
        INTERN                        = IT_DATA
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 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.
    ENDFORM.                    " BDC_UPLOAD
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_DATA.
    SORT IT_DATA BY ROW COL.
      LOOP AT IT_DATA.
    CASE IT_DATA-COL.
    WHEN 1.
    IT_CUSTOMER-KUNNR   = IT_DATA-VALUE.
    WHEN 2.
    IT_CUSTOMER-VKORG   = IT_DATA-VALUE.
    WHEN 3.
    IT_CUSTOMER-VTWEG   = IT_DATA-VALUE.
    WHEN 4.
    IT_CUSTOMER-MATNR   = IT_DATA-VALUE.
    WHEN 5.
    IT_CUSTOMER-KDMAT   = IT_DATA-VALUE.
    WHEN 6.
    IT_CUSTOMER-MEGRU   = IT_DATA-VALUE.
    WHEN 7.
    IT_CUSTOMER-LPRIO   = IT_DATA-VALUE.
    WHEN 8.
    IT_CUSTOMER-ANTLF   = IT_DATA-VALUE.
    APPEND IT_CUSTOMER.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  POPULATE_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_BDC.
    DATA:L_COUNTER TYPE N,
             L_STRING TYPE STRING.
    LOOP AT IT_CUSTOMER.
    AT NEW KUNNR.
    CLEAR L_COUNTER.
          L_INDEX = SY-TABIX.
          READ TABLE IT_CUSTOMER INDEX L_INDEX.
    perform bdc_dynpro      using 'SAPMV10A' '0100'.
    perform bdc_field       using 'MV10A-KUNNR'
                                  IT_CUSTOMER-KUNNR.
    perform bdc_field       using 'MV10A-VKORG'
                                  IT_CUSTOMER-VKORG.
    perform bdc_field       using 'MV10A-VTWEG'
                                  IT_CUSTOMER-VTWEG.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    ENDAT.
    L_COUNTER = L_COUNTER + 1.
        CLEAR L_STRING.
    perform bdc_dynpro      using 'SAPMV10A' '0200'.
    CONCATENATE 'MV10A-MATNR(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using L_STRING
                            IT_CUSTOMER-MATNR.
    CONCATENATE 'MV10A-KDMAT(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using     L_STRING
                                     IT_CUSTOMER-KDMAT.
    CONCATENATE 'MV10A-MEGRU(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using   L_STRING
                                    IT_CUSTOMER-MEGRU.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *-- For Page down in Call Transaction Mode
        IF L_COUNTER = 14.
          CLEAR L_COUNTER.
          PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                                '=P+'.
        ENDIF.
    perform bdc_dynpro      using 'SAPMV10A' '0200'.
    CONCATENATE 'MV10A-SELKZ(' L_COUNTER ')' INTO L_STRING.
    perform bdc_field       using L_STRING
                              IT_CUSTOMER-SELKZ.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SELE'.
    perform bdc_dynpro      using 'SAPMV10A' '0300'.
    perform bdc_field       using 'MV10A-KDMAT'
                                  IT_CUSTOMER-KDMAT.
    perform bdc_field       using 'MV10A-LPRIO'
                                  IT_CUSTOMER-LPRIO.
    perform bdc_field       using 'MV10A-ANTLF'
                                  IT_CUSTOMER-ANTLF.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/EBACK'.
    at end of kunnr.
    READ TABLE IT_CUSTOMER INDEX L_INDEX.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SICH'.
    CALL TRANSACTION 'VD51' USING IT_BDC MODE 'A' UPDATE 'S'
          MESSAGES INTO IT_MESSAGES.
          CLEAR IT_BDC.
          REFRESH IT_BDC.
    ENDAT.
      IF NOT IT_MESSAGES[] IS INITIAL.
        PERFORM FORMAT_MESSAGE.
      ENDIF.
    ENDLOOP.
    ENDFORM.                    " POPULATE_BDC
    *&      Form  bdc_dynpro
          text
         -->P_0273   text
         -->P_0274   text
    FORM bdc_dynpro USING    VALUE(P_0273)
                             VALUE(P_0274).
    IT_BDC-PROGRAM = P_0273.
    IT_BDC-DYNPRO = P_0274.
    IT_BDC-DYNBEGIN = 'X'.
      APPEND IT_BDC.
      CLEAR IT_BDC.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
          text
         -->P_0278   text
         -->P_RECORD_KUNNR_001  text
    FORM bdc_field USING    VALUE(P_0278)
                           VALUE(P_0279).
    IT_BDC-FNAM = P_0278.
      IT_BDC-FVAL = P_0279.
      APPEND IT_BDC.
      CLEAR IT_BDC.
    ENDFORM.                    " bdc_field
    *&      Form  FORMAT_MESSAGE
          text
    -->  p1        text
    <--  p2        text
    FORM FORMAT_MESSAGE.
    DATA: L_MSG(100).
      LOOP AT IT_MESSAGES.
      READ TABLE IT_CUSTOMER INDEX L_INDEX.
        CALL FUNCTION 'FORMAT_MESSAGE'
             EXPORTING
                  ID        = IT_MESSAGES-MSGID
                  LANG      = SY-LANGU
                  NO        = IT_MESSAGES-MSGNR
                  V1        = IT_MESSAGES-MSGV1
                  V2        = IT_MESSAGES-MSGV2
                  V3        = IT_MESSAGES-MSGV3
                  V4        = IT_MESSAGES-MSGV4
             IMPORTING
                  MSG       = L_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:/ l_msg.
      ENDLOOP.
    ENDFORM.                    " FORMAT_MESSAGE
    reward if helpful,
    keerthi

  • What is the Tcodes for Uploading of data using BDC & CATT

    PP members:
    I was going through the <b>cutover activities</b> ,  and what I understood is  we transfer all the legacy system data into SAP before going live
    The data upload follows certain steps (depends on the organizational design load strategies)
    First we upload all the master data ( material master, BOM, W/C's & Routings)
    Then the transaction data ( Ideally speaking, there should no open orders i.e. WIP as on the day of cutoff )
    If the WIP (Work in Process) is unavoidable then the materials consumed shall be treated as <b>materials of the previous stage</b> and necessary adjustments shall be made after cutover day
    At this point, I could not able to understand what does the author mean <b>materials of the previous stage</b>
    Now comming to the uploading of data into SAP from legacy system, we use tools like LSMW, CATT & BDC
    Is it a must to use <b>only LSMW tool</b> to upload master data or any other upload tools are fine
    Lastly,. I am not sure about the Tcode of CATT & BDC
    Summary of the questions:
    1.What does the author mean  <b>material of previous stage</b>, for WIP materials during cutover activities
    2. Is it mandatory to use only LSMW tool for uploading for master data
    3. What are the Tcodes for upload tools CATT & BDC ?
    Thanks for your time
    Suren R

    Dear,
    1.What does the author mean material of previous stage, for WIP materials during cutover activities - as i understood, what is the stage of material..like it must have gone through 2 work centers and other 2 is left. i.e. you need to create Production order with only 2 operation as other 2 is already over. - usually it is done in such a way that we will create Production order and confirm till 2 operations and WIp is calculated so thatb FI will tally the books in SAP and lagacy.
    2. Is it mandatory to use only LSMW tool for uploading for master data - no you can use any tool as required and suits yr requirement
    3. What are the Tcodes for upload tools CATT & BDC- BDC through a prog in SE38. CATT through - SCEM.

  • Unable to run BDC due to start-of-selection

    Hi Experts,
    I am running BDC for ROH type.
    The data is in the excel file so I am performing the below operation.
    In the BDC recording before perform open group there is "START-OF-SELECTION" and I also have a START-OF-SELECTION for excel uploading now how wud both would go together..
    My requirement is  to select the file through F4 then choose BDC type session or call transaction
    and upload the data
    Since I have 2 start-of-selection nothing happens after F8.
    Help is really appreciated and rewarded.
    Selection-screen begin of block b1 with frame title text-001.
    parameter: f_name type rlgrap-filename default 'D:\Cost_element_KS06.xls'.
    parameter : p_begcol type i default 1 no-display,
                p_begrow type i default 2 no-display,
                p_endcol type i default 8 no-display,
                p_endrow type i default 46 no-display.
    selection-screen end of block b1.
    at selection-screen on value-request for f_name.
    perform f_get_file using f_name.
    start-of-selection.
    perform f_xls_itab using f_name changing it_excel.
    perform f_move_data.
    include bdcrecx1.
    start-of-selection.
    perform open_group.
    loop at t_ks06 to wa.
    " Here I have the BDC recording recorderd through SHDB for ROH
    endloop.
    perform close_group.
    Ranjith N.

    Hi Avinash,
    I have made the following modification but stil the same.
    report ZNRD_BDC_UPD_COSTELEMENT
           no standard page heading line-size 255.
    * Declaring work area and internal tables
    data : begin of t_ks06 occurs 0,
           KOKRS type KOKRS,      " Controlling area
           KSTAR type KSTAR,      " Cost element
           DATAB type DATAB,      " Valid from date
           DATBI type DATBI,      " Valid to  date
           KTEXT type KTEXT,      " Name
           LTEXT type LTEXT,      " Description
           KATYP type KATYP,      " Cost element cat
           KOSTL type KOSTL,      " Cost center
           end of t_ks06.
    data : wa like line of t_ks06.
    data : it_excel type alsmex_tabline occurs 0 with header line.
    *data : flg_mv(1) type n value 0.    " Flag to check data Moved.
    selection-screen begin of block b1 with frame title text-001.
    parameter: f_name type rlgrap-filename default 'C:\Documents and Settings\Administrator\Desktop\Project_data\Cost_element_KS06.xls'.
    parameter : p_begcol type i default 1 no-display,
                p_begrow type i default 2 no-display,
                p_endcol type i default 8 no-display,
                p_endrow type i default 46 no-display.
    selection-screen end of block b1.
    " Iam performing all subroutines under at selection-screen and under start-of-selection Iam calling the bdc
    but still nothing happens. please help
    at selection-screen on value-request for f_name.
    perform f_get_file using f_name.
    perform f_xls_itab using f_name changing it_excel.
    perform f_move_data.
    *perform f_display_data.
    start-of-selection.
    perform open_group.
    loop at t_ks06 to wa.
    perform bdc_dynpro      using 'SAPLKMA4' '0200'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CSKBZ-KOKRS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'CSKBZ-KOKRS'
                                  wa-KOKRS.
    perform bdc_field       using 'CSKBZ-KSTAR'
                                  wa-KSTAR.
    perform bdc_field       using 'CSKBZ-DATAB_ANFO'
                                  wa-DATAB.
    perform bdc_field       using 'CSKBZ-DATBI_ANFO'
                                  wa-DATBI.
    perform bdc_dynpro      using 'SAPLKMA4' '0299'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CSKBZ-EIGEN'.
    perform bdc_field       using 'CSKBZ-KTEXT'
                                  wa-KTEXT.
    perform bdc_field       using 'CSKBZ-LTEXT'
                                  wa-LTEXT.
    perform bdc_field       using 'CSKBZ-KATYP'
                                  wa-KATYP.
    perform bdc_dynpro      using 'SAPLKMA4' '0299'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=VKON'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CSKBZ-KTEXT'.
    perform bdc_field       using 'CSKBZ-KTEXT'
                                  wa-KTEXT.
    perform bdc_field       using 'CSKBZ-LTEXT'
                                  wa-LTEXT.
    perform bdc_field       using 'CSKBZ-KATYP'
                                  wa-KATYP.
    perform bdc_dynpro      using 'SAPLKMA4' '0299'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CSKBZ-KOSTL'.
    perform bdc_field       using 'CSKBZ-KOSTL'
                                  wa-KOSTL.
    perform bdc_dynpro      using 'SAPLKMA4' '0299'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'CSKBZ-KOSTL'.
    perform bdc_field       using 'CSKBZ-KOSTL'
                                  wa-KOSTL.
    perform bdc_transaction using 'KA06'.
    endloop.
    perform close_group.
    include bdcrecx1.
    *&      Form  f_get_file
    *       text
    *      -->P_FILE_NAM  text
    form f_get_file  using    p_file_nam.
    call function 'KD_GET_FILENAME_ON_F4'
    exporting
       program_name        = syst-repid
       dynpro_number       = syst-dynnr
    *   FIELD_NAME          = ' '
    *   STATIC              = ' '
    *   MASK                = ' '
      changing
        file_name           = f_name
    exceptions
       mask_too_long       = 1
       others              = 2.
    endform.                    " f_get_file
    *&      Form  f_xls_itab
    *       text
    *      -->P_FILE_NAM  text
    *      <--P_IT_EXCEL  text
    form f_xls_itab  using    p_file_nam changing p_it_excel.
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      exporting
        filename                      = f_name
        i_begin_col                   = p_begcol
        i_begin_row                   = p_begrow
        i_end_col                     = p_endcol
        i_end_row                     = p_endrow
      tables
        intern                        = it_excel
    exceptions
       inconsistent_parameters       = 1
       upload_ole                    = 2
       others                        = 3.
    endform.                    " f_xls_itab
    *&      Form  f_move_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form f_move_data.
    data : lv_index type i.
    field-symbols <fs>.
    * Sorting the internal table
    sort it_excel by row col.
    clear it_excel.
    loop at it_excel.
      move it_excel-col to lv_index.
    * Assigning each record to the internal table row.
      assign component lv_index of structure wa to <fs>.
    * Assigning the field value to a field symbol
      move it_excel-value to <fs>.
      at end of row.
      append wa to t_ks06.
    *   flg_mv = 1.
      clear wa.
      endat.
    endloop.
    endform.                    " f_move_data
    *&      Form  f_display_data
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form f_display_data.
      write:/1 sy-uline(140).
      write:/1 sy-vline,  'Cont area',        " Controlling area
             16 sy-vline, 'Cost ele',         " Cost element
             31 sy-vline, 'Valid from',       " Valid from  date
             46 sy-vline, 'Valid to '  ,      " Valid to date
             61 sy-vline, 'Name',             "Cost element cat
             76 sy-vline, 'Description',      " Cost center
             101 sy-vline,  'Cost ele cat',   " Cost element cat
             126 sy-vline, 'Cost center',     " Cost center
             140 sy-vline.
    write:/1 sy-uline(140).
    skip 1.
    clear wa.
    loop at t_ks06 into wa.
      write:/2 sy-uline(139).
      write:/2  sy-vline,  wa-KOKRS,      " Controlling area
             16 sy-vline, wa-KSTAR,      " Cost element
             31 sy-vline, wa-DATAB,      " Valid from date
             46 sy-vline, wa-DATBI,      " Valid to date
             61 sy-vline, wa-KTEXT,      " Name
             76 sy-vline, wa-LTEXT,      " Description
             101 sy-vline, wa-KATYP,     " Cost element cat
             120 sy-vline, wa-KOSTL,     " Cost center
             140 sy-vline.
    endloop.
    endform.                    " f_display_data
    Regards,
    Ranjith

  • Unable to incorporate multiple data in BDC * URGENT*

    Hi EveryOne  .
      See the code. This code can do BDC for a single value of store and bonus buy no., in transaction  WPMA
    The current requirement is for a given store all bonus buy values should get populated and then executed each time store wise.
    Eg
        Store                            bonus buy values
        1001                               1
        1001                               2
         1001                              4
         1002                              A
         1002                             L
         1003                             6
         1003                             7
         1003                             H.
    See the code below, and tell me the necessary changes required!!
    report zwpma1
           no standard page heading line-size 255.
    type-pools slis.
    data: wt_fcat type slis_fieldcat_alv.
    data: it_fcat type slis_t_fieldcat_alv.
    data: cnt type sy-tabix.
    *include bdcrecx1.
    types: begin of ty_final,
           store(10) type c,
           docnum type docnum,
           bbynr type bbynr,
           end of ty_final.
    types: begin of ty_final1,
           store(10),
           bbynr type bbynr,
           end of ty_final1.
    data: wa_bonusbuy type zbonusbuy,
          it_bonusbuy type  standard table of zbonusbuy  with header line,
          it_bonusbuy1 type  standard table of ty_final1  with header line,
          it_t001w type  standard table of t001w  with header line,
          it_edidc type  standard table of edidc  with header line,
          it_edid4 type  standard table of edid4  with header line,
          it_final type  standard table of ty_final  with header line,
    *Work areas:
            wa_edidc type edidc,
            wa_edid4 type edid4,
            wa_final type ty_final.
    data :   it_bdcmsgcoll like bdcmsgcoll occurs 0 with header line.
    data: bdcdata like table of bdcdata with header line.
    data: lv_mode(1) value 'N'.
    data : mtext(100) type c,
           mvar1      like balm-msgv1,
           w_msg(200) type c.
    data : l_startt type sy-uzeit,   " Time before Recording
           l_endt type sy-uzeit,     " time after recording
           l_cdate type sy-datum.    " Current date
    start-of-selection.
      call function 'SAPGUI_PROGRESS_INDICATOR'
        exporting
          percentage = 100
          text       = 'Extracting Data.......  '.
      select werks  from t001w  into corresponding fields of table  it_t001w.
      delete adjacent duplicates from it_t001w  comparing werks.
      if not it_t001w[] is initial.
        select store bbynr mmid from  zbonusbuy  into corresponding fields of table it_bonusbuy for all
        entries in it_t001w where store = it_t001w-werks.
        if sy-subrc = 0.
          sort it_bonusbuy by store.
        endif.
      endif.
      refresh it_t001w.
      loop at it_bonusbuy.
        move-corresponding it_bonusbuy to it_bonusbuy1.
        append it_bonusbuy1.
        clear: it_bonusbuy, it_bonusbuy1.
      endloop.
      l_cdate = sy-datum.
      clear l_startt .
      l_startt = sy-uzeit.
      loop at it_bonusbuy.
    *break retaildev.
    *perform open_group.
        perform bdc_dynpro      using 'RWDPOSAN' '1000'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'SO_BBUY-LOW'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=ONLI'.
        perform bdc_field       using 'PA_VKORG'
                                      'HB00'.
        perform bdc_field       using 'PA_VTWEG'
                                      'H2'.
        perform bdc_field       using 'SO_FISEL-LOW'
                                 '1001'.
                                it_bonusbuy-store.
       LOOP AT   it_bonusbuy1 WHERE store = it_bonusbuy-store.
          if sy-subrc = 0.
            perform bdc_field       using 'PA_BBUY'
                                          'X'.
            perform bdc_field       using 'SO_BBUY-LOW'
                                 'TEST_00035'.
                                         it_bonusbuy1-bbynr.
                                          it_bonusbuy-bbynr.
          endif.
          clear it_bonusbuy1.
       ENDLOOP.
    *Refresh: it_bonusbuy1.
        clear bdcdata.
        call transaction 'WPMA' using bdcdata
             mode lv_mode
          UPDATE 'S'
             messages into  it_bdcmsgcoll.
        refresh bdcdata.
        clear it_bonusbuy.
      endloop.
      l_endt = sy-uzeit.
      break retaildev.
      select docnum
             direct
             credat
             cretim
             mestyp
             idoctp
             from edidc into corresponding fields of table it_edidc
             where
             credat = l_cdate and
             ( cretim  ge l_startt and cretim le l_endt )  and
             mestyp = 'WPDBBY'  and
             idoctp = 'WPDBBY01'.  "  "    l_startt and l_endt  and
      break retaildev.
      if sy-subrc = 0.
        select docnum
               counter
               segnum
               segnam
               sdata
               from edid4 into corresponding fields of table it_edid4 for all entries in it_edidc
               where
               docnum = it_edidc-docnum.
      endif.
    *Loop at it_final into wa_final.
      loop at it_edid4 into wa_edid4 where segnam = 'E1WPBB01'.
        wa_final-store = wa_edid4-sdata(10).
        wa_final-docnum = wa_edid4-docnum.
        wa_final-bbynr = wa_edid4-sdata+10(12).
        append wa_final to it_final.
      endloop.
      delete adjacent duplicates from it_final comparing docnum store bbynr.
      sort it_final by store.
      clear: wa_final,wa_edidc, wa_edid4.
      refresh : it_edid4, it_edidc.
    *ALV OutPut
      write :'Following are the Idocs posted successfully Storewise' .
      loop at it_final.
        write :  it_final-store , it_final-docnum , it_final-bbynr   .
      endloop.
    *Break retaildev.
      perform top_of_page.
      perform alv_layout-settings.
      perform zalv_fieldcatpopn using it_fcat.
      perform z_reuse_alv_grid_display.

    Have you tried serialization and sendingas an object using something like Zend AMF?
    Please mark this question as answered if this works for you.
    -Mr.12

  • Internal table in bdc

    I am new to the bdc .
    i have gone to SHDB and created a new recording  for the some T-code .
    After that i have created a prog (transfer from recording ) .
    i got some values in the file in my presenation server.
    i got default code generated .
    I have to declare the internal table of some time .
    may i know of which type should i declare my internal table ??
    My code ****************************************************************
    report ZRAJESH_BDC
           no standard page heading line-size 255.
    include bdcrecx1.
    start-of-selection.
    perform open_group.
    *******loop
    perform bdc_dynpro      using 'SAPMF02K' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-D0110'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  '12345'.
    perform bdc_field       using 'RF02K-D0110'
                                  'X'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-TELF2'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    perform bdc_field       using 'LFA1-ANRED'
                                  'Mr.'.
    perform bdc_field       using 'LFA1-NAME1'
                                  'RAJESH'.
    perform bdc_field       using 'LFA1-SORTL'
                                  'Q'.
    perform bdc_field       using 'LFA1-LAND1'
                                  'US'.
    perform bdc_field       using 'LFA1-SPRAS'
                                  'EN'.
    perform bdc_field       using 'LFA1-TELF2'
                                  '9033558227'.
    perform bdc_transaction using 'XK02'.
    perform close_group.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> NODATA.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.

    Hi,
    I have one simple  BDC Program  .
    Just you have to do recording by using SHDB Transaction Code.
    and Copy that program and do some modification by following my Program and upload data to that perticular transaction.
    before that u have to prepare data in Text file by using TAB Space .
    Below is the Code(I have used MM01 transaction)
    ******************************************************************************************8
    report ZBDCTEST no standard page heading line-size 255.
    ***DECLARING TABLES.
    TABLES : MARA.
    **DECLARING INTERNAL TABLE.
    DATA : BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARA-MATNR,
           MEINS LIKE MARA-MEINS,
           MATKL LIKE MARA-MATKL,
           Maktx like makt-maktx,
           SPART LIKE MARA-SPART,
           END OF ITAB.
    DATA BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       CODEPAGE                      = 'IBM'
       FILENAME                      = 'C:\TEST.TXT'
       FILETYPE                      = 'DAT'
      HEADLEN                       = ' '
      LINE_EXIT                     = ' '
      TRUNCLEN                      = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      DAT_D_FORMAT                  = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = ITAB
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      FILE_OPEN_ERROR               = 2
      FILE_READ_ERROR               = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      OTHERS                        = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *include bdcrecx1.
    *start-of-selection.
    *perform open_group.
    LOOP AT ITAB.
      REFRESH BDCDATA.
      perform bdc_dynpro      using 'SAPLMGMM' '0060'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RMMG1_REF-MATNR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=AUSW'.
      perform bdc_field       using 'RMMG1-MATNR'
                                    ITAB-MATNR.
      perform bdc_field       using 'RMMG1-MBRSH'
                                    'M'.
      perform bdc_field       using 'RMMG1-MTART'
                                    'FOOD'.
      perform bdc_dynpro      using 'SAPLMGMM' '0070'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MSICHTAUSW-DYTXT(02)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ENTR'.
      perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                                    'X'.
      perform bdc_field       using 'MSICHTAUSW-KZSEL(02)'
                                    'X'.
      perform bdc_dynpro      using 'SAPLMGMM' '4000'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SP02'.
      perform bdc_field       using 'MAKT-MAKTX'
                                    'T1003'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MARA-MATKL'.
      perform bdc_field       using 'MARA-MEINS'
                                    'BOX'.
      perform bdc_field       using 'MARA-MATKL'
                                     ITAB-MATKL.
      perform bdc_field       using 'MARA-SPART'
                                    ITAB-SPART.
      perform bdc_field       using 'MARA-MTPOS_MARA'
                                    'NORM'.
      perform bdc_dynpro      using 'SAPLMGMM' '4004'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'MAKT-MAKTX'.
      perform bdc_field       using 'MAKT-MAKTX'
                                    'T1003'.
    *perform bdc_transaction using 'MM01'.
    *perform close_group.
      CALL TRANSACTION 'MM01' USING BDCDATA MODE 'A'. "A= all screens ,N= no screens
    ENDLOOP.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM  = PROGRAM.
      BDCDATA-DYNPRO   = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      IF FVAL <> SPACE.
        CLEAR BDCDATA.
        BDCDATA-FNAM = FNAM.
        BDCDATA-FVAL = FVAL.
        APPEND BDCDATA.
      ENDIF.
    ENDFORM.
    if you want further help let me know
    Regards,
    Jak

  • BDC Call Transaction - Doc.No not getting generated in Message Internal tab

    Dear All,
    I am using BDC Call Transaction method for uploading data for transaction, Iam able to successfully capture the Error messages, sucess messages and the transaction number is also displayed for the bdc run in Mode A, but in case of scheduling the job in background, the Error messages are displayed but the transaction number is not captured in the message Internal table( BDCMSGCOLL).
    Kindly look into the matter and revert back for any further info.
    Regards
    Naresh

    Hi,
    Please try using the following kind of code in 'CALL TRANSACTION'
        opt-dismode = 'E'.     " Exclusive mode
        opt-defsize = 'X'.
        opt-updmode = 'S'.
        opt-nobinpt = ' '.
        CALL TRANSACTION transaction_code USING ft OPTIONS FROM opt
                                                                             MESSAGES INTO t_bdcmsgcoll .
    Hope this will work.
    Thanks,
    Leo

  • Deploing a BDC Model project to SharePoint Foundation 2010 usinging Visual Studio 2010

    Hello,
    I am tring to deploy external content type to Sharepoint 2010 foundation using Visual studio 2010 and I followed this:
    http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/04/02/deploy-a-bdc-model-project-to-sharepoint-foundation-2010-using-visual-studio-2010.aspx
    after completing procedure I have tried do deploy solution but I always get this exception:
     Error 1 Error occurred in deployment step 'Add Solution': Access denied by Business Data Connectivity.
        Error was encountered at or just before Line: '0' and Position: '0'.
      0 0 BdcModelProjectTest
    I have tried to grant myself permissions in Sharepoint central administration (
    http://blogs.msdn.com/b/ericwhite/archive/2010/06/11/access-denied-by-business-data-connectivity.aspx ) but when I click ok I get this exception
    No windows identity for damain\username. 0a193cf4-3811-4aa8-a657-0de3b8be3793
    07/04/2011 16:46:46.31  w3wp.exe (0x0828)                        0x1414 Business Connectivity Services Business Data                
     g0k9 High     Access Denied for User '0#.w|damain\username, which may be an impersonation by damain\username
    I am really hopeless, can anyone help?

    Hi,
    It seems that an account are you using to deploy solution doesn't have sufficient permission in the BDC Metadata Store. In order to assign permission you should open Central Administration->Application Management->Manage Service Application->Business
    Data Connectivity Service->Click Set Metada Store Permission on the ribbon->Set Permission you need and tick the checkbox "Propagate permission to all..."
    Dmitry
    Lightning
    Tools Check out our SharePoint tools and web parts

  • How to delete record from table control in BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    Hi,
    While doing recording check for Filter button available for the table control, if it available then do the recording for the same.
    Once it is done while passing the data from internal table put the value into Filter field.
    Hope it resolves your issue.
    Thanks & Regards.
    Nagaraj Kalbavi

  • How to delete record from table control using BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    One option is to identify the table and find out the location as the number of row which should be deleted from the table and then in the bdc program instead of postioning the cursor on the row 1(using the statement perform bdc_cursor ....(01)), replace the 01 with the row number.
    Second option is that if a filter control is available for the table control, then filter the data each and every time with the material number to be deleted and then delete the first row.
    Regards
    Farzan

  • How to put a report which contains code for  BDC in background

    Hello Experts ,
    Please provide your valuable opinions on following issue,
    My BDC execution is taking longer time and it gives time out error. To avoid this problem i have created a separate report which l contains the BDC code (Call transaction ) and  i have put this report for background execution. But upon doing this My BDC code is not performing the transaction call which it was performing when it was executed individually.  In sm37 it shown the job that i am creating but nothing is actually happening as a result of transaction call.
    The code that i have written is :
    RFC code
    SUBMIT ZREPORT AND RETURN.
    RFC end
    Z_REPORT .
    PERFORM open_job.
    PERFORM get_print_parameters.
    PERFORM job_submit. here in Submit i have specified the another report name(zbdcreport) which contains the actual logic for bdc 
    PERFORM job_close.
    Report END.
    zbdcreport
    The call transaction is as follows :
    ( CALL TRANSACTION TCODE USING BDCDATA
                         MODE   'N' "CTUMODE "N
                         UPDATE 'S' "CUPDATE "S
                         MESSAGES INTO MESSTAB .)
    end zbdcreport
    Can anybody provide the reason for the error . 
    Regards,
    Uma

    Hi
    Check the code using this...
    DATA: number           TYPE tbtcjob-jobcount,
          name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.

  • Data upload for vendor balances using BDC

    hi abap experts,
    I have a requirement on data uploading using BDC.
    For the vendor balances ie. for transaction FBL1N  ( I was given a template for vendor balance upload and need to write a BDC program for that ) I need upload the exsisting transaction data to the system. is recording necessary for this?
    can u pls help me with step by step process for vendor balance uploading.
    Thanks,
    Hema.

    Hi
    Please follow the following Steps:
    Steps for recording:
    Step1: Goto TCODE SHDB
    Step2: Click on New Recording
    Step3: Give the necessary Details such as TOCDE, Desc, ...
    Step4: Do the screen by screen recording.(Please avoid extra screen to appear)
    Step5: Save the recording.
    Step6. Select the recording and click on Program button on toolbar.
    Step7: Give the Program name and click on radio button Transfer from recording.
    Step 8: It will open a new session with SE38 and a program with the recoding.
    Step 9: then just add the basic code for BDC.
    Regards,
    Lokesh

Maybe you are looking for

  • Lightroom 5.2 map module not displaying maps

    I am having all sorts of problems with Lightroom 5.2 and wish I'd just stayed with Lightroom 4. I've already posted about not being able to import directly from an SD card in my laptops reader, and have at least found a work around to that (copy file

  • Apps not yet available on OS7

    Having purchased the latest BlackBerry on OS7 I am disappointed to find that Apps I want to use advise me they are for OS5/6 only and not available on OS7.  How long does it take for Apps to be available on new software and is there a lesson in not g

  • IPad does not hold a charge. Anyone know why?

    My ipad does not hold a charge.  I charged it yesterday and didnt use it at all today plus I even shut it down all the way not just sleep. 

  • Error when cancelling cleared invoice

    Hi, I got problem when cancelling cleared invoice. System is pop up an error log : 'Cancellation document is not the same as the original billing doc. $$$' , and 'Data inconsistency during processing of document $$$'. I have not found the clue yet bu

  • HT1541 There is no way to resend an email for a gift card given to someone? Need a help

    Could anyone help please! I gave a card gift to someone and she didn't receive any email! When going to the iTunes or App Store and following the instructions from apple to resend the email, there is no option to resend at all?! Only it's written don