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

Similar Messages

  • 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

  • Controlling Screen Resolution in BDCs

    Hi,
    Can any one explain about the process for Controlling Screen Resolution in BDCs.
    Thanks & Regards,
    Rajesh.

    Hi,
    If u write table control bdc program in 14'' monitor screen, then if the same program u run at different monitor size, then the screen resolution problem comes in to the picture,
    like, u get 5 records in table control in one screen, and some other records in other screen, to avoid this screen resolution problem we use CTU-PARAMS Structure.
    In ur program u have to set
    defsize type ctu_params-defsize value 'X',
    Then u will be free of screen resolution problem.
    Fill the str CTU_PARAMS-defsize = 'X' and pass in CTU stmnt as
    call transaction 'XXX' options using t_bdcdata ctu_params.
    Analysing :
    1. If nothing works, then we have to
    some ifs & buts.
    2. There shall be normally
    2-4 different kinds of resolution
    on various users comptuers.
    3. Based on this,
    we have to know beforehand,
    what will be the number of rows
    in the table control.
    4. The user can be given
    a selection/paraemter
    for resolution
    eg. 800x600
    1024x100
    axb
    etc.
    5. Based on this, we will hardcode
    in the program (based upon our knowledge/recording
    which we have seen and done)
    we will hardcode
    the number of lines
    in the VARIBLE.
    6. Then we can simply use this variable
    for our LOOP and logic purpose.
    7. It will be the responsibiltiy of the
    use to CHOOSE THE CORRECT resolution,
    on the selection-screen.
    For screen resolution use ctu_params, with default size
    Data : f_option type ctu_params,
    f_option-updmode = 'S'.
    f_option-defsize = 'X'.
    f_option-dismode = 'N'.
    call transaction 'VA01' using bdcdata options from f_option messages into bdcerror.
    CALL TRANSACTION tcode... OPTIONS FROM opt
    ... OPTIONS FROM opt
    Effect
    Allows you to control processing using the values of the componetns of the structure opt, which must have the ABAP Dictionary type CTU_PARAMS. The components have the following meanings:
    DISMODE
    Display mode (like the MODE addition)
    UPDMODE
    Update mode (like the UPDATE addition)
    CATTMODE
    CATT mode (controls a CATT)
    CATT mode can have the following values:
    ' ' No CATT active
    'N' CATT without single-screen control
    'A' CATT with single-screen control
    DEFSIZE
    Use default window size
    RACOMMIT
    Do not end transaction at COMMIT WORK
    NOBINPT
    No batch input mode (that is, SY-BINPT = SPACE)
    NOBIEND
    No batch input mode after the end of BDC data.
    The components DEFSIZE , RACOMMIT, NOBINPT, and NOBIEND always take the following values:
    'X' Yes
    ' ' No
    If you do not use the OPTIONS FROM addition, the following control parameter settings apply:
    DISMODE
    From addition MODE
    UPDMODE
    From addition UPDATE
    CATTMODE
    No CATT active
    DEFSIZE
    Do not use default window size
    RACOMMIT
    Successful end on COMMIT WORK
    NOBINPT
    Batch input mode active ( SY-BINPT = X
    NOBIEND
    Batch input mode remains active after the BDC data
    Hope it makes u understand...
    Reagrds,

  • 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.

  • How do we handle BDC table control

    hi sap technical guru,
    PLS suggest me how to handle BDC table control while uploading data to sap R/3
    regards,

    Hi,
    First take BDC recording for required transaction from SHDB then you will find screen field names, screen numbers sequence, According to that pass values to below BDC_DYNPRO and BDC_FIELD forms and append data to BDC table. In my requirement I have done this for VB03 transaction passed values to VB03 transaction from my selection screen.
    *& Report  ZS_VB03_TRANSACTION
    REPORT  ZS_VB03_TRANSACTION.
    TABLES: KOMGG,                        "Dialogkommunikationstab
    T685T,                         "Text zum Konditionsart
    T185F,                         "Folgebildsteurung
    T681,                          "Konditionstabelle
    TMC1T, G000, TPARA.                         "Kurztext zur Konditionstabell
    * Sales Organization                                                   *
    SELECT-OPTIONS S_F001 FOR KOMGG-VKORG.
    *MEMORY ID VKO.
    * Distribution Channel                                                 *
    SELECT-OPTIONS S_F002 FOR KOMGG-VTWEG
    MEMORY ID VTW.
    * Division                                                             *
    SELECT-OPTIONS S_F003 FOR KOMGG-SPART
    MEMORY ID SPA.
    * CustomerHierarchy 01                                                 *
    SELECT-OPTIONS S_F004 FOR KOMGG-HIENR01.
    * Material                                                             *
    SELECT-OPTIONS S_F005 FOR KOMGG-MATNR
    MEMORY ID MAT
    MATCHCODE OBJECT MAT1.
    * Customer                                                             *
    SELECT-OPTIONS S_F006 FOR KOMGG-KUNNR
    MEMORY ID KUN
    MATCHCODE OBJECT DEBI.
    *                       "Selektionsdatum                               *
    SELECTION-SCREEN SKIP 1.
    PARAMETERS SEL_DATE LIKE RV130-DATAM
    DEFAULT SY-DATLO.
    PARAMETERS: r_vb03 TYPE c RADIOBUTTON GROUP rb1 DEFAULT 'X',
    r2 type c RADIOBUTTON GROUP rb1.
    *    *       Batchinputdata of single transaction
    DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    *       messages of call transaction
    DATA:   MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    data: lv TYPE i.
    data: s1 type KOMGG-VKORG,
    s2 type KOMGG-VKORG.
    START-OF-SELECTION.
    if r_vb03 = 'X'.
    data: num(2) TYPE n VALUE '01',
    lv_string(40) type c,
    lv_s_f001 like s_f001.
    set PARAMETER ID: 'VGK' FIELD 'A001'. "Place ur default value here in A001 place.
    If S_f001-high is INITIAL.
    perform bdc_field       using 'BDC_CURSOR'
    'F001-LOW'.
    perform bdc_field       using 'BDC_OKCODE'
    '=%003'.
    perform bdc_dynpro      using 'SAPLALDB' '3000'.
    perform bdc_field       using 'BDC_OKCODE'
    '=ACPT'.
    perform bdc_field       using 'BDC_CURSOR'
    'RSCSEL-SLOW_I(01)'.
    loop at S_f001 into lv_s_f001.
    CONCATENATE 'RSCSEL-SLOW_I(' num ')' INTO lv_string.
    perform bdc_field       using 'BDC_CURSOR'
    lv_string.
    perform bdc_field       using lv_string
    lv_s_f001-low.
    clear: lv_s_f001, lv_string.
    num = num + 1.
    ENDLOOP.
    clear num.
    perform bdc_dynpro      using 'RV13GAAB' '1000'.
    perform bdc_field       using 'BDC_CURSOR'
    'F002-LOW'.
    ELSE.
    perform bdc_dynpro      using 'RV13GAAB' '1000'.
    perform bdc_field       using 'BDC_CURSOR'
    'F001-LOW'.
    perform bdc_field       using 'F001-LOW' S_f001-low.
    perform bdc_field       using 'F001-HIGH' S_f001-high.
    endif.
    perform bdc_field       using 'F002-LOW' S_F002-low.
    perform bdc_field       using 'F002-HIGH' S_F002-High.
    perform bdc_field       using 'F004-high' S_F004-high.
    perform bdc_field       using 'F005-LOW' S_F005-low.
    perform bdc_field       using 'F003-LOW' S_F003-low.
    perform bdc_field       using 'F003-High' S_F003-high.
    perform bdc_field       using 'F004-LOW' S_F004-low.
    perform bdc_field       using 'F005-high' S_F005-high.
    perform bdc_field       using 'F006-LOW' S_F006-low.
    perform bdc_field       using 'F006-high' S_F006-high.
    call TRANSACTION 'VB03' USING BDCDATA MODE 'E' MESSAGES INTO MESSTAB.
    ENDIF.
    *        Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
    CLEAR BDCDATA.
    BDCDATA-PROGRAM  = PROGRAM.
    BDCDATA-DYNPRO   = DYNPRO.
    BDCDATA-DYNBEGIN = 'X'.
    APPEND BDCDATA.
    ENDFORM.
    *        Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    CLEAR BDCDATA.
    BDCDATA-FNAM = FNAM.
    BDCDATA-FVAL = FVAL.
    APPEND BDCDATA.
    ENDFORM.

  • 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

  • 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.

  • How to make the Page UP and down work on a table control screen?

    Dear all,
    Can some one suggest how to make the table control screen work with Page Up and Page down controls.
    when I press on Page down it works for the first time and after that i need to select the table to make it work the second time. it there a way I can make the index on the screen stay on the table control at all times.
    Regard,
    Vj

    Take this code as a referance:
    Sample code for vertical scrolling in PAI processing will look like this:
    MODULE user_command_XXXX INPUT. (XXXX is screen no.)
      CASE ok_code.
        WHEN 'P--'.
          CLEAR ok_code.
          PERFORM paging USING 'P--'.
        WHEN 'P-'.
          CLEAR ok_code.
          PERFORM paging USING 'P-'.
        WHEN 'P+'.
          CLEAR ok_code.
          PERFORM paging USING 'P+'.
        WHEN 'P++'.
          CLEAR ok_code.
          PERFORM paging USING 'P++'.
    *&      Form  PAGING
    *       Form to do scrolling for screen XXXX
    *      -->CODE   OKCODE value (P--, P-, P+, P++ )
    FORM paging USING code.
      DATA: i TYPE i,
            j TYPE i.
      CASE code.
        WHEN 'P--'. <table control name>-top_line = 1.
        WHEN 'P-'.
          <table control name>-top_line =
                  <table control name>-top_line - line_count.
          IF <table control name>-top_line LE 0.
            <table control name>-top_line = 1.
          ENDIF.
        WHEN 'P+'.
          i = <table control name>-top_line + line_count.
          j = <table control name>-lines - line_count + 1.
          IF j LE 0. j = 1. ENDIF.
          IF i LE j.
            <table control name>-top_line = i.
          ELSE.
            <table control name>-top_line = j.
          ENDIF.
        WHEN 'P++'.
          <table control name>-top_line =
                 <table control name>-lines - line_count + 1.
          IF <table control name>-top_line LE 0.
            <table control name>-top_line = 1.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " PAGING
    Regards,
    Ravi

  • HOW TO MAKE THE CONTENT OF THE TABLE PRINT IN A TABLE CONTROL SCREEN?

    Can any one tell me how to make the content of the table control print in a table control screen!!?
    Please help!!
    I have to make the contents of a table in the table control screen print ? any idea
    Regards,
    Vj

    Please refer to Demo Program,
    DEMO_DYNPRO_TABCONT_LOOP
    Its very clear.
    Shreekant

  • HOW TO MAKE THE FIELDS ON TABLE CONTROL SCREEN FIXED!!

    Dear all,
    Can you please tell me as to how to make the fields on the table control screen fixed (not respond to the scroll bar) i.e. simillar to MC88 screen , the first two fields are fixed and don't respond to the scroll.
    Please Help!!!!
    Vj

    Hi
    In TC, goto attributes and set 'Fixed columns' as 2. This will fix the first 2 columns.
    Regards
    Navneet

  • Unable to scroll down in table control screen .

    Hi techies ,
    am attaching the table control screen .
    am not able to scroll down in that .
    and also may i know the reason why am not able to tick the checkbox ?
    it seems in disable mode .

    Hi Ajay,
    It was the only reason, ever i have faced...
    And other possibility is regarding tbc-lines, but i saw that you were doing this using describe table.
    Sometimes the table control will not show all the records in internal table(case while changing number of records in internal table each time )..
    At this case you have to set the lines in TBC.. using
    describe table itab lines tbc-lines.
    tbc-lines is very useful, if you want to enable a new blank line in table control, just do this
    tbc-lines = tbc-lines + 1.
    Explore all properties of table control it is very useful.
    I think, i could solved your issue.. thanks for your appreciation.
    Regards
    Sreekanth

  • 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 Session method : Screen Resolution Problem

    Hi all,
    I have created a BDC for Sales Order(VA01) and Call Transaction method working perfectly but when Iam creating a session and running in background then the session is ending up with errors.When I processed it in foreground mode I observed that the screen resolution is smaller.I tried checikng the checkbox 'Display standard size' but it is not working.Any Idea how to resolve this issue?
    Thanks & Regards,
    Rock.

    hi...
    These kind of problem come into picture when you go for filling values in table control....
    like filling in 20 number of lines on the screen when you can fill only 10 on the scrren.
    so in such casees what you can do is
    start recoding using SHDB
    do operations and when it come to filling of table control
    fill the first line with value  and then use some option on the application tool bar to go to the next line
    then fill the another line.
    I was getting same problem as your but this way it was done perfectly and u can apply it at number of places.
    or if you dont want to go for the lengthy process just record again and use option on tool bar of SHDB to generate a report for that
    Edited by: Mohit Kumar on Feb 6, 2009 7:40 AM

  • 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

  • In BDC table control

    hi
    In BDC how to transfer the data to table control

    hi
    what ever the data that u want to trnasfer to table ctrl, put it in a flat file.
    create an internal able that can occupy those datas.
    then transfer from internal table to table control.
    ex: for me41/.
    REPORT YELS_ME41_BDC_V  NO STANDARD PAGE HEADING LINE-SIZE 255.
    INCLUDE BDCRECX1.
    INTERNAL TABLE DECLARATION.
    DATA : BEGIN OF ITAB OCCURS 0,
           V_NUM(3) TYPE  C,"SERIAL NUMBER
           EMATN LIKE EKPO-EMATN,
           TXZ01 LIKE EKPO-TXZ01,
           ANMNG(13) TYPE C,
           MEINS(3) TYPE C,
           LPEIN LIKE RM06E-LPEIN,
           EEIND LIKE RM06E-EEIND,
           MATKL LIKE EKPO-MATKL,
           END OF ITAB.
    VARIABLE DECLARATION
    DATA : V_LASTNUM(3) TYPE C,
           V_TEMPVAR(15),
           V_PAGES(3) TYPE C VALUE '10',
           V_COUNT TYPE I,
           V_CTR TYPE I,
           V_TCTR(2) TYPE C,
           V_TEST TYPE C VALUE 0,
           ITEM LIKE RM06E-EBELP.
    *DATA: BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
    BEGIN OF PROGRAM.
    START-OF-SELECTION.
      PERFORM GET-DATA.
      SORT ITAB BY NUM EEIND.
      PERFORM OPEN_GROUP.
    *DATA TRANSFERRED FROM INTERNAL TABLE TO IST 2ND SCREEN FIELDS(HEADER
    *DATA)
      LOOP AT ITAB.
        IF ITAB-V_NUM NE V_LASTNUM.
        " HEADER DATA EXECUTES FOR ONLY ONE TIME FOR ONE RFQ GENERATION
    WHEN SNO IS NOT EQUAL TO LASTNUMBER. THEN PROCEED.
          V_TEST = 0.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0300'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EKKO-ANGDT'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_FIELD       USING 'RM06E-ASART'
                                        'AN'. "RFQ TYPE.
          PERFORM BDC_FIELD       USING 'EKKO-SPRAS'
                                        'EN'. " LANGUAGE KEY.
          PERFORM BDC_FIELD       USING 'RM06E-ANFDT'
                                        '19.07.2007'."RFQ DATE.
          PERFORM BDC_FIELD       USING 'EKKO-ANGDT'
                                        '29.07.2007'."QUOTATION DEAD LINE.
          PERFORM BDC_FIELD       USING 'EKKO-EKORG'
                                        '3000'."PURCHASE ORGANISATION.
          PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                        '003'."PURCHASE GROUP.
          PERFORM BDC_FIELD       USING 'RM06E-LPEIN'
                                        'T'.
    IIND SCREEN.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0301'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EKKO-SUBMI'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        'BU'.
          PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                        '003'.
          PERFORM BDC_FIELD       USING 'EKKO-PINCR'
                                        '10'." ITEM INTERVAL.
          PERFORM BDC_FIELD       USING 'EKKO-SUBMI'
                                        '1'." COLL NO.
          PERFORM BDC_FIELD       USING 'EKKO-SPRAS'
                                        'EN'.
          PERFORM BDC_FIELD       USING 'EKKO-UPINC'
                                        '1'." SUB ITEM INTERVAL.
          PERFORM BDC_FIELD       USING 'EKKO-ANGDT'
                                        '29.07.2007'.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0301'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EKKO-EKGRP'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                        '003'.
          PERFORM BDC_FIELD       USING 'EKKO-PINCR'
                                        '10'.
          PERFORM BDC_FIELD       USING 'EKKO-SUBMI'
                                        '1'.
          PERFORM BDC_FIELD       USING 'EKKO-UPINC'
                                        '1'.
          PERFORM BDC_FIELD       USING 'EKKO-ANGDT'
                                        '29.07.2007'.
    **********tab ctrl*********************************************
    IIIRD SCREEN
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0320'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                'RM06E-EEIND(01)'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_FIELD       USING 'EKKO-ANGDT'
                                        '29.07.2007'.
    DATA MOVED FROM INTERNAL TABLE TO TABLE CONTROL
          V_CTR = 0.
          "FOR ONE RFQ , MORE ITEMS WILL BE THERE. COUNT STARTS HERE.
          LOOP AT ITAB WHERE V_NUM = ITAB-V_NUM." CHECK THE SNO IS EQUAL .
            V_CTR = V_CTR + 1." COUNT IS INCREMENTED BY 1.
    MY TAB CTRL CAN HAVE ONLY 20 RECORDS.
    IF COUNT IS LESS THAN OR EQUAL TO 20 ASSIGN THIS VALUE TO TCTR VAR
            IF V_CTR <= 20.
            V_TCTR = V_CTR.
            ENDIF.
    *IF COUNT IS GREATER THAN  20 ASSIGN THIS VALUE TO TCTR VAR
            IF V_CTR > 20.
              V_TCTR = '20'.
            ENDIF.
    IF COUNT IS LESS THAN OR EQUAL TO 10 BLANK SPACE IS ALLOTTED TO TEST
    VAR.
            IF V_CTR >= 10.
              V_TEST = ''.
            ENDIF.
    WHEN COUNT IS LESS THAN 20 THEN ITEM (PAGES) WILL BE 10.
            IF V_CTR < 20.
              V_PAGES =  10.
              PERFORM BDC_FIELD       USING 'RM06E-EBELP'
                                 V_PAGES.
            ENDIF.
    WHEN COUNT IS GREATER THAN 20 THEN ITEM (PAGES) WILL BE INCREMENTED BY
    10 FOR EVERY ENTRY..
            IF V_CTR >= 20.
              V_PAGES = V_PAGES + 10.
              PERFORM BDC_FIELD       USING 'RM06E-EBELP'
                                 V_PAGES.
            ENDIF.
          CONCTAENATION IS DONE TO GET A PATTERN LIKE EKPO-EMATN(01).
          UPLOAD EMATN FIELD INTO TABLE CONTROL
            CONCATENATE  'ekpo-ematn(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-EMATN.
          UPLOAD SHORT TEXT FIELD INTO TABLE CONTROL
            CONCATENATE  'ekpo-txz01(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-TXZ01.
          UPLOAD QUANTITY FIELD INTO TABLE CONTROL
            CONCATENATE  'rm06e-anmng(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-ANMNG.
          UPLOAD UNIT OF MEASURE FIELD INTO TABLE CONTROL
            CONCATENATE  'ekpo-meins(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-MEINS.
          UPLOAD DATE FORMAT FIELD INTO TABLE CONTROL
            CONCATENATE  'rm06e-lpein(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-LPEIN.
          UPLOAD DATE FIELD INTO TABLE CONTROL
            CONCATENATE  'rm06e-eeind(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING V_TEMPVAR ITAB-EEIND.
          UPLOAD MATERIAL GROUP FIELD INTO TABLE CONTROL
            CONCATENATE 'EKPO-MATKL(' V_TEST  V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD USING  V_TEMPVAR ITAB-MATKL.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0320'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          'EKKO-ANGDT'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=LS'.
            PERFORM BDC_FIELD       USING 'EKKO-ANGDT'
                                          '29.07.2007'.
    *AFTER INSERTING ONE ROW OF DATA PRESS ENTER .CURSOR SHOULD BE AT DEAD
    *LINE DATE.
            CONCATENATE  'ekpo-ematn(' V_TEST V_TCTR ')' INTO V_TEMPVAR.
            CONDENSE V_TEMPVAR NO-GAPS.
            PERFORM BDC_FIELD    USING 'BDC_CURSOR' V_TEMPVAR.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          ENDLOOP.
    *************************vendor addr*******************
          V_LASTNUM = ITAB-V_NUM.
    *******ENTER VENDOR NUMBER AND SAVE.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0140'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EKKO-LIFNR'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '/00'.
          PERFORM BDC_FIELD       USING 'EKKO-LIFNR'
                                        '9054'." VENDOR NUMBER.
          PERFORM BDC_DYNPRO      USING 'SAPLMEXF' '0100'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '=ENTE'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'RM06E-SPRAS'.
          PERFORM BDC_FIELD       USING 'BUTTON_INIT'
                                        'X'.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0140'.
          PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0140'.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                        'EKKO-LIFNR'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '=BU'.
          PERFORM BDC_FIELD       USING 'EKKO-LIFNR'
                                        '9054'.
          PERFORM BDC_FIELD       USING 'ADDR1_DATA-NAME1'
                                        'tttt'.
          PERFORM BDC_FIELD       USING 'ADDR1_DATA-SORT1'
                                        'TT'.
          PERFORM BDC_FIELD       USING 'ADDR1_DATA-COUNTRY'
                                        'AZ'.
          PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0300'.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '=YES'.
          PERFORM BDC_TRANSACTION USING 'ME41'.
          REFRESH BDCDATA.
        ENDIF.
      ENDLOOP.
      PERFORM CLOSE_GROUP.
    *&      Form  get-data
         UPLOAD FLAT FILES TO INTERNAL TABLE.
    FORM GET-DATA.
    *TRANSFER DATA FROM FLAT FILE TO INTERNAL TABLE.
      CALL FUNCTION 'UPLOAD'
       EXPORTING
        CODEPAGE                      = ' '
         FILENAME                      = ' '
         FILETYPE                      = ' '
      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                      = ITAB
       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.                    "get-data
    reward if useful

Maybe you are looking for