In BDC'S how to handle Table control

Hi,
     I want to know the concept and code for BDC's in Table control steps(MM01,VA01) and coding.Please its very Urgent.

Hi Raghavendra,
Go through this program mm01.
rePORT ymmbdcmm01
       NO STANDARD PAGE HEADING LINE-SIZE 255.
*&        Table Declarations                                          *
TABLES:rmmg1,makt,mara,mvke, marc,mbew,t100.
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
*&        Data Declarations                                           *
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: BEGIN OF it_itab OCCURS 0,
        matnr TYPE rmmg1-matnr,
        mbrsh TYPE rmmg1-mbrsh,
        mtart TYPE rmmg1-mtart,
        werks TYPE rmmg1-werks,
        lgort TYPE rmmg1-lgort,
        vkorg TYPE rmmg1-vkorg,
        vtweg TYPE rmmg1-vtweg,
        maktx TYPE makt-maktx,
        meins TYPE mara-meins,
        matkl TYPE mara-matkl,
        spart TYPE mara-spart,
      GEWEI TYPE MARA-GEWEI,
        dwerk TYPE mvke-dwerk,
        versg TYPE mvke-versg,
        mtpos TYPE mvke-mtpos,
        mtvfp TYPE marc-mtvfp,
        tragr TYPE mara-tragr,
        ladgr TYPE marc-ladgr,
        sernp TYPE marc-sernp,
        txline(25), "added
      kordb ,
        mprof TYPE mara-mprof,
        ekgrp TYPE marc-ekgrp,
        dismm TYPE marc-dismm,
        dispo TYPE marc-dispo,
        disls TYPE marc-disls,
        mabst(13) TYPE c,
        beskz TYPE marc-beskz,
        sobsl TYPE marc-sobsl,
        lgpro TYPE marc-lgpro,
        dzeit TYPE c,
        plifz(3) TYPE c,
        webaz TYPE c,
        fhori TYPE marc-fhori,
        eisbe TYPE c,
        strgr(2) TYPE c,
        vrmod TYPE c,
        vint1(3),
        vint2(3),
        wzeit(3),
        sbdkz TYPE marc-sbdkz,
        bklas TYPE mbew-bklas,
       vprsv TYPE mbew-vprsv,
        verpr(11),
       peinh TYPE c,
        ekalr TYPE mbew-ekalr,
        losgr TYPE c,
        RGEKZ(1),
        fevor(3),
      END OF it_itab.
*decl of internal table of table control for BDCDATA & BDCMSGCOLL
DATA : BEGIN OF bdcdata OCCURS 0.
        INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA:it_msgtab TYPE STANDARD TABLE OF  bdcmsgcoll WITH HEADER LINE,
     it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
DATA : fld(50) TYPE c,
       cnt(2) TYPE n,
      l_mstring(150).
START-OF-SELECTION.
*&        File uploading  from  xlsheet  to sap                                          *
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
    I_FIELD_SEPERATOR        =
      i_line_header            =  'X'
      i_tab_raw_data           =  it_raw
      i_filename               =  'C:\Documents and Settings\sapthamm\Desktop\mm02.xls'
    TABLES
      i_tab_converted_data     = it_itab
   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.
*&        Splitting the Internal Table                                *
  LOOP AT t_data.
    SPLIT t_data-data AT cl_abap_char_utilities=>horizontal_tab INTO
       it_itab-matnr
       it_itab-mbrsh
       it_itab-mtart
       it_itab-werks
       it_itab-lgort
       it_itab-vkorg
       it_itab-vtweg
       it_itab-maktx
       it_itab-meins
       it_itab-matkl
       it_itab-spart
       it_itab-GEWEI
       it_itab-dwerk
       it_itab-versg
       it_itab-mtpos
       it_itab-mtvfp
       it_itab-tragr
       it_itab-ladgr
       it_itab-sernp
       it_itab-mprof
       it_itab-ekgrp
       it_itab-dismm
       it_itab-dispo
       it_itab-disls
       it_itab-mabst
       it_itab-beskz
       it_itab-sobsl
       it_itab-lgpro
       it_itab-dzeit
       it_itab-plifz
       it_itab-webaz
       it_itab-fhori
       it_itab-eisbe
       it_itab-strgr
       it_itab-vrmod
       it_itab-vint1
       it_itab-vint2
       it_itab-wzeit
       it_itab-sbdkz
       it_itab-bklas
    it_itab-vprsv
      it_itab-peinh
       it_itab-ekalr
       it_itab-losgr
    APPEND it_itab.
    CLEAR: it_itab,
           t_data-data.
  ENDLOOP.
*perform open_dataset using dataset.
*perform open_group.
*do.
*read dataset dataset into it_itab.
*if sy-subrc <> 0. exit. endif.
*&        it_itabing of Material Type-HALB                                  *
  LOOP AT it_itab.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0060'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'RMMG1-MATNR'
                                  it_itab-matnr.
    PERFORM bdc_field       USING 'RMMG1-MBRSH'
                                  it_itab-mbrsh.
    PERFORM bdc_field       USING 'RMMG1-MTART'
                                  it_itab-mtart.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(17)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=P+'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(01)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(02)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(04)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(05)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(06)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(08)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(09)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(12)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(13)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(14)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(15)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(17)'
                                  'X'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0070'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(09)'.
    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_field       USING 'MSICHTAUSW-KZSEL(06)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(07)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(08)'
                                  'X'.
    PERFORM bdc_field       USING 'MSICHTAUSW-KZSEL(09)'
                                  'X'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '0080'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RMMG1-VTWEG'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM bdc_field       USING 'RMMG1-WERKS'
                                  it_itab-werks.
    PERFORM bdc_field       USING 'RMMG1-LGORT'
                                  it_itab-lgort.
    PERFORM bdc_field       USING 'RMMG1-VKORG'
                                  it_itab-vkorg.
    PERFORM bdc_field       USING 'RMMG1-VTWEG'
                                  it_itab-vtweg.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4004'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARA-SPART'.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARA-MATKL'
                                  it_itab-matkl.
    PERFORM bdc_field       USING 'MARA-SPART'
                                  it_itab-spart.
    PERFORM bdc_field       USING 'MARA-GEWEI'
                                  'kg'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4004'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARA-SPART'
                                  it_itab-spart.
    PERFORM bdc_field       USING 'MVKE-DWERK'
                                  it_itab-dwerk.
    PERFORM bdc_field       USING 'MARA-MATKL'
                                  it_itab-matkl.
    PERFORM bdc_field       USING 'MVKE-SKTOF'
                                  'X'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MG03STEUER-TAXKM(02)'.
    PERFORM bdc_field       USING 'MG03STEUER-TAXKM(01)'
                                  '0'.
    PERFORM bdc_field       USING 'MG03STEUER-TAXKM(02)'
                                  '1'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4200'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
*perform bdc_field       using 'MAKT-MAKTX'
                             it_itab-MAKTX_040.
*perform bdc_field       using 'BDC_CURSOR'
                             'MG03STEUER-TAXKM(05)'.
    PERFORM bdc_field       USING 'MG03STEUER-TAXKM(03)'
                                  '1'.
    PERFORM bdc_field       USING 'MG03STEUER-TAXKM(04)'
                                  '1'.
    PERFORM bdc_field       USING 'MG03STEUER-TAXKM(05)'
                                  '0'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARA-SPART'
                                  it_itab-spart.
    PERFORM bdc_field       USING 'MVKE-DWERK'
                                  it_itab-dwerk.
    PERFORM bdc_field       USING 'MARA-MATKL'
                                  it_itab-matkl.
    PERFORM bdc_field       USING 'MVKE-SKTOF'
                                  'X'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MVKE-MTPOS'.
    PERFORM bdc_field       USING 'MVKE-VERSG'
                                  it_itab-versg.
    PERFORM bdc_field       USING 'MVKE-MTPOS'
                                  it_itab-mtpos.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARA-GEWEI'
                                  'KG'.
    PERFORM bdc_field       USING 'MARC-MTVFP'
                                  it_itab-mtvfp.
    PERFORM bdc_field       USING 'MARA-TRAGR'
                                  it_itab-tragr.
    PERFORM bdc_field       USING 'MARC-LADGR'
                                  it_itab-ladgr.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARC-SERNP'.
    PERFORM bdc_field       USING 'MARC-SERNP'
                                  it_itab-sernp.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4040'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=LTEX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_dynpro      USING 'SAPLSTXX' '1100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=TXVB'.
    PERFORM bdc_field       USING 'RSTXT-TXLINE(02)'
                                  'pcb assembly'.
    PERFORM bdc_dynpro      USING 'SAPLSTXX' '1100'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'RSTXT-TXLINE(02)'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=TXBA'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4040'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=SP09'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARC-EKGRP'
                                  it_itab-ekgrp.
    PERFORM bdc_field       USING 'MARA-MATKL'
                                  it_itab-matkl.
    PERFORM bdc_field       USING 'MARC-KORDB'
                                  'X'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARA-MPROF'.
    PERFORM bdc_field       USING 'MARA-MPROF'
                                  it_itab-mprof.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARC-EKGRP'
                                  it_itab-ekgrp.
    PERFORM bdc_field       USING 'MARC-DISMM'
                                  it_itab-dismm.
    PERFORM bdc_field       USING 'MARC-DISPO'
                                  it_itab-dispo.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARC-MABST'.
    PERFORM bdc_field       USING 'MARC-DISLS'
                                  it_itab-disls.
    PERFORM bdc_field       USING 'MARC-MABST'
                                  it_itab-mabst.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARC-BESKZ'
                                  it_itab-beskz.
    PERFORM bdc_field       USING 'MARC-SOBSL'
                                  it_itab-sobsl.
    PERFORM bdc_field       USING 'MARC-LGPRO'
                                  it_itab-lgpro.
    if it_itab-sernp = 'TJSL'.
    PERFORM bdc_field       USING 'MARC-RGEKZ'
    ELSE.
    PERFORM bdc_field       USING 'MARC-RGEKZ'
                                  '1'.
    ENDIF.
    PERFORM bdc_field       USING 'MARC-DZEIT'
                                  it_itab-dzeit.
    PERFORM bdc_field       USING 'MARC-PLIFZ'
                                  it_itab-plifz.
    PERFORM bdc_field       USING 'MARC-WEBAZ'
                                  it_itab-webaz.
    PERFORM bdc_field       USING 'MARC-FHORI'
                                  it_itab-fhori.
    PERFORM bdc_field       USING 'MARC-EISBE'
                                  it_itab-eisbe.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARC-PERKZ'
                                  'M'.
    PERFORM bdc_field       USING 'MARC-STRGR'
                                  it_itab-strgr.
    PERFORM bdc_field       USING 'MARC-VRMOD'
                                  it_itab-vrmod.
    PERFORM bdc_field       USING 'MARC-VINT1'
                                  it_itab-vint1.
    PERFORM bdc_field       USING 'MARC-VINT2'
                                  it_itab-vint2.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARC-WZEIT'.
    PERFORM bdc_field       USING 'MARC-MTVFP'
                                  it_itab-mtvfp.
    PERFORM bdc_field       USING 'MARC-WZEIT'
                                  it_itab-wzeit.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MARC-SBDKZ'.
    PERFORM bdc_field       USING 'MARC-SBDKZ'
                                  it_itab-sbdkz.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
     PERFORM bdc_field       USING 'MARC-FEVOR'
                                   '001'.
    PERFORM bdc_field       USING 'MARC-LGPRO'
                                  it_itab-lgpro.
    PERFORM bdc_field       USING 'MARC-SERNP'
                                  it_itab-sernp.
    PERFORM bdc_field       USING 'MARC-DZEIT'
                                  it_itab-dzeit.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
*perform bdc_field       using 'MARA-IPRKZ'
                              it_itab-IPRKZ.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-GEWEI'
                                  'KG'.
    PERFORM bdc_field       USING 'MARC-SERNP'
                                  it_itab-sernp.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MARA-SPART'
                                  it_itab-spart.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MBEW-VPRSV'.
    PERFORM bdc_field       USING 'MBEW-BKLAS'
                                  it_itab-bklas.
*perform bdc_field       using 'MBEW-EKLAS'
                             it_itab-EKLAS.
    PERFORM bdc_field       USING 'MBEW-VPRSV'
                                  'v'.
    PERFORM bdc_field       USING 'MBEW-PEINH'
                                  '1'.
perform bdc_field       using 'MBEW-VERPR'
                              it_itab-VERPR.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MAKT-MAKTX'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'MARA-MEINS'
                                  it_itab-meins.
    PERFORM bdc_field       USING 'MBEW-EKALR'
                                  'X'.
    PERFORM bdc_field       USING 'MARC-AWSLS'
                                  '000001'.
    PERFORM bdc_field       USING 'MARC-LOSGR'
                                  '1'.
    PERFORM bdc_dynpro      USING 'SAPLMGMM' '4000'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM bdc_field       USING 'MAKT-MAKTX'
                                  it_itab-maktx.
    PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MBEW-ZPLPR'.
*perform bdc_field       using 'MBEW-ZPLPR'
                             '6000'.
    PERFORM bdc_field       USING 'MBEW-BKLAS'
                                  it_itab-bklas.
    PERFORM bdc_field       USING 'MBEW-VPRSV'
                                  'V'.
    PERFORM bdc_field       USING 'MBEW-PEINH'
                                   '1'.
    PERFORM bdc_dynpro      USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=YES'.
    CALL TRANSACTION 'MM01' USING bdcdata MODE 'A'
                                          UPDATE 'S'
                                         MESSAGES  INTO it_msgtab.
    CLEAR bdcdata[].
    CLEAR it_itab.
PERFORM error.
  ENDLOOP.
*&        Declaration of Error Handling                               *
   i
   it_msgtab1-msgv1 =  it_msgtab-msgv1.
   it_msgtab1-msgv2 =  it_msgtab-msgv2.
   it_msgtab1-msgv3 =  it_msgtab-msgv3.
   APPEND it_msgtab1.
ENDLOOP.
download error message to a file by using function module
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
   BIN_FILESIZE                    =
      filename                        = 'C:\Documents and Settings\sapthamm\Desktop\error.xls'
     filetype                        = 'ASC'
   APPEND                          = ' '
     write_field_separator           = 'X'
   HEADER                          = '00'
   TRUNC_TRAILING_BLANKS           = ' '
   WRITE_LF                        = 'X'
   COL_SELECT                      = ' '
   COL_SELECT_MASK                 = ' '
   DAT_MODE                        = ' '
   CONFIRM_OVERWRITE               = ' '
   NO_AUTH_CHECK                   = ' '
   CODEPAGE                        = ' '
   IGNORE_CERR                     = ABAP_TRUE
   REPLACEMENT                     = '#'
   WRITE_BOM                       = ' '
   TRUNC_TRAILING_BLANKS_EOL       = 'X'
   WK1_N_FORMAT                    = ' '
   WK1_N_SIZE                      = ' '
   WK1_T_FORMAT                    = ' '
   WK1_T_SIZE                      = ' '
   WRITE_EOL                       = ABAP_TRUE
IMPORTING
   FILELENGTH                      =
    TABLES
      data_tab                        = it_mess
   FIELDNAMES                      =
EXCEPTIONS
   FILE_WRITE_ERROR                = 1
   NO_BATCH                        = 2
   GUI_REFUSE_FILETRANSFER         = 3
   INVALID_TYPE                    = 4
   NO_AUTHORITY                    = 5
   UNKNOWN_ERROR                   = 6
   HEADER_NOT_ALLOWED              = 7
   SEPARATOR_NOT_ALLOWED           = 8
   FILESIZE_NOT_ALLOWED            = 9
   HEADER_TOO_LONG                 = 10
   DP_ERROR_CREATE                 = 11
   DP_ERROR_SEND                   = 12
   DP_ERROR_WRITE                  = 13
   UNKNOWN_DP_ERROR                = 14
   ACCESS_DENIED                   = 15
   DP_OUT_OF_MEMORY                = 16
   DISK_FULL                       = 17
   DP_TIMEOUT                      = 18
   FILE_NOT_FOUND                  = 19
   DATAPROVIDER_EXCEPTION          = 20
   CONTROL_FLUSH_ERROR             = 21
   OTHERS                          = 22
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*&      Form  BDC_DYNPRO
      text
     -->PROGRAM    text
     -->DYNPRO     text
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 <> .
  CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  APPEND bdcdata.
ENDIF.
ENDFORM.                    "BDC_FIELD
  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.
LOOP AT it_msgtab.
Rewords some points.
rgds,
P.Naganjana reddy

Similar Messages

  • How to handle table control in BDC while uploading item details for anorder

    How to handle table control in BDC while uploading item details for an order?
    What is the use of CTU_PARAMS structure in BDC?
    In Finance I have done some changes to the layout set by coping to a zscript(duning letter) and how can assign the print program?
    What is the process to test the finance script?
    How can I see the print preview whether it is coming correctly or not?
    Thanks in advance.
    Regards.
    Abhilash.

    hi,
    for the bdc control refer the following link:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    ctu_params:
    refer to the link
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/dataTransfers-LSMW%2CALE%2C+BDC
    reward if useful,
    thanks and regards

  • How to handle Table control in BDC

    How to handle Table control in BDC

    HI,
    Table Control in BDC
    HI,
    Refer the link:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    The concept is easy: it has to indicate the index of the table control in the field name, so if you have to populate the first record of table control:
    BDC-FIELDNAME = <FIELDNAME>(01).
    If you fill the second row:
    BDC-FIELDNAME = <FIELDNAME>(02).
    and so....
    Now the problem is usually on how many records you have to load, because u can fill only the rows of table control available in the screen, If you have more records than it can be displayed yuo have to simulate the command to go next page.
    The number of recod can be displayed can depend on pc resolution and many program haven't command to go to next page (in this case it could be impossible create a BDC program9.
    A way to create a bdc program resolution indipendent is to work on the first and second row.
    - Place the first hit in the first row of bdc;
    - Place the second insert in the second row of bdc;
    - Place the last hit to the top of table control;
    - Place the next hit in the second row;
    - Place the last hit to the top of table control;
    - Place the next hit in the second row;
    - .... and so
    For more info: Search in SDN with TABLE CONTROL IN BDC.
    Will get a lot of related links.
    <b>Reward points if this Helps.
    Manish</b>

  • How to handle Table control in BDC? Difference between BDC & LSMW?

    Hi
    How to handle Table control in BDC? Difference between BDC & LSMW?
    Regards,
    Raghu

    Hi ,
    the diff b/w normal BDC and with table control is that with table control u can enter as many lineitems as u want..so during recording if u r entering 3 line items..then the program will show (1), (2) and (3) with that.
    chane that fixed no to variable.
    check that sample code.
    in this for new customer...any no of items can be entered.
    LOOP AT t_cusdata.
        REFRESH t_bdcdata.
        ON CHANGE OF t_cusdata-kunnr.
    initial screen.
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0100'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MV10A-VTWEG'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '/00'.
          PERFORM bdc_field       USING 'MV10A-KUNNR'
                                  t_cusdata-kunnr.
          PERFORM bdc_field      USING 'MV10A-VKORG'
                                  t_cusdata-vkorg.     "'HCL'.
          PERFORM bdc_field       USING 'MV10A-VTWEG'
                                  t_cusdata-vtweg.     "'HL'.
          DATA: fnam(20) TYPE c,
                fnam1(20) TYPE c,
                idx(2) TYPE c.
          MOVE 1 TO idx.
          LOOP AT t_matdata WHERE kunnr = t_cusdata-kunnr.
            PERFORM bdc_dynpro      USING 'SAPMV10A' '0200'.
            CONCATENATE 'MV10A-KDMAT(' idx ')' INTO fnam.
            PERFORM bdc_field       USING 'BDC_CURSOR'
                                          fnam.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                           '/00'.
            CONCATENATE 'MV10A-MATNR(' idx ')' INTO fnam1.
            PERFORM bdc_field       USING fnam1
                                          t_matdata-matnr.      "'FIN50'.
            PERFORM bdc_field       USING fnam
                                          t_matdata-kdmat.  "'ABCD'.
            idx = idx + 1.
          ENDLOOP.
          PERFORM bdc_dynpro      USING 'SAPMV10A' '0200'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                  'MV10A-MATNR(01)'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                  '=SICH'.
          CALL TRANSACTION 'VD51' USING t_bdcdata MODE 'A' .
                                        UPDATE 'S' MESSAGES INTO t_err_mes.
    Regards,
    Sonika

  • How to handle Table controls with XD01 in BDC

    How to handle Table controls with XD01 in BDC - If there are more than 5/6 records in Table control. - Can any one explain it with a piece of code plz..
    Thanks & Regards,
    Krishna Chaitanya

    Hi
    check this code...viz for xko1....
    DATA: BEGIN OF it_xk01 OCCURS 0,
            f1(1),
            f2(5),
            f3(5),
            f4(9),
            f5(9),
          END OF it_xk01.
    DATA: v_count(2) VALUE '00',
          v_koinh(14),
          v_banks(14),
          v_bankn(14),
          v_bankl(14),
          it_bdcdata TYPE STANDARD TABLE OF bdcdata WITH HEADER LINE,
          wa_ctuparams type ctu_params.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_f4.
    START-OF-SELECTION.
      PERFORM upload_data.
    END-OF-SELECTION.
      LOOP AT it_xk01.
        IF it_xk01-f1 = 'H'.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0100'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'RF02K-KTOKK'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING 'RF02K-KTOKK'
                                        it_xk01-f2.
        ENDIF.
        IF it_xk01-f1 = 'N'.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0110'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'LFA1-PSTLZ'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=VW'.
          PERFORM bdc_field       USING 'LFA1-ANRED'
                                        'Mr'.
          PERFORM bdc_field       USING 'LFA1-NAME1'
                                        it_xk01-f2.
          PERFORM bdc_field       USING 'LFA1-SORTL'
                                        it_xk01-f3.
          PERFORM bdc_field       USING 'LFA1-PSTLZ'
                                        it_xk01-f4.
          PERFORM bdc_field       USING 'LFA1-LAND1'
                                        it_xk01-f5.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0120'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'LFA1-KUNNR'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=VW'.
        ENDIF.
        IF it_xk01-f1 = 'I'.
          v_count = v_count + 1.
          IF v_count le 5.
          CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
          CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
          CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
          CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
          CONDENSE v_koinh NO-GAPS.
          CONDENSE v_banks NO-GAPS.
          CONDENSE v_bankl NO-GAPS.
          CONDENSE v_bankn NO-GAPS.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                         v_koinh.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM bdc_field       USING  v_banks
                                        it_xk01-f2.
          PERFORM bdc_field       USING  v_bankl
                                        it_xk01-f3.
          PERFORM bdc_field       USING  v_bankn
                                        it_xk01-f4.
          PERFORM bdc_field       USING  v_koinh
                                        it_xk01-f5.
          else.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                         v_koinh.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=P+'.
          v_count = 1.
          PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                         v_koinh.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
          CONCATENATE 'LFBK-KOINH(' v_count ')' INTO v_koinh.
          CONCATENATE 'LFBK-BANKS(' v_count ')' INTO v_banks.
          CONCATENATE 'LFBK-BANKN(' v_count ')' INTO v_bankn.
          CONCATENATE 'LFBK-BANKL(' v_count ')' INTO v_bankl.
          CONDENSE v_koinh NO-GAPS.
          CONDENSE v_banks NO-GAPS.
          CONDENSE v_bankl NO-GAPS.
          CONDENSE v_bankn NO-GAPS.
          PERFORM bdc_field       USING  v_banks
                                        it_xk01-f2.
          PERFORM bdc_field       USING  v_bankl
                                        it_xk01-f3.
          PERFORM bdc_field       USING  v_bankn
                                        it_xk01-f4.
          PERFORM bdc_field       USING  v_koinh
                                        it_xk01-f5.
          ENDIF.
        ENDIF.
        CLEAR it_xk01.
      ENDLOOP.
      PERFORM bdc_dynpro      USING 'SAPMF02K' '0130'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                         v_koinh.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '/00'.
      perform bdc_dynpro      using 'SAPLSPO1' '0300'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=YES'.
      wa_ctuparams-DISMODE = 'A'.
      wa_ctuparams-UPDMODE = 'S'.
      wa_ctuparams-DEFSIZE = 'X'.
      CALL TRANSACTION 'XK01' USING it_bdcdata  MODE 'A'
                                                 UPDATE 'S'.
    options from wa_ctuparams.
    MODE 'A'
                                                UPDATE 'S'.
    *&      Form  upload_data
          text
    FORM upload_data .
      DATA: lv_infile TYPE string.
      lv_infile = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = lv_infile
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = it_xk01.
      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.                    " upload_data
    *&      Form  get_f4
          text
    FORM get_f4 .
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         program_name        = syst-cprog
         dynpro_number       = syst-dynnr
        FIELD_NAME          = ' '
       IMPORTING
         file_name           = p_file.
    ENDFORM.                                                    " get_f4
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR it_bdcdata.
      it_bdcdata-program  = program.
      it_bdcdata-dynpro   = dynpro.
      it_bdcdata-dynbegin = 'X'.
      APPEND it_bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
    IF FVAL <> NODATA.
      CLEAR it_bdcdata.
      it_bdcdata-fnam = fnam.
      it_bdcdata-fval = fval.
      APPEND it_bdcdata.
    ENDIF.
    ENDFORM.                    "BDC_FIELD
    *H     0302
    *N     sdng     dddsj     500020     IN
    *I     IN     ICICI     734897597     xyz
    *I     IN     SBH     768346687     abc
    *I     IN     SBI     345687346     fgh
    *I     IN     SBH     763846878     ujhgf
    *I     IN     HSBC     797893778     fvdg
    *I     IN     HDFC     723678638     fdgf
    *I     IN     4444     435645646     fgfg
    *I     IN     3400     763468768     gfgfg

  • Hi abapers how to handle table control in bdc

    hi experts please guide me
    how to handle table control in bdc? could u please explain me briefly  
    thanks and regards

    sayeed,
    Go thru this code it may help you. check bold code for the table control..
    report zsunil_bdc
    no standard page heading line-size 255.
    INTERNAL TABLES *
    DATA: BEGIN OF IT_KNA1 OCCURS 0,
    CUSTOMER LIKE RF02D-KUNNR,
    COMPANY_CODE LIKE RF02D-BUKRS,
    ACCOUNT_GROUP LIKE RF02D-KTOKD,
    TITLE LIKE KNA1-ANRED,
    NAME LIKE KNA1-NAME1,
    SEARCH_TERM LIKE KNA1-SORTL,
    STREET LIKE KNA1-STRAS,
    CITY LIKE KNA1-ORT01,
    POSTAL_CODE LIKE KNA1-PSTLZ,
    COUNTRY LIKE KNA1-LAND1,
    LANGUAGE_KEY LIKE KNA1-SPRAS,
    CNTRY LIKE KNBK-BANKS,
    BANK_KEY LIKE KNBK-BANKL,
    BANK_ACCOUNT LIKE KNBK-BANKN,
    REC_ACCOUNT LIKE KNB1-AKONT,
    END OF IT_KNA1.
    DATA: IT_BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
    DATA: IT_MESSAGES TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    SELECTION SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\CUSTOMER.TXT'
    OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION SCREEN *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    PERFORM HELP_FILE USING P_FILE.
    START OF SELECTION *
    START-OF-SELECTION.
    *UPLOADING THE FILE FROM WORKSTATION
    PERFORM UPLOAD_FILE USING P_FILE.
    *POPULATING DATA.
    PERFORM POPULATE_FILE.
    *& Form HELP_FILE
    text
    -->P_P_FILE text
    form HELP_FILE 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. " HELP_FILE
    *& Form UPLOAD_FILE
    text
    -->P_P_FILE text
    form UPLOAD_FILE using p_p_file.
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    CODEPAGE = ' '
    FILENAME = 'P_P_FILE'
    FILETYPE = 'DAT'
    ITEM = ' '
    FILEMASK_MASK = ' '
    FILEMASK_TEXT = ' '
    FILETYPE_NO_CHANGE = ' '
    FILEMASK_ALL = ' '
    FILETYPE_NO_SHOW = ' '
    LINE_EXIT = ' '
    USER_FORM = ' '
    USER_PROG = ' '
    SILENT = 'S'
    IMPORTING
    FILESIZE =
    CANCEL =
    ACT_FILENAME =
    ACT_FILETYPE =
    TABLES
    data_tab = IT_KNA1
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 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.
    endform. " UPLOAD_FILE
    *& Form POPULATE_FILE
    text
    --> p1 text
    <-- p2 text
    form POPULATE_FILE .
    DATA: L_STRING TYPE STRING,
    L_COUNTER(2) TYPE N,
    V_INDEX TYPE SY-TABIX.
    LOOP AT IT_KNA1.
    V_INDEX = SY-TABIX.
    AT NEW CUSTOMER.
    READ TABLE IT_KNA1 INDEX V_INDEX.
    IF SY-SUBRC = 0.
    perform bdc_dynpro using 'SAPMF02D' '0105'.
    perform bdc_field using 'BDC_CURSOR'
    'RF02D-KTOKD'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RF02D-KUNNR'
    IT_KNA1-CUSTOMER.
    perform bdc_field using 'RF02D-BUKRS'
    IT_KNA1-COMPANY_CODE.
    perform bdc_field using 'RF02D-KTOKD'
    IT_KNA1-ACCOUNT_GROUP.
    *PERFORM BDC_FIELD USING 'RF02D-D0130'
    'X'.
    perform bdc_dynpro using 'SAPMF02D' '0110'.
    perform bdc_field using 'BDC_CURSOR'
    'KNA1-SPRAS'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'KNA1-ANRED'
    IT_KNA1-TITLE.
    perform bdc_field using 'KNA1-NAME1'
    IT_KNA1-NAME.
    perform bdc_field using 'KNA1-SORTL'
    IT_KNA1-SEARCH_TERM.
    perform bdc_field using 'KNA1-STRAS'
    IT_KNA1-STREET.
    perform bdc_field using 'KNA1-ORT01'
    IT_KNA1-CITY.
    perform bdc_field using 'KNA1-PSTLZ'
    IT_KNA1-POSTAL_CODE.
    perform bdc_field using 'KNA1-LAND1'
    IT_KNA1-COUNTRY.
    perform bdc_field using 'KNA1-SPRAS'
    IT_KNA1-LANGUAGE_KEY.
    perform bdc_dynpro using 'SAPMF02D' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'KNA1-LIFNR'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_dynpro using 'SAPMF02D' '0130'.
    PERFORM BDC_FIELD USING 'RF02D-D0130'
    'X'.
    perform bdc_field using 'BDC_CURSOR'
    'KNBK-BANKN(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTR'.
    perform bdc_dynpro using 'SAPMF02D' '0210'.
    perform bdc_field using 'BDC_CURSOR'
    'KNB1-AKONT'.
    perform bdc_field using 'BDC_OKCODE'
    '=UPDA'.
    perform bdc_field using 'KNB1-AKONT'
    IT_KNA1-REC_ACCOUNT.
    perform bdc_dynpro using 'SAPLRSFH' '0100'.
    perform bdc_field using 'BDC_OKCODE'
    '/EBACK'.
    perform bdc_field using 'BDC_CURSOR'
    'RSIODYNP4-LOW(01)'.
    ENDIF.
    ENDAT.
    L_COUNTER = L_COUNTER + 1.
    CLEAR L_STRING.
    CONCATENATE 'KNBK-BANKS(' L_COUNTER ')' INTO L_STRING.
    PERFORM BDC_FIELD USING L_STRING
    IT_KNA1-CNTRY.
    CLEAR L_STRING.
    CONCATENATE 'KNBK-BANKL(' L_COUNTER ')' INTO L_STRING.
    PERFORM BDC_FIELD USING L_STRING
    IT_KNA1-BANK_KEY.
    CLEAR L_STRING.
    CONCATENATE 'KNBK-BANKN(' L_COUNTER ')' INTO L_STRING.
    PERFORM BDC_FIELD USING L_STRING
    IT_KNA1-BANK_ACCOUNT.
    AT END OF CUSTOMER.
    READ TABLE IT_KNA1 INDEX V_INDEX.
    IF SY-SUBRC = 0.
    CALL TRANSACTION 'FD01' USING IT_BDCDATA MODE 'A' UPDATE 'S' MESSAGES
    INTO IT_MESSAGES.
    IF SY-SUBRC <> 0.
    PERFORM EMPLOYEEID_ERROR.
    *ELSE.
    ENDIF.
    WRITE: SY-SUBRC.
    perform message_format_write.
    *ENDIF.
    *WRITE: SY-SUBRC.
    CLEAR IT_BDCDATA.
    REFRESH IT_BDCDATA.
    ENDIF.
    ENDAT.
    ENDLOOP.
    endform. " POPULATE_FILE
    *& Form bdc_dynpro
    text
    -->P_0224 text
    -->P_0225 text
    form bdc_dynpro using value(p_0224)
    value(p_0225).
    IT_BDCDATA-PROGRAM = P_0224.
    IT_BDCDATA-DYNPRO = P_0225.
    IT_BDCDATA-DYNBEGIN = 'X'.
    APPEND IT_BDCDATA.
    CLEAR IT_BDCDATA.
    endform. " bdc_dynpro
    *& Form bdc_field
    text
    -->P_0229 text
    -->P_0230 text
    form bdc_field using value(p_0229)
    value(p_0230).
    IT_BDCDATA-FNAM = P_0229.
    IT_BDCDATA-FVAL = P_0230.
    APPEND IT_BDCDATA.
    CLEAR IT_BDCDATA.
    endform. " bdc_field
    *& Form EMPLOYEEID_ERROR
    text
    --> p1 text
    <-- p2 text
    form EMPLOYEEID_ERROR .
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    DEST = FILLER8
    GROUP = 'Z50583_REC1'
    HOLDDATE = FILLER8
    KEEP = 'X'
    USER = SY-UNAME
    RECORD = FILLER1
    PROG = SY-CPROG
    IMPORTING
    QID =
    EXCEPTIONS
    CLIENT_INVALID = 1
    DESTINATION_INVALID = 2
    GROUP_INVALID = 3
    GROUP_IS_LOCKED = 4
    HOLDDATE_INVALID = 5
    INTERNAL_ERROR = 6
    QUEUE_ERROR = 7
    RUNNING = 8
    SYSTEM_LOCK_ERROR = 9
    USER_INVALID = 10
    OTHERS = 11.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = 'FD01'
    POST_LOCAL = NOVBLOCAL
    PRINTING = NOPRINT
    SIMUBATCH = ' '
    CTUPARAMS = ' '
    TABLES
    dynprotab = IT_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.
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform. " EMPLOYEEID_ERROR
    *& Form message_format_write
    text
    --> p1 text
    <-- p2 text
    form message_format_write .
    DATA: L_MSG(200).
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = SY-MSGID
    LANG = SY-LANGU
    NO = SY-MSGNO
    V1 = SY-MSGV1
    V2 = SY-MSGV2
    V3 = SY-MSGV3
    V4 = SY-MSGV4
    IMPORTING
    MSG = L_MSG
    EXCEPTIONS
    NOT_FOUND = 1
    OTHERS = 2.
    WRITE: / L_MSG.
    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. " message_format_write
    ~~Guduri

  • How to handle table control in lsmw recording method

    hi expert please tell me the procedure for how to handle table control in lsmw recording method
    Locked for same reason as how to upload data for me01 using LSMW BDC METHOD
    Edited by: Matt on May 9, 2011 8:52 AM

    Sri,
    just search in SDN search box by giving table control in lsmw you will get hell lot of threads for same.
    Amit.

  • How to handle table controls using LSMW

    Hi All,
    how to use LSMW to handle table control like header and item details eg. VA01 , ME21 etc. To handle these kind of trnasactions can we use LSMW instead BDC to upload data. Please let me know.
    Thanks in advance.
    Regards,
    Kalpana

    Hi Kalpana,
    You can have your own custom programs for LSMW if the standard DI/BI IDOC , BAPI dont meet your requirements.
    Its little bit complex. You need to register you custom program in table through SM30.
    SDX0 - Program Definition ( BI or DI )
    SDX1 - Program Assignment
    SDX2 - Declaring Structures
    SDX3 - Declaring field identifiers for structures
    You can goto SM30 and can view the standard BI/DI programs definition by using the four digit Obejct Number...
    <b>AS</b>

  • How  to handle table controls in BDC

    Hi All,
    Can u please help me out in my BDC program which involves header data and the item data which is to be filled in a Table Control of a particular transaction .If anyone can send me already existing code it would be of great help..
    Thanks in Advance
    Kishore

    Hi Kishore
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    regards
    SAmeer

  • How to handle table control in PO change

    Hi All,
    R/3 is sending PO details and Vendor is using third party front end to access the PO.He has changed the PO and these changes need to be reflected in the PO. Data is coming from external sytem to R/3 through IDOC. I need to handle the changes in the PO at the ITEM level. It has the table control. I don't know about table control. Kindly help me inorder to update the PO for a particular tab in PO item(ME22N).
    I have checked the process code : ORDH and FM: MPN30_IDOC_INPUT_ORDCAD
    Regards
    Kannaiah
    Rewards for helpful answers

    Hi Ravikanth,
    Thanks for the reply.
    I checked the PO item for the fields which need to be updated. I am unable to find some fields in the FM which i had mentioned. Shall I need to use any Userexit or include for this. If yes, can you tell me the user exit for this. I have checked the following exits: AMPL0001 
    LMEDR001 
    LMELA002 
    LMELA010 
    LMEQR001 
    LMEXF001 
    LWSUS001 
    M06B0001 
    M06B0002 
    M06B0003 
    M06B0004 
    M06B0005 
    M06E0004 
    M06E0005 
    ME590001 
    MEETA001 
    MEFLD004 
    MELAB001 
    MEQUERY1 
    MEVME001 
    MM06E001 
    MM06E003 
    MM06E004 
    MM06E005 
    MM06E007 
    MM06E008 
    MM06E009 
    MM06E010 
    MMAL0001 
    MMAL0002 
    MMAL0003 
    MMDA0001
    MMFAB001
    MRFLB001

  • How to handle Table control  (pls read question)

    Hi All,
          I am writing code for CA21 Tcode , i am getting values into table control using P+ successfully but problem is i have to select 1st entry in table control and it will go to other screen and come back and select 2nd entry ....like that it will do until all entries in table control is over .
    Can any one pls send any code for this logic.
    Regards,
    Sudhakar Reddy.A

    Hi ,
    This should done dynamically with out user interaction .
    Regards,
    Sudhakar Reddy A

  • How can we handle table control in BDC?

    Hi,
    How can we handle table control in BDC?
    regards
    eswar

    hi,
    check this example:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    ex:
    *& Report  ZSR_BDC_TBCTRL
    REPORT  ZSR_BDC_TBCTRL
            NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES : RF02K,LFA1,LFBK.
    DATA : BEGIN OF IT_VEN OCCURS 0,
          LIFNR LIKE RF02K-LIFNR,
          KTOKK LIKE RF02K-KTOKK,
          NAME1 LIKE LFA1-NAME1,
          SORTL LIKE LFA1-SORTL,
          LAND1 LIKE LFA1-LAND1,
          SPRAS LIKE LFA1-SPRAS,
          BANKS(6) TYPE C,
          BANKL(17) TYPE C,
          BANKN(19) TYPE C,
          END OF IT_VEN.
    DATA : BEGIN OF BANKS OCCURS 0,
           BANKS LIKE LFBK-BANKS,
           END OF BANKS,
           BEGIN OF BANKL OCCURS 0,
           BANKL LIKE LFBK-BANKL,
           END OF BANKL,
           BEGIN OF BANKN OCCURS 0,
           BANKN LIKE LFBK-BANKN,
           END OF BANKN.
    DATA : FLD(20) TYPE C,
           CNT(2) TYPE N.
    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    INCLUDE BDCRECX1.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'Z:\sr.TXT'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = IT_VEN
    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_VEN.
        REFRESH BDCDATA.
        REFRESH : BANKS,BANKL,BANKN..
        SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
        SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
        SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
                                  IT_VEN-LIFNR.
    PERFORM BDC_FIELD       USING 'RF02K-KTOKK'
                                  IT_VEN-KTOKK.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0110'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'LFA1-NAME1'
                                  IT_VEN-NAME1.
    PERFORM BDC_FIELD       USING 'LFA1-SORTL'
                                  IT_VEN-SORTL.
    PERFORM BDC_FIELD       USING 'LFA1-LAND1'
                                  IT_VEN-LAND1.
    PERFORM BDC_FIELD       USING 'LFA1-SPRAS'
                                  IT_VEN-SPRAS.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0120'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKN(02)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    *perform bdc_field       using 'LFBK-BANKS(01)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKS(02)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKL(01)'
                                 '10020030'.
    *perform bdc_field       using 'LFBK-BANKL(02)'
                                 '67270003'.
    *perform bdc_field       using 'LFBK-BANKN(01)'
                                 '12345'.
    *perform bdc_field       using 'LFBK-BANKN(02)'
                                 '66666'.
    MOVE 1 TO CNT.
        LOOP AT BANKS.
          CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKS-BANKS.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKL.
          CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKL-BANKL.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKN.
          CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKN-BANKN.
          CNT = CNT + 1.
        ENDLOOP.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0300'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=YES'.
    PERFORM BDC_TRANSACTION USING 'XK01'.
    ENDLOOP.
    PERFORM CLOSE_GROUP.

  • How to use table control in bdc, plz somebody tell me.

    Hi Gurus,
    Ples tell me
    how to use table control in bdc, plz somebody tell me.
    And send Sample CODE also. Thnaks in advance.

    hi,
    Table control / step loop in BDC
    Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen?
    Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
    we can determine the number of visible lines on Transaction Screen from our Calling BDC program.
    Demo ABAP code has two purposes:
    1. how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    2. using field symbol in BDC program, please pay special attention to the difference
    in Static ASSIGN and Dynamic ASSIGN.
    Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop.
    Then have a look at steploop itselp, one entry of it will occupy two lines.
    (Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
    Now we have : FixedLine = 9
    LoopLine = 2(for table control, LoopLine is always equal to 1)
    Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
    Now we have: FirstLine = 0
    or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
    Step3: write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    global data: FixedLine type i, " number of fixed line on a certain screen
    LoopLine type i, " the number of lines occupied by one steploop item
    FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1
    Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
    pageno type i, " you need to scroll screen how many times.
    line type i, " number of lines appears on the screen.
    index(2) type N, " the screen index for certain item
    begin type i, " from parameter of loop
    end type i. " to parameter of loop
    *in code sample, the DataTable-linindex stands for the table index number of this line
    form calpage using FixedLine type i (see step 1)
    LoopLine type i (see step 1)
    FirstLine type i (see step 2)
    DataLine type i ( this is the item number you will enter in transaction)
    changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
    changing line type i.(visible lines one the screen)
    data: midd type i,
    vline type i, "visible lines
    if DataLine eq 0.
    Message eXXX.
    endif.
    vline = ( sy-srows - FixedLine ) div LoopLine.
    *for table control, you should compare vline with maximum line of
    *table control, then take the small one that is min(vline, maximum)
    *here only illustrate step loop
    if FirstLine eq 0.
    pageno = DataLine div vline.
    if pageno eq 0.
    pageno = pageno + 1.
    endif.
    elseif FirstLine eq 1.
    pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
    midd = ( DataLine - 1 ) mod ( vline - 1).
    if midd = 0 and DataLine gt 1.
    pageno = pageno - 1.
    endif.
    endif.
    line = vline.
    endform.
    Step4 write a subroutine to calculate the line index for each item.
    form calindex using Line type i (visible lines on the screen)
    FirstLine type i(see step 2)
    LineIndex type i(item index)
    changing Index type n. (index on the screen)
    if FirstLine = 0.
    index = LineIndex mod Line.
    if index = '00'.
    index = Line.
    endif.
    elseif FirstLine = 1.
    index = LineIndex mod ( Line - 1 ).
    if ( index between 1 and 0 ) and LineIndex gt 1.
    index = index + Line - 1.
    endif.
    if Line = 2.
    index = index + Line - 1.
    endif.
    endif.
    endform.
    Step5 write a subroutine to calculate the loop range.
    form calrange using Line type i ( visible lines on the screen)
    DataLine type i
    FirstLine type i
    loopindex like sy-index
    changing begin type i
    end type i.
    If FirstLine = 0.
    if loopindex = 1.
    begin = 1.
    if DataLine <= Line.
    end = DataLine.
    else.
    end = Line.
    endif.
    elseif loopindex gt 1.
    begin = Line * ( loopindex - 1 ) + 1.
    end = Line * loopindex.
    if end gt DataLine.
    end = DataLine.
    endif.
    endif.
    elseif FirstLine = 1.
    if loopindex = 1.
    begin = 1.
    if DataLine <= Line.
    end = DataLine.
    else.
    end = Line.
    endif.
    elseif loop index gt 1.
    begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
    end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
    if end gt DataLine.
    end = DataLine.
    endif.
    endif.
    endif.
    endform.
    Step6
    using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
    form creat_bdc.
    field-symbols: , , .
    data: name1(14) value 'EKPO-EMATN(XX)',
    name2(14) value 'EKPO-MENGE(XX)',
    name3(15) value 'RM06E-SELKZ(XX)'.
    assign: name1 to ,
    name2 to ,
    name3 to .
    do pageno times.
    if sy-index gt 1
    *insert scroll page ok_code"
    endif.
    perform calrange using Line DataLine FirstLine sy-index
    changing begin end.
    loop at DataTable from begin to end.
    perform calindex using Line FirstLine DataTable-LineIndex changing Index.
    name1+11(2) = Index.
    name2+11(2) = Index.
    name3+12(2) = Index.
    perform bdcfield using DataTable-matnr.
    perform bdcfield using DataTable-menge.
    perform bdcfield using DataTable-indicator.
    endloop.
    enddo.
    example 1
    BDC table control is an area on the screen in which you can display data in tabular form. You process it using a loop. Table controls are comparable to step loop tables. While a table control consists of a single definition row, step loop blocks may extend over more than one row. Table controls are more flexible than step loops, and are intended to replace them
    When you need to handle a scenario like in sales order,it may contain more than one material,if you have more than one material We have to use table control,it will have number of columns and number of rows.
    Table controls allow you to enter, display, and modify tabular data easily on the screen
    Check this code,
    PARAMETERS: file1 LIKE rlgrap-filename.
    *Internal Table Declarations
    DATA: BEGIN OF itab OCCURS 0,
    matnr(18) TYPE c, "MaterialNumber
    werks(4) TYPE c, "Plant
    vdatu(10) TYPE c, "Valid From Date
    bdatu(10) TYPE c, "Valid To Date
    lifnr(10) TYPE c, "Vendor Number
    ekorg(4) TYPE c, "Purchasing Organization
    feskz TYPE c, "Fixed
    autet TYPE c, "MRP Indicator
    END OF itab.
    DATA: bdcdata LIKE TABLE OF bdcdata WITH HEADER LINE.
    *VARIABLES Declarations
    DATA: wa1 LIKE LINE OF itab. "Workarea for ITAB
    DATA: n TYPE i, "Check
    count TYPE i.
    DATA: cnt(2), "Counter
    wa(15). "Workarea to hold concatenatedvalue
    DATA v_msg(100).
    DATA: flag.
    DATA: file TYPE string.
    *Initialization event
    INITIALIZATION.
    *At-selection-screen event
    *To provide Input help for file name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = file1.
    *START-OF-SELECTION EVENT
    START-OF-SELECTION.
    MOVE file1 TO file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file
    filetype = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab
    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.
    *To populate BDCDATA and start data transfer
    LOOP AT itab .
    To validate Plant range
    IF itab-werks = '1000' OR itab-werks = '2000'
    OR itab-werks = '1008'.
    AT NEW werks.
    CLEAR: n.
    cnt = 1.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EORD-MATNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'EORD-MATNR'
    itab-matnr.
    PERFORM bdc_field USING 'EORD-WERKS'
    itab-werks.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
    CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
    PERFORM bdc_field USING 'BDC_CURSOR'
    wa.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BU'.
    ENDAT.
    IF n = 12.
    READ TABLE bdcdata WITH KEY fval = '=BU'.
    bdcdata-fval = '=NS'.
    MODIFY bdcdata INDEX sy-tabix TRANSPORTING fval.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EORD-VDATU(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BU'.
    cnt = 2.
    n = 2.
    ENDIF.
    CONCATENATE 'EORD-VDATU(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-vdatu.
    CONCATENATE 'EORD-BDATU(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-bdatu.
    CONCATENATE 'EORD-LIFNR(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-lifnr.
    CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-ekorg.
    CONCATENATE 'RM06W-FESKZ(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-feskz.
    CONCATENATE 'EORD-AUTET(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-autet.
    IF n <> 12.
    n = cnt.
    ENDIF.
    cnt = cnt + 1.
    AT END OF werks.
    CALL TRANSACTION 'ME01' USING bdcdata
    UPDATE 'S'
    MODE 'A'.
    CLEAR:bdcdata,bdcdata[].
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    id = sy-msgid
    lang = 'EN'
    no = sy-msgno
    v1 = sy-msgv1
    v2 = sy-msgv2
    v3 = sy-msgv3
    v4 = sy-msgv4
    IMPORTING
    msg = v_msg.
    WRITE:/ v_msg.
    CLEAR: bdcdata,bdcdata[],flag.
    ENDAT.
    ENDIF.
    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 values
    FORM bdc_field USING fnam fval.
    IF NOT fval IS INITIAL.
    CLEAR bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    APPEND bdcdata.
    ENDIF.
    CLEAR wa.
    ENDFORM.
    Sample code 2
    THis is example to upload the Bank details of the Vendor which has the TC.
    REPORT zprataptable2
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Header file:
    1 63190 0001 0001 0001 mr bal188 b in 31000 a1 inr
    2 63191 0001 0001 0001 mr bal189 b in 31000 a1 inr
    TC file:
    1 in sb 11000
    1 in sb 12000
    1 in sb 13000
    1 in sb 14000
    1 in sb 15000
    1 in sb 16000
    1 in sb 17000
    1 in sb 18000
    1 in sb 19000
    1 in sb 20000
    1 in sb 21000
    1 in sb 22000
    2 in sb 21000
    2 in sb 22000
    Regards

  • Handling Table controls in BDC

    Hi Team,
                   While handling Table controls in BDC(Call transaction), how do u ensure your code works Globally.
    As screen Resolution may vary from system to system and
    While building the logic we cannot fix the number of rows
    is 14 or XXX.
    After certain number of rows the logic should be done in such a way it should be  scrolled down.
    Please let me know Regarding this.
    Thanks.
    BestRegards,
    S.Anilkumar

    HI Anil,
    You can use "CTU_PARAMS-DEFSIZE = 'X'" for fixing the screen resolution
    You shuld use OK_CODE for scrolling is "P+".
    if you need scroll after some records just use SY-TABIX .

  • How can we handle table control parameter in lsmw

    hi guru,
    please tell me  how can we handle table control parameter in lsmw.
    thanks & regards
    subhasis.

    Hi,
    we  create table control program (module pool) this program use in LSMW,
    we mention the transaction code ,write ur  table control program name.
    This is use full for u
    Reguards,
    lakshmi

Maybe you are looking for

  • Problem with send video to TV with N82

    hi : i send my picture anf video file to TV with my N82 ! but it is not have enough quality( it is dimness(opaqueness)) ! why ? how can i repair that ? thanks

  • While executing ObjectTag in flash.htm, a javascript error occurred

    I'm attempting to place a SWF file in an editable region on a page created from a template.  I get the error: While executing ObjectTag in flash.htm, a javascript error occurred.  I saw on another sight that someone found the problem which was editab

  • COPA0005

    Hi, We have a requirement to modify the Division for CO-PA line item. In the current Intercompany sales process, when I create a sales order and save it I am able to see the corresponidng CO-PA line items in KE24 using sale order number as a Referenc

  • 2008R2 SQL Agent error 14258

    Hi, I recently enabled database mail in SQL (2008R2), setup a mail profile, set SQL Agent to use it and restarted SQL Agent.  SQL Agent starts ok but when trying to look at job properties or history I get the error: Error 14258: Cannot perform this o

  • Ipad keeps asking me to enter my password for my Apple ID

    I have a 4th Generation 16GB 9.7" ipad, iOS  7.1.2, ipad.  Woke up this morning and got a message on my iPad telling me to enter my password for my Apple ID to sign  into the iCloud.  I couldn't do anything else.  I couldn't access any other screen.