Problem in BDC table control for t.code ABAVN

Facing problem in uploading asset numbers.
Requirement: - Uploading data to transaction code ABAVN.
1.      After running the transaction click on multiple assets.
2.      Then we enter first four fields i.e. Document date, posting date, asset value date and text.
3.      After that we make entry in the list of assets field say around 200 asset numbers so that it generates only one document number.
Problem: - As I was working with BDC the problem I faced is in recording. After entering six asset numbers I have to press enter to activate the scroll bar, as I click scroll down it records full screen fields for every single scroll.
Thanks and regards,
Vishal Divekar.

Hi Vishal ,
please check <b>BAPI_ASSET_RETIREMENT_POST</b>and see the Documentation for more info.
Regards
Prabhu

Similar Messages

  • Problem in the BDC Table Control for the T.Code VA01

    Hi,
      I faced probelm in the BDC of the VA01. In the Table Control
    the records are entered upto 12 line items. after 13th line item overwrites the first record. How to solve the Problem.
    Please help me.

    or use this
    Internal table definition *
    data : begin of bdcdata occurs 0.
            include structure bdcdata.
    data : end of bdcdata.
    data: begin of messtab occurs 0.
            include structure bdcmsgcoll.
    data: end of messtab.
    data: v_chr_opengrp type c,
          r_matnr like mara-matnr,                       "variable for material conversion
          r_werks like marc-werks,                       "variable for plant
          v_str_fname   type string.
    data: begin of count2,
          inrec(9) type n,                               " input I_MATERIAL count
          create(9) type n,                              " create count
          error(9) type n,                               " error count
          bdc(9) type n,                                 " count of BDC creates
          end of count2.
    types: begin of ty_source,
    partn_numb(10) type n ,"Customer Number 1
    ref(035),
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    material like vbap-matnr,
    reqqty(018),
    reqdate(010),
    end of ty_source,
    begin of ty_header ,
    partn_numb(10) ,"Customer Number 1
    ref(035),
    sales_org(4) , "Sales Organization
    distr_chan(2) , "Distribution Channel
    division(002), "DIVISION
    doc_type(4) , "Sales Document Type
    purch_no(020), "Purchase order
    end of ty_header,
    begin of ty_item,
    partn_numb(10) ,"Customer Number 1
    ref(035),
    material like vbap-matnr,
    reqqty(018),
    reqdate(010),
    end of ty_item.
    data : msg(240) type c, " Return Message
    e_rec(8) type c, " Error Records Counter
    rec_no(8) type c, " Records Number Indicator
    s_rec(8) type c, " Successful Records Counter
    t_rec(8) type c, " Total Records Counter
    v_matnr like mara-matnr.
    data: val(2) type n value 01.
    data : begin of bdc_itab occurs 0.
            include structure bdcdata.
    data : end of bdc_itab.
    data : t_source type standard table of ty_source   with header line,
    t_header type standard table of ty_header initial size 1,
    t_item type standard table of ty_item initial size 1,
    t_target type standard table of bdcdata initial size 1.
    data : w_source type ty_source,
    w_source1 type ty_source,
    w_header type ty_header,
    w_item type ty_item,
    w_target type bdcdata,
    count type i,
    count1 type n.
    Variable Declaration
    data: w_fname type string,
    fnam(20),
    date1(10),
    i(2) type n,
    v_count type i,
    v_group type apqi-groupid.
    *& selection screen
    selection-screen :begin of block bl1 with frame title  text-001.
    parameters : p_fname type rlgrap-filename,                         "Input file
                 p_update(1) default 'N',                              "Input for update mode
                 p_bdcgrp(12) default 'SD_ORDERS'.                     "Input for session name
    selection-screen end of block bl1.
    **&SELECTION SCREEN VALIDATIONS
    at selection-screen on value-request for p_fname.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          program_name  = 'ZMATERIAL'
          dynpro_number = '1000'
          field_name    = 'P_FNAME'
        changing
          file_name     = p_fname.
    *& Start of selection
    start-of-selection.
      if  p_fname is initial.
        message i016(rp) with 'Please enter a file name'.
        leave list-processing.
      else.
        move p_fname to  v_str_fname.
      endif.
      call function 'GUI_UPLOAD'
        exporting
          filetype                = 'ASC'
          filename                = v_str_fname
          has_field_separator     = 'X'
        tables
          data_tab                = t_source
        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.
      sort t_source by ref partn_numb.
      loop at t_source into w_source.
        add 1 to count2-inrec.
        w_source1 = w_source.
       AT NEW PARTN_NUMB.  "10/31 KVB
        at new ref.
          w_header-doc_type = w_source1-doc_type..
          w_header-sales_org = w_source1-sales_org .            "'0001'
          w_header-distr_chan = w_source1-distr_chan.           "'01'
          w_header-division = w_source1-division.               " '01'
          w_header-purch_no = w_source1-purch_no.
          w_header-partn_numb = w_source1-partn_numb.
          w_header-ref = w_source1-ref.
          append w_header to t_header.
        endat.
        w_item-partn_numb = w_source1-partn_numb.
        w_item-material = w_source1-material.
        w_item-reqqty = w_source1-reqqty.
        w_item-ref = w_source1-ref.
        w_item-reqdate = w_source1-reqdate.
        append w_item to t_item.
        clear :w_item,w_header.
      endloop.
      loop at t_header into w_header.
        perform bdc_dynpro      using         'SAPMV45A'                  '0101'       .
        perform bdc_field       using         'BDC_CURSOR'                'VBAK-SPART'.
        perform bdc_field       using         'BDC_OKCODE'                '/00'.
        perform bdc_field       using         'VBAK-AUART'                w_header-doc_type.
        perform bdc_field       using         'VBAK-VKORG'                w_header-sales_org.
        perform bdc_field       using         'VBAK-VTWEG'                w_header-distr_chan.
        perform bdc_field       using         'VBAK-SPART'                w_header-division.
        perform bdc_dynpro      using         'SAPMV45A'                  '4001'     .
        perform bdc_field       using         'BDC_OKCODE'                '/00'.
        perform bdc_field       using         'BDC_CURSOR'               'VBKD-BSTKD'.
        perform bdc_field       using         'VBKD-BSTKD'                w_header-purch_no.
        perform bdc_field       using         'KUWEV-KUNNR'               w_header-partn_numb.
        i = 1.
        loop at t_item into w_item where partn_numb = w_header-partn_numb
                                         and ref = w_header-ref.
          at new partn_numb.
            clear count1.
            count = 0.
          endat.
          count = count + 1.
          if count gt 5.
            clear i.
            i = 2.
            perform bdc_dynpro      using 'SAPMV45A' '4001'      .
            perform bdc_field       using 'BDC_OKCODE' '=POAN'.
          endif.
          count1 = count1 + 1.
          concatenate 'VBAP-POSNR(' i ')' into fnam.
          perform bdc_field       using  fnam
                                        count1.
          concatenate 'RV45A-MABNR(' i ')' into fnam.
          perform bdc_field    using fnam                            w_item-material.
          concatenate 'RV45A-KWMENG(' i ')' into fnam.
          perform bdc_field       using  fnam                        w_item-reqqty..
          concatenate 'RV45A-ETDAT(' i ')' into fnam.
          perform bdc_field       using  fnam                         w_item-reqdate.
          concatenate 'VBKD-BSTKD_E(' i ')' into fnam.
          perform bdc_field       using  fnam                         w_item-ref.
          i = i + 1.
          clear:  w_item.
        endloop.
        clear w_header.
        perform bdc_dynpro      using 'SAPMV45A' '4001'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=SICH'.
        perform post_transaction.
        refresh bdc_itab.
        clear   bdc_itab.
      endloop.
    *endloop.
    end-of-selection.
      perform finalization.
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdc_itab.
      bdc_itab-program  = program.
      bdc_itab-dynpro   = dynpro.
      bdc_itab-dynbegin = 'X'.
      append bdc_itab.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> ''.
        clear bdc_itab.
        bdc_itab-fnam = fnam.
        bdc_itab-fval = fval.
        append bdc_itab.
      endif.
    endform.                    "bdc_field
    **&      Form  get_filename
          text
    -->  p1        text
    <--  p2        text
    *form get_filename .
    *call function 'WS_FILENAME_GET'
       exporting
         def_filename     = space
         def_path         = file
         mask             = ',.,..'
         mode             = 'N'
         title            = text-015
       importing
         filename         = file
       exceptions
         inv_winsys       = 1
         no_batch         = 2
         selection_cancel = 3
         selection_error  = 4
         others           = 5.
    *endform.                    " get_filename
    *&      Form  post_transaction
          text
    -->  p1        text
    <--  p2        text
    form post_transaction .
      refresh messtab.
      clear   messtab.
      call transaction  'VA01' using bdc_itab
                  mode   p_update
                update  'S'
              messages into messtab.
      read table messtab with key msgtyp = 'E'.
      if sy-subrc eq 0.
        perform process_error_messages.
        add 1 to count2-bdc.
        if v_chr_opengrp is initial.
          perform bdc_open_group.
        endif.
        call function 'BDC_INSERT'
          exporting
            tcode          = 'VA01'
          tables
            dynprotab      = bdc_itab
          exceptions
            internal_error = 1
            not_open       = 2
            queue_error    = 3
            tcode_invalid  = 4
            others         = 5.
        if sy-subrc <> 0.
          case sy-subrc.
            when 1.
              write: / 'Internal error'.
            when 2.
              write: / 'Not open error'.
            when 3.
              write: / 'queue error'.
            when 4.
              write: / 'tcode invalid error'.
            when others.
              write: / 'other error'.
          endcase.
        endif.
      else.
        add +1 to count2-create.
        format intensified off.
        format color col_normal.
        format color col_normal off.
      endif.
      clear   bdc_itab.
      refresh bdc_itab.
    endform.                    " post_transaction
    *&      Form  finalization
          text
    -->  p1        text
    <--  p2        text
    form finalization .
      if v_chr_opengrp = 'X'.
        call function 'BDC_CLOSE_GROUP'
          exceptions
            not_open    = 1
            queue_error = 2
            others      = 3.
      endif.
      get time.
      skip 2.
      write: / 'Time', sy-uzeit.
      skip.
      format color col_total on.
      write: / 'Total Records: ',           40 count2-inrec.
      write: / 'PERNR not of Emp Group 6 ', 40 count2-error.
      write: / 'Records Created: ',         40 count2-create.
      write: / 'BDC Create in group: ',     40 count2-bdc.
      if v_chr_opengrp = 'X'.
        skip 1.
        format intensified on.
        format color col_negative on.
        write: / 'PLEASE USE TRANSACTION "SM35" ',
                 'TO PROCESS THE GENERATED BDC SESSION ... ',
                 p_bdcgrp.
      endif.
    endform.                    " finalization
    *&      Form  bdc_open_group
          text
    -->  p1        text
    <--  p2        text
    form bdc_open_group .
      call function 'BDC_OPEN_GROUP'
        exporting
          client              = sy-mandt
          group               = p_bdcgrp
          holddate            = sy-datum
          keep                = 'X'
          user                = sy-uname
        exceptions
          client_invalid      = 1
          destination_invalid = 2
          group_invalid       = 3
          group_is_locked     = 4
          holddate_invalid    = 5
          internal_error      = 6
          queue_error         = 7
          running             = 8
          system_lock_error   = 9
          user_invalid        = 10
          others              = 11.
      if sy-subrc eq 0.
        v_chr_opengrp = 'X'.
      endif.
    endform.                    " bdc_open_group
    *&      Form  process_error_messages
          text
    -->  p1        text
    <--  p2        text
    form process_error_messages .
      data: begin of loc_aux_message.
              include structure message.
      data: end of loc_aux_message.
      data : msgno type sy-msgno.
      loop at messtab.
        move messtab-msgnr to msgno.
        call function 'WRITE_MESSAGE'
          exporting
            msgid  = messtab-msgid
            msgno  = msgno
            msgty  = messtab-msgtyp
            msgv1  = messtab-msgv1
            msgv2  = messtab-msgv2
            msgv3  = messtab-msgv3
            msgv4  = messtab-msgv4
          importing
            messg  = loc_aux_message
          exceptions
            others = 1.
        if sy-subrc eq 0.
          format color col_negative on.
          write: /10 loc_aux_message.
          format color col_negative off.
        else.
          format color col_negative on.
          write: /10 t_source-partn_numb.
          write: / 'Error creating message'.
          format color col_negative off.
          exit.
        endif.
      endloop.
    endform.                    " process_error_messages

  • BDC- Inconsistancy in table control for t-code MR21

    Hi all,
    We are facing inconsistency in the table control (number of line items) for t-code MR21 in normal transaction screen and BDC screen.
    In normal transaction run (MR21) we can see 12 line entries.
    But for the same t-code while processing of a session created by BDC recording we can see only 9 entries.
    Because of the mismatch in the lines, there will be a gap of 3 blank lines.
    Kindly provide any input to solve the issue.
    Thanks & Regards,
    Prabhu

    Hello,
    You will have to use the OPTIONS addition of CALL TRANSACTION to set the default screen size
    data: t_ctu type ctu_params.
    t_ctu-defsize = 'X'.
    t_ctu-dismode = 'N' .   " Mode
    t_ctu-upmode = 'S'  " Update
    call transaction 'MR21' using bdcdata options form t_ctu messages into t_messages.
    Vikranth

  • Code for va01 bdc table control

    hi
    i want to CODE FOR  bdc table control  VA01 (TCODE)
    ASAP

    Awadhesh,
    just refer:
    Problem in the BDC Table Control for the T.Code VA01
    BDC Uploading from flat file to VA01.
    BDC For Line Items In Sales Order
    dont forget reward.
    Amit.

  • Bdc table control.

    Dear forums friends,
    i have a problem in bdc table control.I send my report below,
    please check it and tell me what is the problem,why this report not excute.
    please tell me quickly.
    regard
    Rasmi.
    REPORT ztable_control
           NO STANDARD PAGE HEADING LINE-SIZE 255.
    *include bdcrecx1.
    *start-of-selection.
    *perform open_group.
    DATA: it_exload LIKE alsmex_tabline  OCCURS 0 WITH HEADER LINE.
    DATA : str1 TYPE string,
           var1(2) TYPE n.
           var1 = 0.
    DATA: BEGIN OF itab OCCURS 0,
          cldte(8) TYPE n,
          ocrsn(4) TYPE n,
          END OF itab.
    DATA: var3 TYPE dats,
          var6 TYPE integer.
      itab-cldte = var3.
    itab2-cldte = var3.
      itab-ocrsn = var6.
    itab2-ocrsn = var6.
    DATA: BEGIN OF itab1 OCCURS 0,
          cldte(8) TYPE n,
          ocrsn(4) TYPE n,
          pernr(1) TYPE n,
          taxcd LIKE pinct-taxcd,
          betrg(1) TYPE n,
          voudt(10) TYPE c,
          vouam(2) TYPE n,
      END OF itab1.
    DATA var(1) TYPE c.
    DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
    PARAMETER: file_fi LIKE rlgrap-filename OBLIGATORY,
               w_begin TYPE   i OBLIGATORY,
               w_end   TYPE   i OBLIGATORY,
               rad1    RADIOBUTTON GROUP gp1,
               rad2    RADIOBUTTON GROUP gp1 DEFAULT 'X',
               rad3    RADIOBUTTON GROUP gp1 .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_fi.
      PERFORM sub_browse_file.
                         START-OF-SELECTION                      *
    START-OF-SELECTION.
      PERFORM mode_selection.
      PERFORM sub_data_load.
      PERFORM sub_data_transform.
      PERFORM sub_post_data.
                           BROWS FILE                             *
    FORM sub_browse_file .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        IMPORTING
          file_name     = file_fi.
    ENDFORM.                                      "sub_browse_file
                             DATA LOAD                             *
    FORM sub_data_load.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename    = file_fi
          i_begin_col = '0001'
          i_begin_row = w_begin
          i_end_col   = '0007'
          i_end_row   = w_end
        TABLES
          intern      = it_exload.
      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_data_load
                          DATA TRANSFORM                           *
    FORM sub_data_transform .
      LOOP AT it_exload.
        CASE it_exload-col.
          WHEN '0001'.
            itab-cldte = it_exload-value.
            itab1-cldte = it_exload-value.
          WHEN '0002'.
            itab-ocrsn = it_exload-value.
            itab1-ocrsn = it_exload-value.
          WHEN '0003'.
            itab1-pernr = it_exload-value.
          WHEN '0004'.
            itab1-taxcd = it_exload-value.
          WHEN '0005'.
            itab1-betrg = it_exload-value.
          WHEN '0006'.
            itab1-voudt = it_exload-value.
          WHEN '0007'.
            itab1-vouam = it_exload-value.
        ENDCASE.
        AT END OF row.
          APPEND itab.
          CLEAR itab.
          APPEND itab1.
          CLEAR itab1.
          IF itab-cldte = '  '.
            itab1-cldte = '  '.
            itab-ocrsn  = '  '.
            itab1-ocrsn = '  '.
            WRITE : / var3.
            WRITE : / var6.
          ENDIF.
        ENDAT.
      ENDLOOP.
    *SORT itab by cldte.
    *delete ADJACENT DUPLICATES FROM itab2.
    ENDFORM.                                            "sub_data_transform
                            Form  sub_post_data                         *
    FORM sub_post_data .
      LOOP AT itab.
        PERFORM bdc_dynpro      USING 'HINCREMP' '3000'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'WA_CLAIMS-VOUAM(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=PROC'.
        PERFORM bdc_field       USING 'RPCCLMIN-CLDTE'
                                      itab-cldte .        "'01.02.2009'.
        PERFORM bdc_field       USING 'RPCCLMIN-OCRSN'
                                      itab-ocrsn.               " '0002'.
        LOOP AT itab1 WHERE cldte = itab1-cldte  AND ocrsn = itab-ocrsn.
          CONCATENATE 'wa_claims-pernr(' var1 ')' INTO str1.
          PERFORM bdc_field    USING str1
                                      itab1-pernr.              "'001'
          CONCATENATE 'WA_CLAIMS-TAXCD (' var1')' INTO str1.
          PERFORM bdc_field  USING  str1
                                      itab1-taxcd.                 "'SCHA'.
          CONCATENATE 'WA_CLAIMS-BETRG(' var1')' INTO str1.
          PERFORM bdc_field  USING str1
                                      itab1-betrg.              "'1'.
          CONCATENATE 'WA_CLAIMS-VOUDT(' var1 ')' INTO str1.
          PERFORM bdc_field   USING str1
                                      itab1-voudt.                    "'02.02.2009'.
          CONCATENATE 'WA_CLAIMS-VOUAM(' var1')' INTO str1.
          PERFORM bdc_field    USING str1
                                      itab1-vouam.              "'50'.
          var1 = var1 + 1.
         Endif.
        ENDLOOP.                                                "'50'.
        PERFORM bdc_dynpro      USING 'HINCREMP' '4000'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BACK'.
        PERFORM bdc_dynpro      USING 'HINCREMP' '3000'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RPCCLMIN-CLDTE'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BACK'.
        PERFORM bdc_field       USING 'RPCCLMIN-CLDTE'
                                     '01.02.2009'.
        PERFORM bdc_field       USING 'RPCCLMIN-OCRSN'
                                    '0002'.
        PERFORM bdc_dynpro      USING 'SAPLSPO1' '0100'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=YES'.
    *perform bdc_transaction using 'PC00_M40_REMP'.
        CALL TRANSACTION 'PC00_M40_REMP' USING bdcdata MESSAGES INTO messtab MODE var.
        "UPDATE 'S'
        "MODE var.
    Endloop.
    Endform.
                                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 FILE                                     *
    FORM bdc_field USING fnam fval.
      IF fval <> space.
        CLEAR bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        APPEND bdcdata.
      ENDIF.
    ENDFORM.                                                          "BDC_FIELD
                                MODE-SELECTION                                 *
    FORM mode_selection .
      IF rad1 = 'X'.
        var = 'P'.
      ELSEIF rad2 = 'X'.
        var = 'E'.
      ELSEIF rad3 = 'X'.
        var = 'A'.
      ENDIF.
    ENDFORM.                                                  " mode_selecti

    Hi,
    Check this ...
    REPORT ztable_control
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    *include bdcrecx1.
    *start-of-selection.
    *perform open_group.
    DATA: it_exload LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA : str1 TYPE string,
    var1(2) TYPE n.
    var1 = 1.               " Change here and check
    DATA: BEGIN OF itab OCCURS 0,
    cldte(8) TYPE n,
    ocrsn(4) TYPE n,
    END OF itab.
    DATA: var3 TYPE dats,
    var6 TYPE integer.
    itab-cldte = var3.
    itab2-cldte = var3.
    itab-ocrsn = var6.
    itab2-ocrsn = var6.
    DATA: BEGIN OF itab1 OCCURS 0,
    cldte(8) TYPE n,
    ocrsn(4) TYPE n,
    pernr(1) TYPE n,
    taxcd LIKE pinct-taxcd,
    betrg(1) TYPE n,
    voudt(10) TYPE c,
    vouam(2) TYPE n,
    END OF itab1.
    DATA var(1) TYPE c.
    DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
    PARAMETER: file_fi LIKE rlgrap-filename OBLIGATORY,
    w_begin TYPE i OBLIGATORY,
    w_end TYPE i OBLIGATORY,
    rad1 RADIOBUTTON GROUP gp1,
    rad2 RADIOBUTTON GROUP gp1 DEFAULT 'X',
    rad3 RADIOBUTTON GROUP gp1 .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_fi.
    PERFORM sub_browse_file.
    START-OF-SELECTION *
    START-OF-SELECTION.
    PERFORM mode_selection.
    PERFORM sub_data_load.
    PERFORM sub_data_transform.
    PERFORM sub_post_data.
    BROWS FILE *
    FORM sub_browse_file .
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    field_name = ' '
    IMPORTING
    file_name = file_fi.
    ENDFORM. "sub_browse_file
    DATA LOAD *
    FORM sub_data_load.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    filename = file_fi
    i_begin_col = '0001'
    i_begin_row = w_begin
    i_end_col = '0007'
    i_end_row = w_end
    TABLES
    intern = it_exload.
    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_data_load
    DATA TRANSFORM *
    FORM sub_data_transform .
    LOOP AT it_exload.
    CASE it_exload-col.
    WHEN '0001'.
    itab-cldte = it_exload-value.
    itab1-cldte = it_exload-value.
    WHEN '0002'.
    itab-ocrsn = it_exload-value.
    itab1-ocrsn = it_exload-value.
    WHEN '0003'.
    itab1-pernr = it_exload-value.
    WHEN '0004'.
    itab1-taxcd = it_exload-value.
    WHEN '0005'.
    itab1-betrg = it_exload-value.
    WHEN '0006'.
    itab1-voudt = it_exload-value.
    WHEN '0007'.
    itab1-vouam = it_exload-value.
    ENDCASE.
    AT END OF row.
    APPEND itab.
    CLEAR itab.
    APPEND itab1.
    CLEAR itab1.
    IF itab-cldte = ' '.
    itab1-cldte = ' '.
    itab-ocrsn = ' '.
    itab1-ocrsn = ' '.
    WRITE : / var3.
    WRITE : / var6.
    ENDIF.
    ENDAT.
    ENDLOOP.
    *SORT itab by cldte.
    *delete ADJACENT DUPLICATES FROM itab2.
    ENDFORM. "sub_data_transform
    Form sub_post_data *
    FORM sub_post_data .
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'WA_CLAIMS-VOUAM(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=PROC'.
    PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
    itab-cldte . "'01.02.2009'.
    PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
    itab-ocrsn. " '0002'.
    LOOP AT itab1 WHERE cldte = itab1-cldte AND ocrsn = itab-ocrsn.
    CONCATENATE 'wa_claims-pernr(' var1 ')' INTO str1.
    PERFORM bdc_field USING str1
    itab1-pernr. "'001'
    CONCATENATE 'WA_CLAIMS-TAXCD (' var1')' INTO str1.
    PERFORM bdc_field USING str1
    itab1-taxcd. "'SCHA'.
    CONCATENATE 'WA_CLAIMS-BETRG(' var1')' INTO str1.
    PERFORM bdc_field USING str1
    itab1-betrg. "'1'.
    CONCATENATE 'WA_CLAIMS-VOUDT(' var1 ')' INTO str1.
    PERFORM bdc_field USING str1
    itab1-voudt. "'02.02.2009'.
    CONCATENATE 'WA_CLAIMS-VOUAM(' var1')' INTO str1.
    PERFORM bdc_field USING str1
    itab1-vouam. "'50'.
    var1 = var1 + 1.
    Endif.
    ENDLOOP. "'50'.
    PERFORM bdc_dynpro USING 'HINCREMP' '4000'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BACK'.
    PERFORM bdc_dynpro USING 'HINCREMP' '3000'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RPCCLMIN-CLDTE'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BACK'.
    PERFORM bdc_field USING 'RPCCLMIN-CLDTE'
    '01.02.2009'.
    PERFORM bdc_field USING 'RPCCLMIN-OCRSN'
    '0002'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    *perform bdc_transaction using 'PC00_M40_REMP'.
    CALL TRANSACTION 'PC00_M40_REMP' USING bdcdata MESSAGES INTO messtab MODE var.
    "UPDATE 'S'
    "MODE var.
    Endloop.
    Endform.

  • BDC tabel control for QE01

    Hi,
    I am writing BDC table control for QE01.It is working very fine on my desktop.
    If the screen resolution is changed in other desktop the BDC is not working.
    Give me inputs how to make it work
    Regards
    Rasheed.

    Hi
    You need to add the additon OPTIONS FROM to your call transaction statement.
    Refer the below code.
    DATA OPT TYPE CTU_PARAMS.
    OPT-DEFSIZE = 'X'.
    CALL TRANSACTION 'FB01' USING ITAB OPTIONS FROM OPT.
    Cheers,
    Hakim

  • More than 1 line items in bdc using table controls for BOM

    Hi....
    how do u update more than one line item for BOM using BDC table control.......
    is there any specific command for doing that.......
    hav tried d following code bt it takes the flatfile i/p FOR 2 LINE ITEMS as 2 different BOM'S.....
    would appreciate ur help....plz provide code.............
    REPORT zbdc4_cs01
           NO STANDARD PAGE HEADING LINE-SIZE 255.
    INCLUDE bdcrecx1.
    DATA : a TYPE i,
           b type i,
           c type i.
    DATA : BEGIN OF it_rec OCCURS 0,
           rec(200) TYPE c,
           END OF it_rec.
    DATA : BEGIN OF ctab OCCURS 0,
           matnr(18),
           werks(4),
           stlan(1),
           END OF ctab.
    DATA : BEGIN OF xtab OCCURS 0,
           idnrk(18),
           menge(13),
           postp(1),
           END OF xtab.
    DATA : BEGIN OF itab OCCURS 0,
           matnr(18),
           werks(4),
           stlan(1),
           idnrk(18),
           menge(13),
           postp(1),
           END OF itab.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = 'C:/TEST4.TXT'
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = it_rec.
      LOOP AT  it_rec.
        a = strlen( it_rec-rec ).
        if a = 55.
        itab-matnr = it_rec-rec+0(18).
        itab-werks = it_rec-rec+18(4).
        itab-stlan = it_rec-rec+22(1).
        itab-idnrk = it_rec-rec+23(18).
        itab-menge = it_rec-rec+41(13).
        itab-postp = it_rec-rec+54(1).
        APPEND itab.
        elseif a > 55.
        itab-matnr = it_rec-rec+0(18).
        itab-werks = it_rec-rec+18(4).
        itab-stlan = it_rec-rec+22(1).
        itab-idnrk = it_rec-rec+23(18).
        itab-menge = it_rec-rec+41(13).
        itab-postp = it_rec-rec+54(1).
        APPEND itab.
        itab-idnrk = it_rec-rec+55(18).
        itab-menge = it_rec-rec+73(13).
        itab-postp = it_rec-rec+86(1).
        APPEND itab.
        endif.
      ENDLOOP.
      PERFORM open_group.
      LOOP AT itab.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29N-STLAN'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RC29N-MATNR'
                                       itab-matnr.           "'3000000107'.
        PERFORM bdc_field       USING 'RC29N-WERKS'
                                       itab-werks.              "'UN02'.
        PERFORM bdc_field       USING 'RC29N-STLAN'
                                       itab-stlan.              "'1'.
        PERFORM bdc_field       USING 'RC29N-STLAL'
        PERFORM bdc_field       USING 'RC29N-DATUV'
                                      '11.08.2008'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0110'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RC29K-BMENG'
                                      '1'.
        PERFORM bdc_field       USING 'RC29K-STLST'
                                      '1'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29K-EXSTL'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0111'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29K-LABOR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0140'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29P-POSTP(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RC29P-IDNRK(01)'
                                       itab-idnrk.             "'1000000232'.
        PERFORM bdc_field       USING 'RC29P-MENGE(01)'
                                       itab-menge.              "'100'.
        PERFORM bdc_field       USING 'RC29P-POSTP(01)'
                                       itab-postp.             "'L'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0130'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29P-POSNR'.
        PERFORM bdc_field       USING 'RC29P-POSNR'
                                      '0010'.
        PERFORM bdc_field       USING 'RC29P-IDNRK'
                                      '1000000232'.
        PERFORM bdc_field       USING 'RC29P-MENGE'
                                      '100'.
        PERFORM bdc_field       USING 'RC29P-MEINS'
                                      'KG'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0131'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29P-POTX1'.
        PERFORM bdc_field       USING 'RC29P-SANKA'
                                      'X'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0140'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29P-POSNR(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_dynpro      USING 'SAPLCSDI' '0140'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RC29P-POSNR(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=FCBU'.
        PERFORM bdc_transaction USING 'CS01'.
      ENDLOOP.
      PERFORM close_group.

    Hi
    Check this sample code for the Table Control in BDC:
    data: fnam(20) type c.
    move 1 to id.
        loop at TI_STAGING WHERE VENDOR = IT_STAGING-VENDOR AND DOCDATE = IT_STAGING-DOCDATE.
          concatenate 'RM06E-EPSTP(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-itmcategory.
          concatenate 'EKPO-KNTTP(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-accassignment.
          concatenate 'EKPO-EMATN(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-material.
          concatenate 'EKPO-TXZ01(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-shortxt.
          quan = ti_staging-poqty.
          concatenate 'EKPO-MENGE(0' id ')' into fnam.
          perform bdc_field       using fnam quan.
          concatenate 'RM06E-EEIND(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-deliverydate.
          netpr = ti_staging-netpr.
          concatenate 'EKPO-NETPR(0' id ')' into fnam.
          perform bdc_field       using fnam netpr.
          concatenate 'EKPO-MATKL(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-mategroup.
          concatenate 'EKPO-WERKS(0' id ')' into fnam.
          perform bdc_field       using fnam TI_STAGING-plant.
          ID = ID + 1.
        ENDLOOP.
    Regards,
    Vishwa.

  • How to select perticular row in table control for BDC

    Hi all
    I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is  material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
    Please Suggest me. it urgent.
    Thanks& Regards,
    RP

    Hi all
    I want to select perticular row in table control for deletion through BDC. My transaction is CA02, My input is  material no and plant , then it display table control with work center. Now i want to select W999 cost center and delete through BDC.
    Please Suggest me. it urgent.
    Thanks& Regards,
    RP

  • Problem with the table control BDC in FV60 transaction

    Hi All,
    I got the problem with the table control in FV60 transaction.
    This is working for 900 line items.After 900 line items it is giving the problem like it is 1000th line item.You can post only 999 line items.
    I know we can post only 999 line items,but in my file only 920 line items.
    Please give me solution,if anybody come across this situation.
    Thanks & regards,
    rakesh.

    Hello Rakesh ,
    your file may have only 920 line items , but based on those line items, SAP may create few more  new lines ( based on the clearing recon accounts , inter company transaction ...etc )...
    regards
    Prabhu

  • BDC: Table Control Screen Resolution

    Hi Abapers,
    1.In BDC while handling table control , how to handle screen resolution , that means in some systems i can see 5 item entries , in some systems i can see 10 item entries how to handle this , can u  send the Code relating this.
    With Regards
    Bhaskar Rao.M

    hi
    The numeber of lines of table control for BDC depend on screen resolution, but It can't be managed by program.
    So the better solution is to create a bdc doesn't depend on resolution.
    It can do that using always the first two lines of table control.
    When you start the simulation, first record has to be placed in first line of tc and the second in second one.
    Before placing the third record, it needs to place the second record to the top and so the third record can be placed in the second line.
    Before placing the next record, it needs to place the third record to the top and so the fourth record can be placed in the second line and so.
    In this way your BDC'll use alwways the first two lines of tc and your program won't depend on resolution.
    The problem is the transaction you need to simulate by BDC has to have a scroll functionality to allow to place the last record was elaborated to the top of tc, so the second line of tc can always be used to place the new record.
    If there isn't this functionality, it's better to use a BAPI instead of BDC.
    check these two
    BDC - standard screen resolution required?
    https://forums.sdn.sap.com/click.jspa?searchID=739193&messageID=823953
    reward points if found helpful

  • BDC table control using Excel sheet upload

    Hi All,
    I am working BDC table control.I want to upload the From excel sheet.I am using the FM ALSM_EXCEL_TO_INTERNAL_TABLE to upload the the data into my internal table.The data is populating in the internal table.
    Now i have problem tat how to populate this excel sheet data to the Bdc table control.
    Can nybody help me out.\[removed by moderator\]
    Thanks,
    Swapna.
    Edited by: Jan Stallkamp on Jul 25, 2008 10:57 AM

    after fetching data from EXCEL sheet, each column data (in excel sheet) will be uploaded to individual record into your internal table along with row number and column number, loop through that internal table and collect all your excel data into record format.pls refer the below code.
    data:
         i_excel    type alsmex_tabline occurs 0 with header line,
         l_row      type i value 1.
    data:
         begin of x_data occurs 0,
                kunnr     like RF02L-KUNNR,
                klimk(17) type c,
                CTLPC     like knkk-CTLPC,
          end  of x_data,
          begin of x_data1 occurs 0,
                data(106),
          end   of x_data1.
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
       exporting
         filename                      = p_fname
         i_begin_col                   = 1
         i_begin_row                   = 1
         i_end_col                     = no.of columns in your excel file
         i_end_row                     = no.of rows in your file
       tables
         intern                        = i_excel.
    if sy-subrc = 0.
       loop at i_excel.
         if l_row <> i_excel-row.
            append x_data.
            clear x_data.
         endif.
         case i_excel-col.
            when 1.
              x_data-kunnr = i_excel-value.
            when 2.
              x_data-klimk = i_excel-value.
            when 3.
              x_data-CTLPC = i_excel-value.
         endcase.
         l_row = i_excel-row.
         clear i_excel.
         at last.
            append x_data.
         endat.
       endloop.
    endif.
    then loop through the internal table X_DATA, pass the data to your table control like.
    tbl_control-field1(1) = x_data-field1.
    tbl_control-field2(1) = x_data-field2.
    tbl_control-fieldn(1) = x_data-fieldn.
    Regards,
    Sreeram.

  • Error Handling in table control for line item.

    Hi,
    Please how to do error handling in table control for line item in bdc,i have used format_message for header but i don't no fill decamps internal tabled and  how to do background processing in call transaction.
    Thanks

    Background processing is not possible using call transaction method.
    You can create an executable program which can have CALL TRANSACTION BDC code. And this can be run in background.
    What do you exactly mean by Error handling for Items in table control. Can you give some more details.

  • How to create screen resolution in bdc table control

    hi gurus
    can anyone suggest me
    how to create screen resolution in bdc table control
    thanks&regards
    mark.

    Hi ,
    Using CTU_PARAMS table for screen resolution .
    For this sample code.
    This is for Transation  FB60.
    report ZZFB60
           no standard page heading line-size 255.
    tables t100.
    PARAMETERS : p_file1  like  rlgrap-filename,
                 p_doctyp like  RF05A-BUSCS,
                 p_invdat like  INVFO-BLDAT,
                 p_posdat like  INVFO-BUDAT.
    CONSTANTS  :  C_TRANS_FB60(4) VALUE 'FB60'.
    *Parameter string for runtime of CALL TRANSACTION
    data : l_option type ctu_params,
           l_subrc type sysubrc.
    DATA :  l_mstring(150).
    data      accnt type char17.
    data       : day   type char2,
                 month type char2,
                 year  type char4,
                 date1 type char10,
                 date2 type char10.
    data      :  cnt(2) TYPE n,
                 cnt1 type i,
                 fld(25) TYPE c.
    data : begin of excel occurs 0,
            fieldname(255) type c,
           end of excel.
    DATA:BEGIN OF it_mess OCCURS 0,
             msgtyp(5),
             lms(200),
              msgv1(50),
         END OF it_mess.
    data: begin of t_record occurs 0,
             BUKRS(004),
            ACCNT(017),
            XBLNR(016),
            WRBTR1(016),
            WAERS(005),
            SECCO(004) ,
            SGTXT(050),
            HKONT(010),
            WRBTR2(017),
            MWSKZ(002),
            GSBER(004),
            KOSTL(010),
         end of t_record.
    *Internal Table for Header Data
    DATA :  BEGIN OF t_head OCCURS 0,
            BUKRS(004),      "Company Code
            ACCNT(017),      "Account or Vendor
            XBLNR(016),      "Reference
            WRBTR1(017),     "Amount in document currency
            WAERS(005),      "Currency
            SECCO(004),      "Section Code
            SGTXT(050),      "Text
            END OF t_head.
    *Internal table for Item Data
    DATA :  BEGIN OF t_item OCCURS 0,
            ACCNT(017),      "Account
            HKONT(010),     "GL Account
            WRBTR2(017),    "Line item Amount in document currency
            MWSKZ(002),     "Tax Code
            GSBER(004),     " Business Area
            KOSTL(010),     "Cost centre
            END OF t_item.
    DATA: IT_BDCDATA      LIKE  BDCDATA OCCURS 0 WITH HEADER LINE,
          IT_BDC_MESSAGES LIKE  BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    *include bdcrecx1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      PERFORM  file_selection.
      PERFORM  data_upload.
      PERFORM  table_control.
    start-of-selection.
    l_option-defsize = 'X'.
    l_option-dismode = 'A'.
    l_option-updmode = 'S'.
    day = p_invdat+6(2).
    month = p_invdat+4(2).
    year =  p_invdat+0(4).
    concatenate day month year into date1 SEPARATED BY '.'.
    day = p_posdat+6(2).
    month = p_posdat+4(2).
    year =  p_posdat+0(4).
    concatenate day month year into date2 SEPARATED BY '.'.
    *perform open_group.
    loop at t_head.
    CLEAR    IT_BDCDATA.
    REFRESH  IT_BDCDATA.
    perform bdc_dynpro      using   'SAPLACHD'         '1000'.
    perform bdc_field       using   'BDC_OKCODE'        '=ENTR'.
    perform bdc_field       using   'BKPF-BUKRS'        t_head-bukrs.
    perform bdc_dynpro      using   'SAPMF05A'          '1100'.
    perform bdc_field       using   'BDC_OKCODE'        '/00'.
    perform bdc_field       using   'RF05A-BUSCS'       p_doctyp.
    perform bdc_field       using   'INVFO-ACCNT'       t_head-accnt.
    perform bdc_field       using   'INVFO-BLDAT'       date1.
    perform bdc_field       using   'INVFO-BUDAT'       date2.
    perform bdc_field       using   'INVFO-XBLNR'       t_head-xblnr.
    perform bdc_field       using   'INVFO-WRBTR'       t_head-wrbtr1.
    perform bdc_field       using   'INVFO-WAERS'       t_head-waers.
    perform bdc_field       using   'INVFO-SECCO'       t_head-secco.
    perform bdc_field       using   'INVFO-SGTXT'       t_head-sgtxt.
    cnt = 1.
    cnt1 = 1.
    loop at t_item where accnt = t_head-accnt.
    *if cnt > 4.
    *cnt = 4.
    *endif.
    if cnt1 gt 1.
    CONCATENATE 'ACGL_ITEM-MARKSP(' cnt ')' INTO fld.
    perform bdc_field      using   fld                   'X'.
    perform bdc_dynpro      using 'SAPMF05A'          '1100'.
    perform bdc_field       using 'BDC_OKCODE'        '=0005'.
    endif.
    perform bdc_dynpro      using 'SAPMF05A'          '1100'.
    perform bdc_field       using   'BDC_OKCODE'        '/00'.
    CONCATENATE 'ACGL_ITEM-HKONT(' cnt ')' INTO fld.
    perform bdc_field       using  fld                t_item-hkont.
    CONCATENATE 'ACGL_ITEM-WRBTR(' cnt ')' INTO fld.
    perform bdc_field  using       fld                t_item-wrbtr2.
    CONCATENATE 'ACGL_ITEM-MWSKZ(' cnt ')' INTO fld.
    perform bdc_field       using  fld                t_item-mwskz.
    CONCATENATE 'ACGL_ITEM-GSBER(' cnt ')' INTO fld.
    perform bdc_field       using  fld                t_item-gsber.
    CONCATENATE 'ACGL_ITEM-KOSTL(' cnt ')' INTO fld.
    perform bdc_field       using  fld                t_item-kostl.
    perform bdc_field      using  'BDC_CURSOR'  fld.
    *CONCATENATE 'ACGL_ITEM-MARKSP(' cnt ')' INTO fld.
    *perform bdc_field      using   fld                   'X'.
    cnt1 = cnt1 + 1.
    *cnt = cnt + 1.
    *if cnt > 1.
    *perform bdc_dynpro      using 'SAPMF05A'          '1100'.
    *perform bdc_field       using 'BDC_OKCODE'        '=0005'.
    **perform bdc_field       using 'BDC_OKCODE'        '=0006'.
    *endif.
    endloop.
    perform bdc_dynpro      using 'SAPMF05A' '1100'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BS'.
    perform bdc_dynpro      using 'SAPMSSY0' '0120'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    *perform bdc_transaction using 'FB60'.
    CALL TRANSACTION C_TRANS_FB60 USING IT_BDCDATA  options from l_option
                                 MESSAGES INTO IT_BDC_MESSAGES.
    perform error.
    perform errordownload.
    endloop.
    *perform close_group.
    *Form  data_upload
    FORM data_upload .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME              =  p_file1
       FILETYPE              = 'DAT'
      TABLES
        DATA_TAB             =  t_record.
    ENDFORM.                    " data_upload
    *Form  file_selection
    FORM file_selection .
    CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  =  syst-cprog
          dynpro_number =  syst-dynnr
          field_name    = 'p_file1'
        IMPORTING
          file_name     =  p_file1.
    ENDFORM.                    " file_selection
    Form  BDC_DYNPRO
    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.
    *Form  BDC_FIELD
    FORM  bdc_field using fnam fval.
      CLEAR  IT_BDCDATA.
      IT_BDCDATA-FNAM = FNAM.
      IT_BDCDATA-FVAL = FVAL.
      APPEND  IT_BDCDATA.
    ENDFORM.
    Table Control
    FORM table_control .
      LOOP AT t_record.
        ON CHANGE OF t_record-accnt.
          MOVE-CORRESPONDING t_record TO t_head.
          APPEND t_head.
        ENDON.
      loop at t_head.
             t_item-accnt   =  t_head-accnt.
             t_item-hkont   =  t_record-hkont.
             t_item-wrbtr2  =  t_record-wrbtr2 .
             t_item-mwskz   =  t_record-mwskz .
             t_item-gsber   =  t_record-gsber .
             t_item-kostl   =  t_record-kostl.
        APPEND t_item.
    endloop.
         If t_record-level = 'H'.
             t_head-bukrs   =  t_record-text1.
             t_head-accnt   =  t_record-text2.
             t_head-xblnr   =  t_record-text3.
             t_head-wrbtr1  =  t_record-text4.
             t_head-waers   =  t_record-text5.
             t_head-secco   =  t_record-text6.
             t_head-sgtxt   =  t_record-text7.
          APPEND t_head.
         else.
            t_item-accnt   =  t_head-accnt.
            t_item-hkont   =  t_record-text1.
            t_item-wrbtr2  =  t_record-text2.
            t_item-mwskz   =  t_record-text3.
            t_item-gsber   =  t_record-text4.
            t_item-kostl   =  t_record-text5.
         APPEND t_item.
         endif.
      ENDLOOP.
    ENDFORM.
    FORM error .
      LOOP AT IT_BDC_MESSAGES.
        IF IT_BDC_MESSAGES-msgtyp = 'E'.
       SELECT single  * FROM t100  WHERE
                                    sprsl = it_BDC_MESSAGES-msgspra
                                    AND   arbgb = IT_BDC_MESSAGES-msgid
                                    AND   msgnr = IT_BDC_MESSAGES-msgnr.
          IF sy-subrc = 0.
            l_mstring = t100-text.
            IF l_mstring CS '&1'.
              REPLACE '&1' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
              REPLACE '&2' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
              REPLACE '&3' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
              REPLACE '&4' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
            ELSE.
              REPLACE '&' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
              REPLACE '&' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
              REPLACE '&' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
              REPLACE '&' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
            ENDIF.
            CONDENSE l_mstring.
            it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
            APPEND it_mess.
          ELSE.
            it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
            APPEND it_mess.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    form errordownload.
    *down the internal table to excel file.
    call function 'EXCEL_OLE_STANDARD_DAT'
               EXPORTING
                    file_name                 = 'c:/Error.xls'
               TABLES
                    data_tab                  = it_mess
                    fieldnames                = excel
               EXCEPTIONS
                    file_not_exist            = 1
                    filename_expected         = 2
                    communication_error       = 3
                    ole_object_method_error   = 4
                    ole_object_property_error = 5
                    invalid_filename          = 6
                    invalid_pivot_fields      = 7
                    download_problem          = 8
                    others                    = 9.
    endform.
    Reward if useful
    Regards,
    Narasimha
    Edited by: narasimha marella on May 13, 2008 12:12 PM

  • Problem with a table control

    Hi gurus,
    I´ve a problem with a table control. It has 3 columns which one is a checkbox.
    I can fill all fields but in the moment I mark the checkbox this line must be unwritable. How can I do it?
    Thanks for all
    Dani

    Assign a function code to the checkbox column....
    so when u check / uncheck any entry, PAI + PBO will be triggered....
    In the PBO during the loop of table control, check the checkbox field value. if it is 'X', make the row readonly
    by looping at screen and setting screen-input = 0 for rest of the columns.
    like ...
    LOOP AT tc_itab
           WITH CONTROL tc_test
           CURSOR tc_test-current_line.
       module set_row_readonly. " loop at screen and set input = '0' if checkbox is checked...
    ENDLOOP.

  • BDC Table Controler

    hi friends,
    Could u please tell me what BDC TABLE CONTROLER
    in which cases we can use the bdc Table Contorler
    Regards
    srinu y

    Hi srinu,
    <b>Check this link</b>
    http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
    How to deal with table control / step loop in BDC
    <b>Steploop</b> and <b>table contol</b> 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')
    Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
    Demo <b>ABAP code</b> has two purposes:
    <b>1.</b> how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    <b>2.</b> using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
    Now I begin to describe the step to implement my method:
    (I use transaction 'ME21', screen 121 for sample,
    the method using is Call Transation Using..)
    <b>Step1:</b> 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)
    <b>Step2:</b> 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)
    <b>Step3:</b> write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    <b>global data:</b> 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.
    <b>Step4</b> 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.
    <b>Step5</b> 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.
    <b>Step6</b> 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: <material>, <quan>, <indicator>.
    data: name1(14) value 'EKPO-EMATN(XX)',
    name2(14) value 'EKPO-MENGE(XX)',
    name3(15) value 'RM06E-SELKZ(XX)'.
    assign: name1 to <material>,
    name2 to <quan>,
    name3 to <indicator>.
    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 <material> DataTable-matnr.
    perform bdcfield using <quan> DataTable-menge.
    perform bdcfield using <indicator> DataTable-indicator.
    endloop.
    enddo.
    Reward with points if it is helpful
    Cheers
    Alfred

Maybe you are looking for

  • Serial Number Woes

    Hi everyone, I'm hoping someone will be able to help me out! I recently ressurected a G4 powermac - PCI graphics and succefully installed OS 10.4, office etc. However, I have now realised that the computer must have been repaired at some point and th

  • 7.0 - Cannot save journal after changing content

    Hi all, When I have copied journals to another category or time, and want to change some of its content, I cannot save the journal, as the button 'Save' is not activated. When I post the journal, it does change back to the original entries. We curren

  • Compressor 1 or 2

    Is it only compressor 2 that allows dolby ac3 compression - I have compressor 1 and can't find the option. I have exported an audio file of 362 megabytes but by the time I import it to FCP it reads as 1.5 gig - too weird for me any help anyone all I

  • Just downloaded trial version and icon won't open at all

    I wanted to try out photoshop before I bought it, so downloaded the trial of the creative cloud and whilst was downloading photoshop, it crashed my laptop, forcing me to restart it and now when I try to open the creative cloud icon on my desktop it d

  • Create a Movie Menu

    I want to put together a movie with a dvd-like menu where people can jumpt to different chapters but only watch that one chapter.  I work for a school system and offer professional development for teachers and want to create a move with multiple vide