11-23-2007 5:38 AM
Hi friends,
How can we handle differnet vies for MM01 transaction in BDC.
Regards,
Prashant
11-23-2007 5:51 AM
After the recording, you might see, that the selection of the views is
monething like that: SELECTION(3) = 'X'
SELECTION(4) = 'X'
SELECTION(5) = 'X'
you have to address the selected
views by their index in the table.
in Tcode SHDB, record MM01 transaction only for the MRP1 MRP2 MRP3 and use the same code in ur BDC prog.
Look at the below code for MM01
http://www.sap-img.com/abap/example-how-views-are-dealt-in-bdc.htm
You have + button in the MK01 trasaction code, if you press that you
can enter new record in the table control, so every time, enter a New
record and press that + button, then enter the record then press + , like this we need to handle the table control
Check the links -
example:
Example how Views are dealt in BDC
Can any body tell me some views of MM that we can use in BDC?
***This is a BDC for Semi finished Materials*******
report ZBDC_SEMIFIN
no standard page heading line-size 255.
include bdcrecx1.
Tables: Mara,"General Material Data
mard,"Storage Location Data for Material
mvke,"Sales Data for Material
Makt,"Material Descriptions
marc,"Plant Data for Material
mbew,"Material Valuation
rlgrap."Program Fields/Screen Fields for SAPLGRAP
Data: begin of ITAB occurs 0,"Internal table for Semi-Finished Material
Initial data
matnr like mara-matnr, "Material Code
mbrsh like mara-mbrsh, "Industry Data
mtart like mara-mtart, "Material Type
Org Data
Werks like marc-werks, "Plant
lgort like mard-lgort, "Storage Location
vkorg like mvke-vkorg, "Sales Orgnization
vtweg like mvke-vtweg, "Distribution Chanel
Basic 1
Maktx Like makt-maktx, "Description
meins like mara-meins, "Uom
matkl like mara-matkl, "Material Group
BISMT LIKE MARA-BISMT, " Old Material Number
spart like mara-spart, "Division
brgew(7),"like mara-brgew, "Gross Weight
gewei like MARA-GEWEI, "Weight Unit
ntgew(7)," like mara-ntgew, "Net Weight
Purchasing
MAKTL LIKE MARA-MATKL, "Material Group
ekwsl like MARA-EKWSL, " Purchasing Value Key
ekgrp like MARC-EKGRP, " Purchasing Group
Mrp 1
disgr like MARC-DISGR, "Mrp Group
ekgrp like MARC-EKGRP, "Purchasing group
dismm like MARC-DISMM, "Mrp Type
dispo like MARC-DISPO, "Mrp Controller
disls like MARC-DISLS, "Lot Size
BSTMI like MARC-BSTMI,
BSTMA like MARC-BSTMA,
BSTRF like MARC-BSTRF,
BSTFE like MARC-BSTFE,
Mrp 2
beskz like MARC-BESKZ, "Procurement type
lgpro like MARC-LGPRO, "Production Storage Location
dzeit(3),"like MARC-DZEIT, "In house Production time
plifz(3),"like MARC-PLIFZ, "Planned delivery time
fhori(3),"like MARC-FHORI, "Sched margin key
eisbe like MARC-EISBE, "Safety stock
Mrp 3
PERKZ LIKE MARC-PERKZ,
vrmod like MARC-VRMOD, "Consumption mode
vint1(3)," like MARC-VINT1, "Backward Consumption period
vint2(3),"like MARC-VINT2, "Forward Consumption period
mtvfp like MARC-MTVFP, "Availability Check
Mrp 4
sbdkz like MARC-SBDKZ, "Individual/ Collective
SAUFT like MARC-SAUFT, "Repetitive Manufacturing
SFEPR like MARC-SFEPR, "REM Profile
Work Scheduling View
ausme like MARC-AUSME, "Unit of issue
FEVOR LIKE MARC-FEVOR, "Production Scheduler
SFCPF like MARC-SFCPF, "Production Scheduler Profile
umren(5)," like RMMZU-UMREN, "Val for base uom
umrez(5) ,"like RMMZU-UMREz, "Value for uo issue
Accounting 1
bklas like MBEW-BKLAS, "Valuation Class
vprsv like MBEW-VPRSV, "Price Control Indicator
verpr(7)," like MBEW-VERPR, "Value/Price
STPRS like MBEW-STPRS,
*COSTING
EKALR LIKE MBEW-EKALR," With qty str
LOSGR like MARC-LOSGR, " Costing Lot size
end of ITAB.
**********************************************************
Data: W_record type I, "Record Allready exists.
w_trecord type I. "Total record processed
start-of-selection.
perform upload. "Upload Data from Text File
Perform Open_group. "Create a session
clear : w_record,w_trecord.
perform semi. "Create Semi Finish Materials
if w_trecord gt 0 or w_record gt 0.
perform batch_job.
endif.
perform close_group. "Close session
FORM SEMI.
loop at ITAB.
Check for material in master select single * from mara where matnr eq ITAB-matnr.
if sy-subrc ne 0.
w_trecord = w_trecord + 1.
*Initial Screen
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
'M'.
perform bdc_field using 'RMMG1-MTART'
'HALB'.
**********************Views*********************************
*Select Views
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(12)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(14)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
'X'..
perform bdc_field using 'MSICHTAUSW-KZSEL(17)'
'X'.
**********************Views*****************************
*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'
'/00'.
*perform bdc_field using 'MSICHTAUSW-KZSEL(17)'
ITAB-KZSEL_17_011.
*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(13)'.
*perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
ITAB-KZSEL_13_012.
*Org Data
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.
*Basic 1
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=SP09'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-MATKL'
ITAB-MATKL.
perform bdc_field using 'MARA-BISMT'
ITAB-BISMT.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_field using 'BDC_CURSOR'
'MARA-NTGEW'.
perform bdc_field using 'MARA-BRGEW'
ITAB-BRGEW.
perform bdc_field using 'MARA-GEWEI'
ITAB-GEWEI.
perform bdc_field using 'MARA-NTGEW'
ITAB-NTGEW.
*Purchasing
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP12'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
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_field using 'BDC_CURSOR'
'MARA-EKWSL'.
perform bdc_field using 'MARA-EKWSL'
ITAB-EKWSL.
*MRP 1
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP13'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARC-EKGRP'
ITAB-EKGRP.
perform bdc_field using 'MARC-DISMM'
ITAB-DISMM.
perform bdc_field using 'MARC-DISPO'
ITAB-DISPO.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISLS'.
perform bdc_field using 'MARC-DISLS'
ITAB-DISLS.
IF ITAB-DISLS EQ 'EX' .
perform bdc_field using 'MARC-BSTMI'
ITAB-BSTMI."MIN LOT SIZE
perform bdc_field using 'MARC-BSTMA'
ITAB-BSTMA."MAX LOT SIZE
perform bdc_field using 'MARC-BSTRF'
ITAB-BSTRF."RNDING
ELSEIF ITAB-DISLS EQ 'FX'.
perform bdc_field using 'MARC-BSTFE'
ITAB-BSTFE.
ENDIF.
*MRP 2
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP14'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARC-BESKZ'
ITAB-BESKZ.
perform bdc_field using 'MARC-LGPRO'
ITAB-LGPRO.
perform bdc_field using 'MARC-DZEIT'
ITAB-DZEIT.
perform bdc_field using 'MARC-PLIFZ'
ITAB-PLIFZ.
perform bdc_field using 'MARC-FHORI'
ITAB-FHORI.
perform bdc_field using 'BDC_CURSOR'
'MARC-EISBE'.
perform bdc_field using 'MARC-EISBE'
ITAB-EISBE.
*MRP 3
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP15'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARC-PERKZ'
ITAB-PERKZ.
perform bdc_field using 'MARC-VRMOD'
ITAB-VRMOD.
perform bdc_field using 'MARC-VINT1'
ITAB-VINT1.
perform bdc_field using 'MARC-VINT2'
ITAB-VINT2.
perform bdc_field using 'BDC_CURSOR'
'MARC-MTVFP'.
perform bdc_field using 'MARC-MTVFP'
ITAB-MTVFP.
*MRP 4
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP17'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARC-SBDKZ'
ITAB-SBDKZ.
perform bdc_field using 'BDC_CURSOR'
'MARC-SFEPR'.
perform bdc_field using 'MARC-SAUFT'
ITAB-SAUFT.
perform bdc_field using 'MARC-SFEPR'
ITAB-SFEPR.
*Work Scheduling
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP24'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARC-SFCPF'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARC-FEVOR'
ITAB-FEVOR.
perform bdc_field using 'MARC-LGPRO'
ITAB-LGPRO.
perform bdc_field using 'MARC-SFCPF'
ITAB-SFCPF.
perform bdc_field using 'MARC-DZEIT'
ITAB-DZEIT.
*Check for Conversation Factor
if ITAB-MEINS ne iTAB-ausme and iTAB-umren gt 0
and iTAB-umrez gt 0.
perform bdc_dynpro using 'SAPLMGMM' '0510'.
perform bdc_field using:
'BDC_OKCODE' '=ENTR',
'RMMZU-UMREN' ITAB-UMREN,
'RMMZU-UMREZ' ITAB-UMREZ.
endif.
perform bdc_field using 'MARC-LGPRO'
itab-LGPRO.
perform bdc_field using 'MARC-DZEIT'
itab-DZEIT.
*Accounting
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP26'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'BDC_CURSOR'
'MBEW-STPRS'.
perform bdc_field using 'MBEW-BKLAS'
ITAB-BKLAS.
perform bdc_field using 'MBEW-VPRSV'
ITAB-VPRSV.
perform bdc_field using 'MBEW-STPRS'
ITAB-STPRS.
IF ITAB-VPRSV = 'S'.
perform bdc_field using 'MBEW-STPRS' "FILLS STD PRICE
ITAB-VERPR.
ELSEIF ITAB-VPRSV ='V'.
perform bdc_field using 'MBEW-VERPR' "FILLS VALUE
ITAB-VERPR.
ENDIF.
*Cost Estimate
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 'BDC_CURSOR'
'MARC-PRCTR'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MBEW-EKALR'
ITAB-EKALR.
perform bdc_field using 'MARC-LOSGR'
ITAB-LOSGR.
perform bdc_transaction using 'MM01'.
REFRESH BDCDATA.
else.
w_record = w_record + 1.
endif.
ENDLOOP.
ENDFORM.
form Upload.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = ' '
FILETYPE = ' '
TABLES
DATA_TAB = ITAB
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
ENDFORM.
form batch_job.
uline.
format color col_heading.
if w_trecord gt 0.
Write:/ 'Background Job has been Created for ',
w_trecord right-justified, 'Semi-Fin', 80 ''.
write:/ 'Please follow the following steps to run this job',
80 ''.
write:/ 'as listed below.', 80 ''.
format color col_normal.
skip.
write:/05 '1.Goto Transaction SM35', 80 ''.
write:/05 '2.Select your Session Name', 80 ''.
write:/05 '3.Click On Execute Button', 80 ''.
endif.
if w_record gt 0.
format color col_negative.
write:/ w_record ,'records already existed', 80 ''.
format color off.
endif.
uline.
endform.
Please see in the below links:
Make use of the FM : MATERIAL_BTCI_SELECTION_NEW to get the views.
form GET_MATVIEW using P_MATNR type MATNR
changing P_D0070 like IT_BTCI_D0070.
call function 'MATERIAL_BTCI_SELECTION_NEW'
exporting
MATERIAL = P_MATNR
SELECTION = C_VIEW
TCODE = C_TCODE
tables
BTCI_D0070 = P_D0070
exceptions
MATERIAL_NOT_FOUND = 1
MATERIAL_NUMBER_MISSING = 2
MATERIAL_TYPE_MISSING = 3
MATERIAL_TYPE_NOT_FOUND = 4
NO_ACTIVE_DYNPRO_SELECTED = 5
NO_AUTHORITY = 6
others = 7.
if SY-SUBRC <> 0.
message id SY-MSGID type SY-MSGTY number SY-MSGNO
with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
delete P_D0070 where FVAL <> C_X.
endform. " get_matview
Reward points if useful.
11-23-2007 5:59 AM
***********************************************************************
** Program ID : ZMAT_CREATE
** Program Desc : Material Master Creation
** Process Overview :
** Created By : R. NAGARAJAN
** Created Date : 22/08/2006
** Company Name : Infoview Technologies Limited
************************************************************************
REPORT ZMAT_CREATE
NO STANDARD PAGE HEADING LINE-SIZE 132 MESSAGE-ID ZBDCMSG.
----
Internal table definition *
----
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE RMMG1-MATNR, " Material Number
MBRSH LIKE RMMG1-MBRSH, " Industry Sector
MTART LIKE RMMG1-MTART, " Material Type
WERKS LIKE RMMG1-WERKS, " Plant
LGORT LIKE RMMG1-LGORT, " Storage Location
VKORG LIKE RMMG1-VKORG, " Sales Organization
VTWEG LIKE RMMG1-VTWEG, " Distribution Channel
LGNUM LIKE RMMG1-LGNUM, " Warehouse Number
LGTYP LIKE RMMG1-LGTYP, " Storage Type
MAKTX LIKE MAKT-MAKTX, " Material Description
MEINS LIKE MARA-MEINS, " Base Unit of Measure
MATKL LIKE MARA-MATKL, " Material Group
SPART LIKE MARA-SPART, " Division
MTPOS_MARA LIKE MARA-MTPOS_MARA, "General item category group
GEWEI LIKE MARA-GEWEI, " Weight Unit
TAXKM1 LIKE MG03STEUER-TAXKM, " Tax classification material
TAXKM2 LIKE MG03STEUER-TAXKM, " Tax classification material
KONDM LIKE MVKE-KONDM, " Material Pricing Group
MTPOS LIKE MVKE-MTPOS , "ItemCategoryGroupFromMaterialMaster
MTVFP LIKE MARC-MTVFP, " Checking Group for AvailabilityCheck
TRAGR LIKE MARA-TRAGR, " Transportation group
LADGR LIKE MARC-LADGR, " Loading group
TDLINE LIKE RSTXT-TXLINE, " Text editor text line
EKGRP LIKE MARC-EKGRP, " Purchasing Group
DISMM LIKE MARC-DISMM, " MRP Type
BESKZ LIKE MARC-BESKZ, " Procurement Type
SOBSL LIKE MARC-SOBSL, " Special procurement type
PERKZ LIKE MARC-PERKZ, " Period indicator
PRMOD LIKE MPOP-PRMOD, " Forecast model
KZINI LIKE MPOP-KZINI, " Initialization indicator
AUTRU LIKE MARC-AUTRU, " Reset Forecast Model Automatically
MODAV LIKE MPOP-MODAV, " Model selection procedure
IPRKZ LIKE MARA-IPRKZ, " Period indicator for shelf life expiration date
BWTTY LIKE MBEW-BWTTY, " Valuation Category
BKLAS LIKE MBEW-BKLAS, " Valuation Class
EKLAS LIKE MBEW-EKLAS, " Valuation Class for Sales OrderStock
VPRSV LIKE MBEW-VPRSV, " Price Control Indicator
EKALR LIKE MBEW-EKALR, "MaterialIsCostedWithQuantityStructure
END OF ITAB,
*// TEXT HEADER
GT_HEAD LIKE THEAD,
*// Text lines
GT_TEXT LIKE STANDARD TABLE OF TLINE,
GW_TEXT LIKE TLINE,
----
Data definition *
----
WS_REP_CNT(6) TYPE C,
SESSION(12) TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETERS:
PA_GROUP LIKE APQI-GROUPID OBLIGATORY DEFAULT 'MMupload',
PA_FNAME LIKE IBIPPARMS-PATH OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
----
Include statements *
----
INCLUDE ZBDCREX.
----
At Selection Screen definition *
----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FNAME.
*//GETTING FLAT FILE PATH
PERFORM FILE_PATH USING PA_FNAME.
----
Start of Selection definition *
----
START-OF-SELECTION.
*//UPLOADING THE FLAT FILE
PERFORM DATA_UPLOAD TABLES ITAB USING PA_FNAME.
*// BDC OPEN GROUP
PERFORM OPEN_GROUP USING PA_GROUP.
SKIP 3.
FORMAT COLOR COL_HEADING INVERSE ON.
WRITE 40 TEXT-001.
FORMAT COLOR COL_HEADING INVERSE OFF.
SKIP 1.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
WRITE :/3 TEXT-002, 13 SY-MANDT, 104 TEXT-003, 113 SY-UNAME,
/3 TEXT-004, 13 SY-DATUM, 104 TEXT-005, 113 SY-UZEIT.
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
LOOP AT ITAB.
WS_REP_CNT = WS_REP_CNT + 1. "To Count no. of Records Processed
PERFORM MM_UPLOAD.
ENDLOOP.
*//STATUS INDICATION
IF SY-SUBRC = 0.
SESSION = PA_GROUP.
SKIP 1.
FORMAT COLOR COL_TOTAL INVERSE ON.
WRITE: /38 TEXT-006 , WS_REP_CNT.
FORMAT COLOR COL_TOTAL INVERSE OFF.
MESSAGE S000 WITH SESSION.
ENDIF.
*// BDC CLOSE GROUP
PERFORM CLOSE_GROUP.
SET PF-STATUS 'ZMM01PF'.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'SESSION'.
CALL TRANSACTION 'SM35'.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE SCREEN.
ENDCASE .
---------------------------------------------------------------------*
FORM MM_UPLOAD *
---------------------------------------------------------------------*
FORM MM_UPLOAD.
REFRESH BDCDATA.
*// Create Material: Initial Screen
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-MATNR'
ITAB-MATNR.
perform bdc_field using 'RMMG1-MBRSH'
ITAB-MBRSH.
perform bdc_field using 'RMMG1-MTART'
ITAB-MTART.
*// Selection Views
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'SELA'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*// Organization Levels
perform bdc_dynpro using 'SAPLMGMM' '0080'.
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_field using 'RMMG1-VKORG'
ITAB-VKORG.
perform bdc_field using 'RMMG1-VTWEG'
ITAB-VTWEG.
perform bdc_field using 'RMMG1-LGNUM'
ITAB-LGNUM.
perform bdc_field using 'RMMG1-LGTYP'
ITAB-LGTYP.
*// Basic Data 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=SP04'.
perform bdc_field using 'MAKT-MAKTX'
ITAB-MAKTX.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
ITAB-MTPOS_MARA.
perform bdc_field using 'BDC_CURSOR'
'MARA-GEWEI'.
perform bdc_field using 'MARA-BRGEW'
'9000'.
perform bdc_field using 'MARA-GEWEI'
ITAB-GEWEI.
perform bdc_field using 'MARA-NTGEW'
'8000'.
*// Sales: Sales Organization 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP05'.
perform bdc_field using 'MG03STEUER-TAXKM(01)'
ITAB-TAXKM1.
perform bdc_field using 'MG03STEUER-TAXKM(02)'
ITAB-TAXKM2.
perform bdc_dynpro using 'SAPLMGMM' '4200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_OKCODE'
'=SP05'.
*// Sales: Sales Organization 2: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP06'.
perform bdc_field using 'BDC_CURSOR'
'MVKE-KONDM'.
perform bdc_field using 'MVKE-KONDM'
ITAB-KONDM.
perform bdc_field using 'MARA-MTPOS_MARA'
ITAB-MTPOS_MARA.
perform bdc_field using 'MVKE-MTPOS'
ITAB-MTPOS.
*// Sales: General / Plant Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP12'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-BRGEW'
'9000'.
perform bdc_field using 'MARA-GEWEI'
ITAB-GEWEI.
perform bdc_field using 'MARA-XCHPF'
''.
perform bdc_field using 'MARA-NTGEW'
'8000'.
perform bdc_field using 'MARC-MTVFP'
ITAB-MTVFP.
perform bdc_field using 'BDC_CURSOR'
'MARC-LADGR'.
perform bdc_field using 'MARA-TRAGR'
ITAB-TRAGR.
perform bdc_field using 'MARC-LADGR'
ITAB-LADGR.
*// MRP 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP13'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARC-EKGRP'
ITAB-EKGRP.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISMM'.
perform bdc_field using 'MARC-DISMM'
ITAB-DISMM.
*// MRP 2: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP14'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1_BEZ-WERKS_BEZ'.
perform bdc_field using 'MARC-BESKZ'
ITAB-BESKZ.
perform bdc_field using 'MARC-SOBSL'
ITAB-SOBSL .
*// MRP 3: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP16'.
perform bdc_field using 'BDC_CURSOR'
'MARC-PERKZ'.
perform bdc_field using 'MARC-PERKZ'
ITAB-PERKZ.
perform bdc_field using 'MARC-MTVFP'
ITAB-MTVFP.
*// Forecasting Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP17'.
perform bdc_field using 'BDC_CURSOR'
'MPOP-PRMOD'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MPOP-PRMOD'
ITAB-PRMOD.
perform bdc_field using 'MARC-PERKZ'
ITAB-PERKZ.
perform bdc_field using 'MPOP-PERAN'
'60'.
perform bdc_field using 'MPOP-ANZPR'
'12'.
perform bdc_field using 'MPOP-KZINI'
ITAB-KZINI.
perform bdc_field using 'MPOP-SIGGR'
'4.000'.
perform bdc_field using 'MARC-AUTRU'
ITAB-AUTRU.
perform bdc_field using 'MPOP-MODAV'
ITAB-MODAV.
*// Work Scheduling Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP19'.
perform bdc_field using 'BDC_CURSOR'
'MARC-FRTME'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
*// Plant data / Stor. 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP20'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-IPRKZ'
ITAB-IPRKZ.
*// Plant data / Stor. 2: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP21'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MARA-BRGEW'
'9000'.
perform bdc_field using 'MARA-GEWEI'
ITAB-GEWEI.
perform bdc_field using 'MARA-NTGEW'
'8000'.
*// Warehouse Management 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP23'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MARA-BRGEW'
'9000'.
perform bdc_field using 'MARA-GEWEI'
ITAB-GEWEI.
*// Quality Management Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP24'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
*// Accounting 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP26'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MBEW-BWTTY'
ITAB-BWTTY.
perform bdc_field using 'MARA-SPART'
ITAB-SPART.
perform bdc_field using 'BDC_CURSOR'
'MBEW-STPRS'.
perform bdc_field using 'MBEW-BKLAS'
ITAB-BKLAS.
perform bdc_field using 'MBEW-EKLAS'
ITAB-EKLAS.
perform bdc_field using 'MBEW-VPRSV'
ITAB-VPRSV.
perform bdc_field using 'MBEW-PEINH'
'1'.
perform bdc_field using 'MBEW-VERPR'
'800'.
perform bdc_field using 'MBEW-STPRS'
'800'.
*// Costing 1: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP27'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MARA-MEINS'
ITAB-MEINS.
perform bdc_field using 'MBEW-EKALR'
ITAB-EKALR.
perform bdc_field using 'MARC-LOSGR'
'1'.
*// Costing 2: Screen
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=BABA'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MBEW-BKLAS'
ITAB-BKLAS.
perform bdc_field using 'MBEW-BWTTY'
ITAB-BWTTY.
perform bdc_field using 'MBEW-EKLAS'
ITAB-EKLAS.
perform bdc_field using 'MBEW-VPRSV'
ITAB-VPRSV.
perform bdc_field using 'MBEW-PEINH'
'1'.
perform bdc_field using 'MBEW-VERPR'
'800.00'.
perform bdc_field using 'MBEW-STPRS'
'800.00'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
*//BDC INSERT
PERFORM BDC_TRANSACTION TABLES BDCDATA
USING 'MM01'. " MESSAGES INTO GT_MSG.
*// Text Header Data
CONCATENATE ITAB-MATNR ' 000101'
INTO GT_HEAD-TDNAME .
GT_HEAD-TDOBJECT = 'MVKE' .
GT_HEAD-TDID = '0001' .
GT_HEAD-TDSPRAS = SY-LANGU.
*// Sales Text
GW_TEXT-TDFORMAT = '00'.
GW_TEXT-TDLINE = ITAB-TDLINE .
APPEND GW_TEXT TO GT_TEXT.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = GT_HEAD
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
TABLES
LINES = GT_TEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
SKIP 2.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
WRITE: / 'Unable to Insert Salestext for Material : ', ITAB-MATNR .
FORMAT COLOR COL_NEGATIVE INVERSE OFF.
ENDIF.
CLEAR: GT_HEAD, GT_TEXT, GW_TEXT.
ENDFORM. "MM_UPLOAD