Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

uploading excel sheet

Former Member
0 Likes
916

data is not uploaded. what is missing?


Report ZM  no standard page heading line-size 255.

DATA: BEGIN OF itab OCCURS 0,
      matnr(18) TYPE C,
      mbrsh(1) TYPE C,
      mtart(4) TYPE C,
      werks(4) TYPE C,
      lgort(4) TYPE C,
      maktx(40) TYPE C,
      meins(3) type c,
      matkl(9) type c,
      ekgrp(3) TYPE C,
      bklas(4) TYPE C,
      vprsv(1) TYPE C,
      peinh(6) TYPE C,
      verpr(5) TYPE C,
    END OF itab.
DATA : L_INTERN TYPE KCDE_CELLS OCCURS 0 WITH HEADER LINE.
DATA : L_INDEX TYPE I.
DATA : L_START_COL TYPE I VALUE '1',
L_START_ROW TYPE I VALUE '1',
L_END_COL TYPE I VALUE '13',
L_END_ROW TYPE I VALUE '48'.
DATA: I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

DATA: NODATA TYPE C VALUE ' '.
FIELD-SYMBOLS : <FS>.

start-of-selection.

  CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
    EXPORTING
      FILENAME                      = 'D:\bdc.XLS'
      I_BEGIN_COL                   = L_START_COL
      I_BEGIN_ROW                   = L_START_ROW
      I_END_COL                     = L_END_COL
      I_END_ROW                     = L_END_ROW
    TABLES
      INTERN                        = L_INTERN
* EXCEPTIONS
*   INCONSISTENT_PARAMETERS       = 1
*   UPLOAD_OLE                    = 2
*   OTHERS                        = 3
            .
  IF SY-SUBRC ne  0.
  ENDIF.

  SORT L_INTERN BY ROW COL.
  LOOP AT L_INTERN.
    MOVE L_INTERN-COL TO L_INDEX.
    ASSIGN COMPONENT L_INDEX OF STRUCTURE ITAB TO <FS>.
    MOVE L_INTERN-VALUE TO <FS>.
    AT END OF ROW.
      APPEND ITAB.
      CLEAR ITAB.
    ENDAT.
  ENDLOOP.

loop at itab.

perform bdc_dynpro      using 'SAPLMGMM' '0060'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-MTART'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RMMG1-MATNR'
                              itab-MATNR.
perform bdc_field       using 'RMMG1-MBRSH'
                             itab-MBRSH.
perform bdc_field       using 'RMMG1-MTART'
                              itab-MTART.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(17)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(01)'
                              'X'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(09)'
                              'X'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(17)'
                              'X'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_dynpro      using 'SAPLMGMM' '0070'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSICHTAUSW-DYTXT(17)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'MSICHTAUSW-KZSEL(17)'
                              'X'.

Part2 is in Second post.

Note: Please don't Post sample codes which is more than 5000 Chars

Formatted by: Vijay Babu Dudla on Apr 25, 2009 5:26 AM

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
895

[Upload Excel document into internal table|https://wiki.sdn.sap.com/wiki/x/BYBMB]

7 REPLIES 7
Read only

Former Member
0 Likes
895

Hi,

Please check the errors after

CALL TRANSACTION 'MM01' 

Also please add code in readable format, so that somebody analyze.

Regards

Shital

Read only

Former Member
0 Likes
895

here is the second part

perform bdc_dynpro      using 'SAPLMGMM' '0080'.
perform bdc_field       using 'BDC_CURSOR'
                              'RMMG1-LGORT'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTR'.
perform bdc_field       using 'RMMG1-WERKS'
                              ITAB-WERKS.
perform bdc_field       using 'RMMG1-LGORT'
                              ITAB-LGORT.
perform bdc_dynpro      using 'SAPLMGMM' '4004'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MAKT-MAKTX'
                              ITAB-MAKTX.
perform bdc_field       using 'BDC_CURSOR'
                              'MARA-MATKL'.
perform bdc_field       using 'MARA-MEINS'
                              ITAB-MEINS.
perform bdc_field       using 'MARA-MATKL'
                              ITAB-MATKL.
perform bdc_dynpro      using 'SAPLMGMM' '4000'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MAKT-MAKTX'
                              ITAB-MAKTX.
perform bdc_field       using 'BDC_CURSOR'
                              'MARC-EKGRP'.
perform bdc_field       using 'MARA-MEINS'
                              ITAB-MEINS.
perform bdc_field       using 'MARC-EKGRP'
                              ITAB-EKGRP.
perform bdc_field       using 'MARA-MATKL'
                              ITAB-MATKL.
perform bdc_dynpro      using 'SAPLMGMM' '4000'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BDC_CURSOR'
                              'MAKT-MAKTX'.
perform bdc_field       using 'MAKT-MAKTX'
                              ITAB-MAKTX.
perform bdc_field       using 'MARA-MEINS'
                              ITAB-MEINS.
perform bdc_dynpro      using 'SAPLMGMM' '4000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
perform bdc_field       using 'MAKT-MAKTX'
                              ITAB-MAKTX.
perform bdc_field       using 'MARA-MEINS'
                              ITAB-MEINS.
perform bdc_field       using 'BDC_CURSOR'
                              'MBEW-VERPR'.
perform bdc_field       using 'MBEW-BKLAS'
                              ITAB-BKLAS.
perform bdc_field       using 'MBEW-VPRSV'
                              ITAB-VPRSV.
perform bdc_field       using 'MBEW-PEINH'
                             ITAB-PEINH.
perform bdc_field       using 'MBEW-VERPR'
                              ITAB-VERPR.

   CALL TRANSACTION 'MM01' USING I_BDCDATA   UPDATE 'A' MODE 'N'.

    REFRESH I_BDCDATA.
    CLEAR I_BDCDATA.

  ENDLOOP.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR I_BDCDATA.
  I_BDCDATA-PROGRAM  = PROGRAM.
  I_BDCDATA-DYNPRO   = DYNPRO.
  I_BDCDATA-DYNBEGIN = 'X'.
  APPEND I_BDCDATA.
ENDFORM.                    "BDC_DYNPRO

FORM BDC_FIELD USING FNAM FVAL.
  IF FVAL <> NODATA.
    CLEAR I_BDCDATA.
    I_BDCDATA-FNAM = FNAM.
    I_BDCDATA-FVAL = FVAL.
    APPEND I_BDCDATA.
  ENDIF.
ENDFORM.                    "BDC_FIELD

Read only

0 Likes
895

thanks for your suggestion.

where did i commit a mistake in my coding ,i could nt upload the data.

thanks&regs

deepika.

Read only

0 Likes
895

Debug the code and check the contents of itab . Please check if the excel contents are populated correctly into the internal table itab. Now you are sure the problem is with the BDC recording.

What kind of error you are getting ?

Please create a new recording and modify the code if the itab contents are fine.

All the best

Regards

Vivek

Read only

former_member156446
Active Contributor
0 Likes
896

[Upload Excel document into internal table|https://wiki.sdn.sap.com/wiki/x/BYBMB]

Read only

0 Likes
895

data is completely uploaded into internal table.

now it is not uploading into data base table .

im getting an error like statement is not accessible.

thanks&regards

deepika.

Read only

0 Likes
895

thank you very much.

atlast problem is solved.

thanks&regards

deepika.