You are on page 1of 6

*&---------------------------------------------------------------------*

*& Report ZVENKAT MATBDC


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT

zvenkat matbdc.

TYPES: BEGIN OF ty_file,


matnr TYPE mara-matnr,
mbrsh TYPE mara-mbrsh,
mtart TYPE mara-mtart,
maktx TYPE makt-maktx,
meins TYPE mara-meins,
matkl TYPE mara-matkl,
spart TYPE mara-spart,
brgew TYPE STRING,
gewei TYPE mara-gewei,
ntgew TYPE STRING,
wrkst TYPE mara-wrkst,
werks TYPE marc-werks,
vkorg TYPE vbak-vkorg,
vtweg TYPE vbak-vtweg,
taxkm TYPE mg03steuer-taxkm,
tragr TYPE mara-tragr,
ladgr TYPE marc-ladgr,
END OF ty_file.
DATA: i_file TYPE TABLE OF ty_file.
DATA: wa_file TYPE ty_file.

DATA : bdcdata LIKE bdcdata


OCCURS 0 WITH HEADER LINE.
DATA : messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA: v_brgew TYPE STRING,
v_ntgew TYPE STRING.
BREAK-POINT.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename
\Desktop\VENMM01.TXT'
filetype
has_field_separator

= 'C:\Documents and Settings\Administrator


= 'ASC'
= 'X'

TABLES
data_tab

= i_file.

SKIP.
BREAK-POINT.
IF sy-subrc <> 0.
SKIP.
ENDIF.
DELETE I_FILE INDEX 1.
BREAK-POINT.
LOOP AT i_file INTO wa_file.

perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field

using 'SAPLMGMM' '0060'.


using 'BDC_CURSOR'
'RMMG1-MTART'.
using 'BDC_OKCODE'
'/00'.
using 'RMMG1-MATNR'
wa_file-matnr.
using 'RMMG1-MBRSH'
wa_file-mbrsh.
using 'RMMG1-MTART'
wa_file-mtart.
using 'SAPLMGMM' '0070'.
using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
using 'BDC_OKCODE'
'=ENTR'.
using 'MSICHTAUSW-KZSEL(01)'
'X'.
using 'SAPLMGMM' '4004'.
using 'BDC_OKCODE'
'=SP02'.
using 'MAKT-MAKTX'
wa_file-maktx.
using 'MARA-MEINS'
wa_file-meins.
using 'MARA-MATKL'
wa_file-matkl.
using 'MARA-SPART'
wa_file-spart.
using 'MARA-MTPOS_MARA'
'NORM'.
using 'BDC_CURSOR'

perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field

'MARA-NTGEW'.
using 'MARA-BRGEW'
wa_file-brgew.
using 'MARA-GEWEI'
wa_file-gewei.
using 'MARA-NTGEW'
wa_file-ntgew.
using 'SAPLMGMM' '4004'.
using 'BDC_OKCODE'
'=SP04'.
using 'MAKT-MAKTX'
'laptop'.
using 'BDC_CURSOR'
'MARA-WRKST'.
using 'MARA-WRKST'
'metal'.
using 'SAPLMGMM' '0081'.
using 'BDC_CURSOR'
'RMMG1-VTWEG'.
using 'BDC_OKCODE'
'=ENTR'.
using 'RMMG1-WERKS'
wa_file-werks.
using 'RMMG1-VKORG'
wa_file-vkorg.
using 'RMMG1-VTWEG'
wa_file-vtweg.
using 'SAPLMGMM' '4000'.
using 'BDC_OKCODE'
'=SP05'.
using 'MAKT-MAKTX'
'laptop'.
using 'MARA-MEINS'
'KGS'.
using 'MARA-SPART'
'01'.
using 'MARA-MATKL'
'001'.
using 'MVKE-SKTOF'
'X'.
using 'BDC_CURSOR'
'MG03STEUER-TAXKM(01)'.
using 'MG03STEUER-TAXKM(01)'
wa_file-taxkm.
using 'SAPLMGMM' '4200'.
using 'BDC_OKCODE'
'=BABA'.
using 'BDC_CURSOR'
'MAKT-MAKTX'.

perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_dynpro
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field
perform bdc_field

using 'MAKT-MAKTX'
'laptop'.
using 'SAPLMGMM' '4000'.
using 'BDC_OKCODE'
'=SP05'.
using 'BDC_CURSOR'
'MAKT-MAKTX'.
using 'MAKT-MAKTX'
'laptop'.
using 'MARA-MEINS'
'KGS'.
using 'MARA-SPART'
'01'.
using 'MARA-MATKL'
'001'.
using 'MVKE-SKTOF'
'X'.
using 'SAPLMGMM' '4000'.
using 'BDC_OKCODE'
'=BU'.
using 'BDC_CURSOR'
'MAKT-MAKTX'.
using 'MAKT-MAKTX'
'laptop'.
using 'MARA-MTPOS_MARA'
'NORM'.
using 'MVKE-MTPOS'
'NORM'.
using 'SAPLMGMM' '4000'.
using 'BDC_OKCODE'
'=BU'.
using 'MAKT-MAKTX'
'laptop'.
using 'MARA-MEINS'
'KGS'.
using 'MARA-BRGEW'
'120'.
using 'MARA-GEWEI'
'KG'.
using 'MARA-NTGEW'
'100'.
using 'MARC-MTVFP'
'01'.
using 'BDC_CURSOR'
'MARC-LADGR'.
using 'MARA-TRAGR'
wa_file-tragr.
using 'MARC-LADGR'
wa_file-ladgr.

BREAK-POINT.
CALL TRANSACTION 'MM01'
USING bdcdata
MODE 'A'
UPDATE 'A'
MESSAGES INTO messtab.
if sy-subrc = 0.
PERFORM disp_suc_msg.
ELSE.
PERFORM disp_erros_msg.
ENDIF.
REFRESH bdcdata.
REFRESH messtab.
ENDLOOP.
*&---------------------------------------------------------------------*
*&
Form bdc_dynpro
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_0134
text
*
-->P_0135
text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro
= dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM.
*&---------------------------------------------------------------------*
*&
Form bdc_field
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_0424
text
*
-->P_0425
text
*----------------------------------------------------------------------*
form bdc_field using
FNAM FVAL.

clear bdcdata.

bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.
" bdc_field
*&---------------------------------------------------------------------*
*&
Form disp_suc_msg
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form disp_suc_msg .
DATA : v_msg TYPE string .
READ TABLE messtab WITH KEY = 'S'.
WRITE : / v_msg , 'IS CREATED FOR NAME:'.
CLEAR v_msg.
endform.
" disp_suc_msg
*&---------------------------------------------------------------------*
*&
Form disp_erros_msg
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form disp_erros_msg .
DATA : MSG TYPE STRING .
LOOP AT MESSTAB WHERE MSGTYP = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID
= SY-MSGID
LANG
= SY-LANGU
NO
= MESSTAB-MSGNR
V1
= MESSTAB-MSGV1
V2
= MESSTAB-MSGV2
V3
= MESSTAB-MSGV3
V4
= MESSTAB-MSGV4
IMPORTING
MSG
IF sy-subrc <> 0.
ENDIF.
WRITE MSG.
ENDLOOP.
endform.

= MSG.

"

RECODINIG PROJ VVENKT

disp_erros_msg