2006 Nov 01 4:42 AM
Hi friends,
Can anybody send sample BDC program for MM01 with DATA/FLAT file .(For many views MM01).
Kindly send with data file.
Kindly send with data file.
Kindly send with data file.
Thanks in advance
abaper
2006 Nov 01 6:17 AM
Hi,
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.txt'
FILETYPE = 'ASC'
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
when your selecting views
this particular material will belongs to Po/Sales or some other areas .
when you select basic 1 --it gives description
select basic 2 -- it gives tax ,amount, base unit of measurement
Hope this helps.
Regds,
Seema.
2006 Nov 01 4:45 AM
2006 Nov 01 5:43 AM
Hi
As you have received reply for this thread, kindly continue with this thread and close the other threads with the same topic as it can cause confusion and less replies. Please try not to open duplicate threads for the same topic. Request your help on the same.
Kind Regards
Eswar
2006 Nov 01 6:17 AM
Hi,
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.txt'
FILETYPE = 'ASC'
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
when your selecting views
this particular material will belongs to Po/Sales or some other areas .
when you select basic 1 --it gives description
select basic 2 -- it gives tax ,amount, base unit of measurement
Hope this helps.
Regds,
Seema.