Internal table in bdc

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

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

Similar Messages

  • How to get multiple records from internal table through BDC

    PERFORM DYNPRO USING:
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_OKCODE'  '=NEWC',
      'X'  'SAPMM61L'  '0500',
      ' '  'BDC_CURSOR'  'PLPTU-PLWRK(01)',
      ' '  'BDC_OKCODE'  '=TAKE',
      ' '  'PLPTU-PLWRK(01)' '2531'. (2531 is a plant)
    This is the recording used to get plant via BDC of MS31.
    Using this code i can get only single plant...
    If i want to get multiple plants from an internal table,how i can change this code?
    Since it is a recording i cant put this code in LOOP..ENDLOOP.
    Suggest any method for doing this....
    Awaiting for ur reply...

    Hi,
    While recording also record the scroll down button.
    The you can place different plant in the BDC using loop and endloop
    Regards
    Arun

  • Bdc upload file data into internal table problem with gui_upload fm

    Hello experts,
    my coding is like this ..
    data : begin of itab occurs 0 .
    field1 like mara-matnr,
    field2......
    etc,
    end of itab.
    data: file1 type string.
    parameter :file like rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    static = 'X'
    mask = space
    field_name = 'FILE'
    CHANGING
    file_name = file.
    START-OF-SELECTION.
    FILE1 = FILE . "HERE I AM PASSING INTO STRING
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = FILE1
    FILETYPE = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
    HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
    file structure is same as the internal table.
    I stored the file as .txt( ie in notepad).
    my file is like this..
    10000 200 323 sunndarrr.......
    i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
    when i am using the ws_upload it is working fine.
    please guide me where i have done the mistake.
    thank you so much for all the replies.

    Hi,
    Have a look on the following code.
    TABLES: kna1.
    DATA: BEGIN OF itab1 OCCURS 0,
          str(255),
          END OF itab1.
    DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename                = 'D:\ABAP EVE\ffile1.txt'
        filetype                = 'ASC'
      TABLES
        data_tab                = itab1
      EXCEPTIONS
        conversion_error        = 1
        file_open_error         = 2
        file_read_error         = 3
        invalid_type            = 4
        no_batch                = 5
        unknown_error           = 6
        invalid_table_width     = 7
        gui_refuse_filetransfer = 8
        customer_error          = 9
        no_authority            = 10
        OTHERS                  = 11.
    IF sy-subrc <> 0.
      WRITE:/ 'sorry'.
    ELSE.
      LOOP AT itab1.
        SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
        APPEND itab2.
      ENDLOOP.
      IF sy-subrc = 0.
        LOOP AT itab2.
          WRITE:/ itab2-kunnr,itab2-name1.
          INSERT INTO kna1 VALUES itab2.
        ENDLOOP.
        IF sy-subrc = 0.
          WRITE:/ 'inserted'.
        ELSE.
          WRITE:/ 'not inserted'.
        ENDIF.
      ELSE.
        WRITE:/ 'fail'.
      ENDIF.
    ENDIF.
    Flat file:
    10001,Sadney
    10003,Yogesh
    20005,Madan
    1.U need to define internal table with one field of max size
    2.upload the flat file data into that internal table
    3.split that internal table data into another internal table(having fields)
    <REMOVED BY MODERATOR>
    thanks,
    Chandu
    Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM

  • Internal table problem for BDC

    Hai i am having flatfile like this format
    H   text1   1000   plant_name   10 short_text   X     X
                                                     20 short_text   X     X
                                                     30 short_text   X     X
    H   text1   1000   plant_name   10 short_text   X     X
                                                     20 short_text   X     X
                                                     30 short_text   X     X
    now this H indicates new record. In each new record number of line items are there.
    How to proceed using internal tables. please help me.

    hi,
    arrange your flat file like this...
    H    text1 1000  plant_name  10  short_text X X
    H    text1 1000  plant_name  20 short_text  X X
    H    text1 1000  plant_name  30 short_text  X X
    H1  text1 1000  plant_name  10 short_text  X X
    H1  text1 1000  plant_name  20 short_text  X X
    H1  text1 1000  plant_name  30 short_text  X X
    now make an internal table having all the fields present in your flat file
    and loop at that internal table and on change of field H call your function module and pass the value for record H......
    similarly it will work for H1.....H2.....
    for eg...
    LOOP AT "Your internal table" INTO "Work area of your internal table".
        AT END OF "field name for H".
          CALL FUNCTION ''Your function module"

  • Importing internal table data from FM to eCATT test script

    Hi all,
    I am working on Workflow project where by i need to post invoices related to purchase orders sent as scanned imaages. Incase all the data in the incoming invoice(scanned) is correct then i am using BAPI_INCOMING_INVOICE_CREATE to post the invoice.
    But when the data is wrong, i need to give the user MIRO transaction pre-populated with the invoice details so that he manually corrects them(after verification) and posts the invoice.
    I understand MIRO is an ENJOY transaction hence BDC doesn't work properly(i have tried with all kinds of options on recording and the problem comes incase of multiple POs) hence i choose to use eCATT.
    The recording worksfine but my real problem is the PO data (multiple PO details for same invoice) is in table form. In all my previous objects related to eCATT we used to upload the file, hence no problem of importing tables.
    But now as i'll call this test script from a function module which has all the POs in the form of internal table, i need to import this into my test script.
    Please any body tell me how to proceed in this case or please suggest me a better a way to record the MIRO.
    Thank you,
    Lakshmi Narayana.S

    Hello Raj,
    First of all thank you for your inputs.
    Yes, I know about Parking an invoice. even i am using it in some scenarios.
    If everything on the invoice matches with the values in SAP then i am posting it using BAPI invoice_create also.
    But for some scenarios like if the PO on the invoice doesnot match with actual PO then i need to create a work item in the Accounts Payable user's inbox and he will change invoice data manually (after getting confirmation and correction) and post it using MIRO.
    Here i need to pre-populate the MIRO with the invoice data so that he can correct and post it.
    Hence i was trying to write a BDC and as MIRO is an Enjoy transaction i thought writing a BDC is not a good idea (i tried writing BDC but had problems) hence i am using eCATT.
    Hope i am clear about my problem. Any inputs to solve this are welcome.
    Thanks,
    Lakshmi Narayana.S

  • FM to get Data from Sheet of an excel file to Internal table??

    Hello Champs!!!
    I have a problem in Excel File's Data Getting.
    There are diffrent Sheets in a single Excel file. I need data of a perticular sheet into an internal Table.
    Like there are 2 Sheets in an Excel file EXCEL1, Sheet1 & Sheet2. Both Sheet have diffrent Data in it.
    Now i only need Data of Sheet1 of this Excel FIle Excel1.
    How can i get it?
    Can you please help me in this?
    Thanks in Advance!!!!
    Girija Shankar

    Welcome to SCN
    Please search before you post next time:BDC, upload data from multi excel sheets

  • Upload vendor master data from legacy system to internal table tcode xk01

    through batch input program how to upload vendor master data from legacy system to internal table and then to SAP R/3 database(transaction XK01) by using recording method.

    By learning the basics of BDC recording and the use of GUI_UPLOAD

  • How to delete a field from a Dynamically created internal table

    Hi friends,
    I have got a requirement in which, I will be entering the table name and Excel file from seletion-screen.
    based on the Table I have entered in the selection-screen I need to create a dynamic internal table so that I can fill that Execel data into that internal table and later i using BDC i can I can fill the database table using SM30 transaction.
    here. my problem is that, When I am creating internal table dynamically, MANDT filed is also getting created in the internal table.
    please, help in deleteing the filed MANDT from the internal able.
    following is the code which creates the dynamic internal table.
    CREATE DATA dy_table TYPE TABLE OF (p_tabname).
    assign dy_table->* to <dyn_table>.
    please provide, if any sample code is available.
    Regards,
    Xavier.P

    Hi,
    You can use this logic,
    While creating the Dynamic filed catalog try to avoid MANDT field.
    Ex:
    *Dynamic creation of a structure
      CREATE DATA LP_STRUCT TYPE (V_TABLE).
      ASSIGN LP_STRUCT->* TO <FS>.
    *Fields Structure
      OF_SDESCR ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <FS> ).
    LOOP AT OF_SDESCR->COMPONENTS ASSIGNING <COMPONENTS>.
    *Field MANDT not displayed
        IF SY-TABIX = 1 AND <COMPONENTS>-NAME = 'MANDT'.
          CONTINUE. " Next loop
        ENDIF.
    *Build Fieldcatalog
        LS_LVC_CAT-FIELDNAME = <COMPONENTS>-NAME.
        LS_LVC_CAT-REF_TABLE = V_TABLE.
        APPEND LS_LVC_CAT TO LT_LVC_CAT.
        CLEAR LS_LVC_CAT.
      ENDLOOP.

  • Error in uploading excel sheet data into internal table

    Dear all,
    i am facing problem when uploading data from excel. i used KD_GET_FILENAME_ON_F4.i select the file and pass on to ALSM_EXCEL_INTO_INTERNAL_TABLE.and i get the ERROR....
      Illegal type when transferring an internal table to a FORM. this is my code .
    types : begin of ty_mm01,
            matnr like rmmg1-matnr,
            mbrsh like rmmg1-mbrsh,
            mtart like rmmg1-mtart,
            maktx like makt-maktx,
            meins like mara-meins,
            matkl like mara-matkl,
            bismt like mara-bismt,
            spart like mara-spart,
            mtpos like mara-mtpos_mara,
            end of ty_mm01.
    data :  tt_mm01 type standard table of ty_mm01,
            wa_mm01 like TT_MM01.
    data : t_bdcdata like standard table of bdcdata,
           t_bdcmsgcoll like standard table of bdcmsgcoll.
    constants:  begcol TYPE i value 1 ,
                begrow TYPE i value 1,
                endcol TYPE i value 100,
                endrow TYPE i value 32000.
    selection-screen : begin of block bdc with frame.
    parameter : tfile like rlgrap-filename obligatory.
    selection-screen : end of block bdc.
    at selection-screen on value-request for tfile.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = 'ZMM_MAT_MAS_BASIC_DATA'
       DYNPRO_NUMBER       = '1000'
       FIELD_NAME          = 'TFILE'
       STATIC              = 'X'
      MASK                = ',*.xls,'
      CHANGING
        FILE_NAME           = tfile
    start-of-selection.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = tfile
        I_BEGIN_COL                   = begcol
        I_BEGIN_ROW                   = begrow
        I_END_COL                     = endcol
        I_END_ROW                     = endrow
      TABLES
        INTERN                        = tt_mm01
    EXCEPTIONS
      INCONSISTENT_PARAMETERS       = 1
      UPLOAD_OLE                    = 2
      OTHERS                        = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks in advance

    Hi,
    Check these FM : KCD_EXCEL_OLE_TO_INT_CONVERT
    Report ZPSP_TEST.
    data: bdc_DATA like bdcdata occurs 0 with header line,
    mess_tab like bdcmsgcoll occurs 0 with header line.
    DATA: BEGIN OF ITAB OCCURS 0 ,
    tcnt TYPE i, "Table Counter &H0D
    WERKS LIKE T001W-WERKS,
    BNFPO LIKE EBAN-BNFPO,
    MATNR LIKE MARA-MATNR,
    MENGE LIKE EBAN-MENGE,
    END OF ITAB.
    start-of-selection.
    PERFORM upload_data.
    loop at itab.
    perform bdc_dynpro using 'SAPMM06B' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-BSART'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-BSART'
    'NB'.
    perform bdc_field using 'RM06B-LPEIN'
    'T'.
    perform bdc_field using 'EBAN-WERKS'
    ITAB-WERKS.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06B-EKGRP'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RM06B-BNFPO'
    ITAB-BNFPO.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-MATNR(01)'
    ITAB-MATNR.
    perform bdc_field using 'EBAN-MENGE(01)'
    ITAB-MENGE.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'RM06B-EEIND'
    record-EEIND_010.
    *perform bdc_field using 'RM06B-LPEIN'
    record-LPEIN_011.
    *perform bdc_field using 'EBAN-EKGRP'
    record-EKGRP_012.
    *perform bdc_field using 'EBAN-BADAT'
    record-BADAT_013.
    *perform bdc_field using 'EBAN-FRGDT'
    record-FRGDT_014.
    *perform bdc_field using 'EBAN-PREIS'
    record-PREIS_015.
    *perform bdc_field using 'EBAN-WAERS'
    record-WAERS_016.
    *perform bdc_field using 'EBAN-PEINH'
    record-PEINH_017.
    *perform bdc_field using 'EBAN-REPOS'
    record-REPOS_018.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE(02)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'RM06B-BNFPO'
    record-BNFPO_019.
    *perform bdc_field using 'EBAN-MATNR(02)'
    record-MATNR_02_020.
    *perform bdc_field using 'EBAN-MENGE(02)'
    record-MENGE_02_021.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EBAN-MENGE'
    ITAB-MENGE_023.
    *perform bdc_field using 'RM06B-EEIND'
    record-EEIND_024.
    *perform bdc_field using 'RM06B-LPEIN'
    record-LPEIN_025.
    *perform bdc_field using 'EBAN-EKGRP'
    record-EKGRP_026.
    *perform bdc_field using 'EBAN-BADAT'
    record-BADAT_027.
    *perform bdc_field using 'EBAN-FRGDT'
    record-FRGDT_028.
    *perform bdc_field using 'EBAN-PREIS'
    record-PREIS_029.
    *perform bdc_field using 'EBAN-WAERS'
    record-WAERS_030.
    *perform bdc_field using 'EBAN-PEINH'
    record-PEINH_031.
    *perform bdc_field using 'EBAN-REPOS'
    record-REPOS_032.
    perform bdc_field using 'EBAN-TXZ01'
    'BEARING 2"X2"'.
    perform bdc_field using 'EBAN-MENGE'
    '65'.
    perform bdc_field using 'RM06B-EEIND'
    '2005/01/03'.
    perform bdc_field using 'RM06B-LPEIN'
    'D'.
    perform bdc_field using 'EBAN-EKGRP'
    'M11'.
    perform bdc_field using 'EBAN-BADAT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-FRGDT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-PREIS'
    ' 1,120.00'.
    perform bdc_field using 'EBAN-WAERS'
    'EUR'.
    perform bdc_field using 'EBAN-PEINH'
    '1'.
    perform bdc_field using 'EBAN-REPOS'
    'X'.
    perform bdc_dynpro using 'SAPMM06B' '0102'.
    perform bdc_field using 'BDC_CURSOR'
    'EBAN-MENGE'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EBAN-TXZ01'
    'DRILLING PIPE 10"'.
    perform bdc_field using 'EBAN-MENGE'
    '75'.
    perform bdc_field using 'RM06B-EEIND'
    '2005/01/03'.
    perform bdc_field using 'RM06B-LPEIN'
    'D'.
    perform bdc_field using 'EBAN-EKGRP'
    'M11'.
    perform bdc_field using 'EBAN-BADAT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-FRGDT'
    '2005/01/03'.
    perform bdc_field using 'EBAN-PREIS'
    ' 0.53'.
    perform bdc_field using 'EBAN-WAERS'
    'EUR'.
    perform bdc_field using 'EBAN-PEINH'
    '1'.
    perform bdc_field using 'EBAN-REPOS'
    'X'.
    perform bdc_dynpro using 'SAPMM06B' '0106'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06B-BNFPO'
    perform bdc_field using 'BDC_OKCODE'
    '&H3DBU'.
    *perform bdc_field using 'RM06B-BNFPO'
    CALL TRANSACTION 'ME51' USING BDC_DATA MODE 'A'.
    endLOOP.
    FORM upload_data.
    *local variable declaration
    DATA : lv_index TYPE i,
    l_count TYPE i.
    *local constants declaration
    CONSTANTS:
    lc_start_col TYPE i VALUE '1' ,
    lc_start_row TYPE i VALUE '2' ,
    lc_end_col TYPE i VALUE '256' ,
    lc_end_row TYPE i VALUE '65536'.
    *local field symbol declaration
    FIELD-SYMBOLS : <lf_s>.
    *loacal internal table declaration
    DATA : li_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.
    *refresh internal table for each loop
    CLEAR: li_intern,
    l_count .
    REFRESH li_intern.
    to upload the data in excel on the presentation server this function
    module converts the data from excel file into an internal table
    containing row no col no and value
    CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
    EXPORTING
    filename &H3D 'Give file location here'
    i_begin_col &H3D lc_start_col
    i_begin_row &H3D lc_start_row
    i_end_col &H3D lc_end_col
    i_end_row &H3D lc_end_row
    TABLES
    intern &H3D li_intern
    EXCEPTIONS
    inconsistent_parameters &H3D 1
    upload_ole &H3D 2.
    checking for data in internal table
    CHECK NOT li_intern[] IS INITIAL.
    sorting internal table
    SORT li_intern BY row col.
    collecting data into an internal table
    LOOP AT li_intern.
    MOVE: li_intern-col TO lv_index.
    lv_index &H3D lv_index + 1.
    ASSIGN COMPONENT lv_index OF STRUCTURE itab TO <lf_s>.
    MOVE : li_intern-value TO <lf_s>.
    AT END OF row.
    l_count &H3D l_count + 1.
    itab &H3D l_count.
    APPEND itab.
    ENDAT. " at end of row
    ENDLOOP. " loop at li_intern
    Reg,
    Siva
    Edited by: Siva Prasad on Jun 1, 2009 8:41 AM
    Edited by: Siva Prasad on Jun 1, 2009 4:25 PM

  • Store the vital info from the absence quota record in an internal table

    Hi experts,
    I want to detrmine if the Absence record’s (PA2001 rec) deduction from date (PA2001-BEGDA) and absence to date (PA2001-ENDDA) are permissible for the validity period of the Absence Quota record (the PA2006 rec).  If the quota’s deduction from date, PA2006-DESTA, is greater than the PA2001-BEGDA, we then need to identify this absence quota record for change and change the deduction from date, PA2006-DESTA, to be the same as PA2001-BEGDA.  Store the vital info from the absence quota record in an internal table and record the new date that the deduction from date that needs to be changed to.  The changes will be made via a BDC session.
    Please help me out...
    Thanks,
    Vicky

    This looks possible if we code it in 'dynamic action' table, but the BDC may not read it during run time.
    Do you still have this issue?
    Thanks
    Narasimha

  • Best way to read a CSV file into an internal table

    Hi,
    I have a comma seprated file, which I need to read into an internal table, and be able to look at particular values - basically looping round and populating BDC fields. Whats the easiest way of doing this?

    The easiest way would be to define a flat interal table.
    Data: begin of itab occurs 0,
          rec(1000) type c,
          end of itab.
    Then call the function module GUI_UPLOAD to get the data into your internal table from the file on the frontend. I assume that you know how to use this function module.  You could also use the method GUI_UPLOAD of the class CL_GUI_FRONTEND_SERVICES.
    For example,  say you have a comman delimited file with materail number, plant, quantity in it.
    4000001,0004,1.00
    4000002,0006,2.00
    Define another internal table to hold the data.
    Data: begin of itab2 occurs 0,
          matnr type mara-matnr
          werks type marc-werks
          quant(10) type c.
          end of itab2.
    Then loop at the internal table(ITAB) and use the split statement to split it up into the appropriate fields of the other interal table(ITAB2). 
    Loop at itab.
    clear itab2.
    split itab-rec at ',' into itab2-matnr
                               itab2-werks
                               itab2-quant.
    append itab2.
    endloop.
    That's it.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman

  • Internal Table - logic for Chunk

    Hi,
    I have an internal table with n records.
    I want to use at a time say max of 20 records .
    This is calling a BDC.
    i.e.
    loop at n record.
    take 20 records.
    call BDC.
    then next set of recrds.
    repeat process till all records processed.
    Thanks in Advance.
    Amit

    Hi,
    try this way.
    data: count type i.
    loop at table
      if count LE 20.
        add 1 to count.
      else.
        clear count.
        call bdc.
        "refresh all the concerned tables and variables for the next 20 records.
      endif.
    endloop.
    Or.
    loop ...
    WHILE count le 20.  
       ADD 1 TO count.
    ENDWHILE.                   
        clear count.
        call bdc.
        "refresh all the concerned tables and variables for the next 20 records.
    endloop
    Regards.
    Marcelo Ramos

  • Table Control BDC to CHANGE the contents problem

    Hi,
    I am having a problem in BDC. The screen is having a table control and I want to change the contents depending on certain conditions.
    This BDC is not to upload the data but to change already existing data.
    How can I dynamically know the contents of the screen or contents or the row so that I can select the correct row to be changed?

    Hi,
    No its not like that.
    Suppose I want to update/change sheduling agreements <b>not upload</b>
    I will be calling the transaction which will list the scheduling lines in a table control. The order of the lines in table control will be as per logic of SAP's Application program.
    Now when I read the file and how will I dynamically know the exact line which should get selected.
    Say my internal table is having the data to be changed but I can not determine the exact ordering of the records as per table control.
    Hence I am facing the problem to know the exact ordering of table control
    Let me give another example. Using ME12 transaction I am supposed to delete certain rows from info records say having condition '15EC'.
    Now when I call a transction how will I know that for a particular vendor which line will contain this condition value so that can select the line and press delete
    Regards,
    Nitin

  • Table control bdc for mb1a

    Hi All,
    Can anyone tell me is table control BDC possible for MB1A tcode
    Thanks in advance.

    well there may be 2 cases,
    1. if ur batch manahement is active and the batch is determined internally,in that case it is not possible.
    2.However if ur batch management is not active,then a bdc can be written.
    But i would suggest u use an LSMW and record using the BAPI method,SAP provides good standard BAPI's.

  • Passing '**********' to screen field value instead of internal table value

    Hi All,
    I have written BDC, in which when i pass value for second screen "Description type field"  it's passing '*************************' instead of internal table value.
    It's picking correct value for first internal table value. Could anyone please give an idea why it's happening?
    Please find the code:
    LOOP AT it_record.
    header data for BDC
       AT NEW CLASS.
        IF sy-tabix <> 1.
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                    '=SAVE'.
            CALL TRANSACTION 'CLWM' USING bdcdata
                          MODE p_mode
                          UPDATE 'S'
                          MESSAGES INTO messtab.
            clear : bdcdata[],bdcdata.
        ENDIF.
        perform bdc_dynpro      using 'SAPLCLMO' '0200'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-CLASS'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'RMCLM-CLASS'
                                      it_record-class.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        perform bdc_dynpro      using 'SAPLCLMO' '7777'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '=MERK'.
        perform bdc_field       using 'BDC_CURSOR'
                                      'RMCLM-KLBEZ'.
        perform bdc_field       using 'RMCLM-KLBEZ'
                                      it_record-klbez.
        perform bdc_field       using 'RMCLM-STATU'
                                      '1'.
        MOVE 1 TO IDX.
        ENDAT.
    line item data for BDC
            perform bdc_dynpro      using 'SAPLCLMO' '7777'.
            perform bdc_field       using 'BDC_OKCODE'
                                       '/00'.
            perform bdc_field       using 'BDC_CURSOR'
                                        'RMCLM-RELEV(02)'.
            CONCATENATE 'RMCLM-MERKMA(' IDX ')' INTO FNAM.
            perform bdc_field       using FNAM
                                        it_record-merkma.
            CONCATENATE 'RMCLM-RELEV(' IDX ')' INTO FNAM.
            perform bdc_field       using   FNAM
                                       it_record-relev.
            IDX = IDX + 1.
      ENDLOOP.
    Thanks,
    Ujjwal

    Hi Ujjwal
    The reason behind this is that you are using AT NEW.... ENDAT block in your coding.
    When you use AT NEW field statements, the fields in the work area after the field get converted into ********.
    Check values in your work area I_RECORD in debugging inside AT NEW statement and you will understand what I am saying.
    In your case all the fields from header line of I_RECORDS which come after field CLASS are getting converted into *******,
    hence the error.
    Try using a temporary work area, say w_record. Pass value of I_record to w_record before AT NEW statement.
    And use w_record-fields instead of I_record-fields. And your program should work.

Maybe you are looking for

  • Key fields in tables ce31000 and ce41000

    In transaction KE11 ( change sales and profit plan ), tables CE31000 and CE41000 are used. I have to read those tables in a report but I cannot find the relevant keys to find unique records.  There are some fields I know, but using those fields I get

  • Questions on events in a multi-class GUI

    I have a GUI application that is constructed as follows: 1. Main Class - Actually creates the JFrame, contains main method, etc. 2. MenuBar Class - Constructor creates a new JMenuBar structure and populates it with various JMenus and JMenuItems. A ne

  • XML Parsing issue with same tag names at multiple levels.

    My XML has the same tag name , ID at different levels in the XML. <InventorySearch> <*ID*>ID1</*ID*> <interactionDate>2012-09-01T10:30:00Z</interactionDate> <DescribedBy> <value>Cycle Count extract</value> <Characteristic> <*ID*>ID2</*ID*> </Characte

  • Install Apps On Second iPhone

    Is it possible to install apps that are on my iPhone4 onto my wifes iPhone4s  ?

  • My hp 1050 unable to print

    my hp 1050 unable to print and after closing the catridge tray it is indicating or blinking light .,tell me some steps