05-11-2006 4:09 PM
05-11-2006 4:16 PM
Hi Soorya,
1. Set the selection screen to read the file name run time.
2. Use GUI_UPLOAD FM to load data from Excel to SAP Internal table.
3. Record the Transaction using SHDB and change the recorded program based on your requirement or use BAPI to upload the data into SAP.
Thats all...
Govind
Message was edited by: Govindarajan Seenivasan
05-11-2006 4:36 PM
hi govind
can u plz give brief coding idea and efficent method
thanks
05-11-2006 5:27 PM
HI soorya,
Create selection screen for all input values
Filaname and location and default values.
1 RILO0-TPLKZ Strukturkennz. S_KZ always use value "LV" Einstieg
2 IFLO-FLTYP Typ Tech. Platz TPL_Typ always use value "L Einstieg
3 ITOB-BEGRU BerechtGruppe Berecht. Gruppe. Value must exist in Tab. T370B . always use value "LV01" Allgemein
4 ITOB-IWERK Planungswerk Werk always use value "LV01" Organisation
Create a internal table to match up with your Excel file. so that the data will be stored without any errors.
Record your transaction using SHDB. Copy the code to use in your program.
Before calling the BDC part of the program check all mandatory fields are there in internal table.
Then Populoate the BDC Table and call the transaction.
If you want a small sample program, Please let me know.
Thanks
Govind
05-12-2006 2:24 PM
05-12-2006 2:27 PM
Hay Soorya
check with this code
include bdcrecx1.
tables : mara.
data : begin of it_mara occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
mtart like mara-mtart,
maktx like makt-maktx,
meins like mara-meins,
end of it_mara.
start-of-selection.
perform upload_data.
perform open_group.
loop at it_mara.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
it_mara-matnr.
perform bdc_field using 'RMMG1-MBRSH'
it_mara-mbrsh.
perform bdc_field using 'RMMG1-MTART'
it_mara-mtart.
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' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
it_mara-maktx.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
it_mara-meins.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_transaction using 'MM01'.
endloop.
perform close_group.
&----
*& Form upload_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM upload_data .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'c:\mat_bdc.xls'
FILETYPE = 'ASC'
DAT_MODE = 'X'
TABLES
DATA_TAB = it_mara.
IF SY-SUBRC = 0.
SORT IT_MARA BY MATNR.
ENDIF.
ENDFORM. " upload_data
flat file structure is
PRANIT_011 CCOUP This is Testing material kg
PRANIT_012 CCOUP This is Testing material kg
PRANIT_013 CCOUP This is Testing material kg
PRANIT_014 CCOUP This is Testing material kg
PRANIT_015 CCOUP This is Testing material kg
Thanks & Regards
Sreenivasulu P