Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BDC upload from excel to tranction IL01

hi friends

can anyone give BDCcode for the below discreption plz.

1.The data is provided of an Excel table. Missing field values will be filled with default values.

2.The data should be automatically checked before the upload starts.

3.About 5000 objects will be uploaded.

4.Registration language in the SAP is DE (Customizing and master data partly maintained in language key "DE").

<u>DRAFT FLOW CHART</u>

Start

convert Excell into a data file

test run

if yes if no

Add Data Add Data

check Data Maintain SAP data

Print protocol

END

Tags:
Former Member
Former Member replied

The following code was developed for IL08, but it should work for IL01. Anyway, it'll start you off:

*&---------------------------------------------------------------------*
*&      Form  FILL_BDC
*&---------------------------------------------------------------------*
form fill_bdc.

  clear bdcdata.
  refresh bdcdata.

  if r_create = 'X'.
* Initial screen
    perform dynpro using:
     'X' 'SAPMILO0'           '1110',  "Create Func loc:Initial screen
     ' ' 'IFLO-TPLNR'          file_int-tplnr,
     ' ' 'RILO0-TPLKZ'         file_int-tplkz,
     ' ' 'IFLO-FLTYP'          file_int-fltyp,
     ' ' 'RILO0-TPLCP'        ' ',
     ' ' 'IRLO-TRPNR'         ' ',
     ' ' 'RILO0-TPLMA_DFLT'    file_int-tplma,
     ' ' 'BDC_OKCODE'         '/06'.   "Location
  else.
    perform dynpro using:
     'X' 'SAPMILO0'           '1110',  "Change Func loc:Initial screen
     ' ' 'IFLO-TPLNR'          file_int-tplnr,
     ' ' 'RILO0-TPLKZ'         file_int-tplkz,
     ' ' 'BDC_OKCODE'         '/06'.   "Location
  endif.

* Location data
  perform dynpro using:
   'X' 'SAPMILO0'           '2120',    "Create Func loc:Location data
   ' ' 'IFLO-PLTXT'          file_int-pltxt,
   ' ' 'ILOA-SWERK'          file_int-swerk,
   ' ' 'ILOA-STORT'         ' ',
   ' ' 'ILOA-MSGRP'         ' ',
   ' ' 'ILOA-BEBER'         ' ',
   ' ' 'RILA0-ARBPL'         file_int-arbpl,
   ' ' 'ILOA-ABCKZ'         ' ',
   ' ' 'ILOA-EQFNR'         ' ',
   ' ' 'ILOA-VKORG'          file_int-vkorg,
   ' ' 'ILOA-VTWEG'          file_int-vtweg,
   ' ' 'ILOA-SPART'          file_int-spart,
   ' ' 'ILOA-ANLNR'         ' ',
   ' ' 'ILOA-ANLUN'         ' ',
   ' ' 'ILOA-GSBER'          file_int-gsber,
   ' ' 'ILOA-KOSTL'          file_int-kostl,
   ' ' 'ILOA-PROID'         ' ',
   ' ' 'ILOA-DAUFN'         ' ',
   ' ' 'ILOA-AUFNR'         ' ',
   ' ' 'BDC_CURSOR'         'ILOA-SWERK',"Cursor on maintenance plant
*  ' ' 'BDC_OKCODE'         '/07'.     "PM data
   ' ' 'BDC_OKCODE'         '/16'.     "Data origin

* Data origin (maintenance plant)
  if file_int-swerki = '1'.
    perform dynpro using:
     'X' 'SAPMILO0'         '6033',    "Data Origin:Change
     ' ' 'RILO0-INHER_MA'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  else.
    perform dynpro using:
     'X' 'SAPMILO0'         '6033',    "Data Origin:Change
     ' ' 'RILO0-INHER_NO'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  endif.

* Location data
  perform dynpro using:
   'X' 'SAPMILO0'           '2120',    "Create Func loc:Location data
   ' ' 'BDC_CURSOR'         'ILOA-BUKRS',"Cursor on company code
   ' ' 'BDC_OKCODE'         '/16'.     "Data origin

* Data origin (company code)
  if file_int-bukrsi = '1'.
    perform dynpro using:
     'X' 'SAPMILO0'         '6042',    "Data Origin:Change
     ' ' 'RILO0-INHER_MA'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  else.
    perform dynpro using:
     'X' 'SAPMILO0'         '6042',    "Data Origin:Change
     ' ' 'RILO0-INHER_NO'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  endif.

* Location data
  perform dynpro using:
   'X' 'SAPMILO0'           '2120',    "Create Func loc:Location data
   ' ' 'BDC_CURSOR'         'ILOA-GSBER',"Cursor on business area
   ' ' 'BDC_OKCODE'         '/16'.     "Data origin

* Data origin (business area)
  if file_int-bukrsi = '1'.
    perform dynpro using:
     'X' 'SAPMILO0'         '6038',    "Data Origin:Change
     ' ' 'RILO0-INHER_MA'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  else.
    perform dynpro using:
     'X' 'SAPMILO0'         '6038',    "Data Origin:Change
     ' ' 'RILO0-INHER_NO'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  endif.

* Location data
  perform dynpro using:
   'X' 'SAPMILO0'           '2120',    "Create Func loc:Location data
   ' ' 'BDC_CURSOR'         'ILOA-VKORG',"Cursor on sales organization
   ' ' 'BDC_OKCODE'         '/16'.     "Data origin

* Data origin (business area)
  if file_int-bukrsi = '1'.
    perform dynpro using:
     'X' 'SAPMILO0'         '6047',    "Data Origin:Change
     ' ' 'RILO0-INHER_MA'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  else.
    perform dynpro using:
     'X' 'SAPMILO0'         '6047',    "Data Origin:Change
     ' ' 'RILO0-INHER_NO'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  endif.

* Location data
  perform dynpro using:
   'X' 'SAPMILO0'           '2120',    "Create Func loc:Location data
   ' ' 'BDC_OKCODE'         '/07'.     "PM data

* PM data
  perform dynpro using:
   'X' 'SAPMILO0'         '2130',      "Create Func loc:PM data
   ' ' 'IFLO-POSNR'       ' ',
   ' ' 'RILO0-SUBMT'      ' ',
   ' ' 'RILO0-IWERK'       file_int-iwerk,
   ' ' 'RILO0-INGRP'       file_int-ingrp,
   ' ' 'RILO0-GEWRK'       file_int-gewrk,
   ' ' 'RILO0-WERGW'       file_int-wergw,
   ' ' 'RILO0-RBNR'       ' ',
   ' ' 'RILO0-BEGRU'      ' ',
   ' ' 'IFLO-DATAB'       ' ',
   ' ' 'BDC_CURSOR'       'RILO0-GEWRK',    "Cursor on main wrk centre
   ' ' 'BDC_OKCODE'       '/16'.       "Data origin

* DATA ORIGIN
  if file_int-ppsidi = '1'.
    perform dynpro using:
     'X' 'SAPMILO0'         '6006',    "Data Origin:Change
     ' ' 'RILO0-INHER_MA'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  else.
    perform dynpro using:
     'X' 'SAPMILO0'         '6006',    "Data Origin:Change
     ' ' 'RILO0-INHER_NO'   'X',
     ' ' 'BDC_OKCODE'       '/07'.     "Continue
  endif.

* Back to PM data - save or check
  if p_test = 'X'.
    perform dynpro using:
     'X' 'SAPMILO0'           '2130',  "Create Func loc:Location data
     ' ' 'BDC_OKCODE'         '/03'.   "Back

    perform dynpro using:              "Popup
     'X' 'SAPLSPO1'         '0100',
     ' ' 'BDC_CURSOR'       'SPOP-OPTION2'."Choose no
  else.
    perform dynpro using:
     'X' 'SAPMILO0'           '2130',  "Create Func loc:Location data
     ' ' 'BDC_OKCODE'         '/11'.   "Save
  endif.

endform.                               " FILL_BDC

Rob

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question