BDC-MM02
Hi Experts,
Im wirting a BDC for MM02. There is a problem that the number of views maintained in Materials Master are not same. So in recording, the view marked for selection does not correspond to the view when opening MM02 for some material.
Please suggest how to tackle this when there is invariable number of views in material master, i want to make changes to views using BDC.
For example - i want to update Basic Data1 and MRP1 view in MM02. For some material there can be three views between above two views and for some material there might be six views between the two. im not able to determine the position of view to mark for selection at run time. Also the screen name and number is same for these views. This the BDC is not running properly..
Please suggest??
abap-raj
ya, that is true,
U need to keep track of what you are having for example as u said sales view u would know that you have sales related data then u trigger the OK_CODE of sales tab..as of OK_CODE try to determine what all are possible and required....Well, hope that helps...any how I wish you would find a better way tgh...which ofcourse I would like to know...too
santhosh
Similar Messages
-
BDC - MM02 _long text for material PO upload
Hi experts,
I want to upload Long text for material PO in MM02 (Purchase order text view)
throuh BDC upload. I have successfully done recording for this transaction. But in the recording it show no table field for that particular long text.
Pls help me to do this issue.
Thanks.Hi
See the sample program for this and modify as per your requirement.
REPORT zmm_longtext
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab1 OCCURS 0,
matnr LIKE mara-matnr, " Material
text1 LIKE tline-tdline, " Long Text
END OF itab1.
Internal Table for Upload of Long Texts Data
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr, " Material
text LIKE tline-tdline, " Long Text
END OF itab.
To create Long Text lines for CREATE_TEXT function module
DATA:BEGIN OF dt_lines OCCURS 0.
INCLUDE STRUCTURE tline. " Long Text
DATA:END OF dt_lines.
Variable declarations for CREATE_TEXT function module
DATA : dl_name TYPE thead-tdname, " Object Name
dl_lan TYPE thead-tdspras, " Language
gv_matnr TYPE matnr.
Constants
CONSTANTS:
Object ID for Long Text of Material Basic Data 1
c_best TYPE thead-tdid VALUE 'GRUN',
c_material TYPE thead-tdobject VALUE 'MATERIAL'. " Object
Parameters
PARAMETERS p_file LIKE rlgrap-filename.
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Start Of Selection
START-OF-SELECTION.
*To Upload Flat file
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
SORT itab1 BY matnr.
LOOP AT itab1.
CLEAR gv_matnr.
SELECT SINGLE matnr INTO gv_matnr
FROM mara WHERE bismt = itab1-matnr.
IF itab1-text1 NE ' '.
itab-matnr = gv_matnr.
itab-text = itab1-text1.
APPEND itab.
ENDIF.
CLEAR itab.
ENDLOOP.
DELETE itab WHERE matnr EQ ' '.
Upload the Texts
SORT itab BY matnr.
LOOP AT itab.
dt_lines-tdformat = 'ST'.
dt_lines-tdline = itab-text.
APPEND dt_lines.
dl_lan = sy-langu.
dl_name = itab-matnr.
Call the Function Module to Create Text
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = c_best
flanguage = dl_lan
fname = dl_name
fobject = c_material
save_direct = 'X'
fformat = '*'
TABLES
flines = dt_lines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Long Text Creation failed for Material'(001),
itab-matnr.
ELSE.
WRITE:/ 'Long Text Created Successfully for Material'(002),
itab-matnr.
ENDIF.
AT END OF matnr.
REFRESH dt_lines.
ENDAT.
ENDLOOP.
<b>Reward points for useful Answers</b>
Regards
Anji -
Message-ABAP/4 processor: DYNPRO_SEND_IN_BACKGROUND in BDC
Hi all,
BDC is written for MM02 and when execcuted from z report the inspection data bdc (mm02) BDC is getting executed successfully.
Later a badi is written to block mm02 from command prompt but allow from called programs(call transaction) in BADI
MATN1_OUTPUT_001 implmentation of BADI-MATN1.
DATA: it_zemail_mdm TYPE STANDARD TABLE OF zemail_mdm,
wa_zemail_mdm TYPE zemail_mdm.
DATA: v_x1,v_c,v_x.
IF sy-tcode = 'MM06' OR sy-tcode = 'MM02' OR sy-tcode = 'MM01'
OR sy-tcode = 'MMAM' OR sy-tcode = 'CL20N' OR sy-tcode = 'C223'
OR sy-tcode = 'MM17'.
CONSTANTS : c_msg1(45) TYPE c VALUE 'You are not authorised for this transaction.'.
DATA: c_err TYPE c VALUE 'S'.
IF ( ( sy-uname NE 'MDCC' ) AND ( sy-uname NE 'MDT_01' ) AND ( sy-uname NE '150891' ) AND ( sy-uname NE 'DESIGN' ) ).
IF syst-calld = ''.
MESSAGE c_msg1 TYPE c_err.
LEAVE TO SCREEN 0.
ENDIF.
ENDIF.
ENDIF.
But now when i execute BDC i get following message-
Message-ABAP/4 processor: DYNPRO_SEND_IN_BACKGROUND
Th message is success meassage but data is not getting created in database now.
Please guide to resolve the issue.
Thnaks.
Edited by: sanjivrd on Dec 12, 2009 12:36 PMHi sanjivrd,
in Batch-Input, just leave the BADI, put this at begin of BADI methold:
IF SY-BINPT IS NOT IITIAL.
RETURN.
ENDIF.
Regards,
Clemens -
BDC- To add ABC indicator in MM02-- MRP1
Hi,
I am working on BDC- To add ABC indicator in MM02--> MRP1.
Problem -->
In some material+ plant - Reorder point is there. In this case I need to take additional 'BDC_okcode' for ENTER.
HOW CAN I DO THIS?
I tried it with 'Select statement' between the Perform statement, but it's not working?
IF wa_file-matnr IS NOT INITIAL.
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'
wa_file-matnr.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(11)'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(11)'
'X'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-WERKS'.
PERFORM bdc_field USING 'RMMG1-WERKS'
wa_file-werks.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'MARC-MAABC'
wa_file-maabc.
SELECT SINGLE minbe INTO v_minbe FROM marc
WHERE matnr = wa_file-matnr
AND werks = wa_file-werks.
IF v_minbe GT 0.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
ENDIF.
ENDIF.
CALL TRANSACTION 'MM02' USING it_bdcdata MODE p_mode MESSAGES INTO it_msg.Hi,
Try to use Bapi and see ..Please find the sample code.
LOOP AT t_itab INTO wa_itab.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = wa_itab-matnr
IMPORTING
output = wa_headdata-material
EXCEPTIONS
length_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
prepare the follwing structres ( plantdata,headdata, plantdatax) .
* Select the MRP view
wa_headdata-mrp_view = 'X'.
* Call the Bapi to create the MRP view.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = wa_headdata
plantdata = wa_plantdata
plantdatax = wa_plantdatax
TABLES
returnmessages = t_return.
ENDLOOP
Regards,
Nagaraj -
Hello everyone!
I have developed a BDC program to batch input data into MM02 / MRP area.
It's working perfectly fine when I use mode 'A' in CALL TRANSACTION statement, but when I change it to 'N', so I can give this for the customer to test, it stops working, giving me an error in one of the screens, saying the "MRP area is not assigned to plant CH01" (when running with mode "E" it also gives me the error).
Here's my coding:
REPORT zload_mrp_areas.
Data and variables definition
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_header OCCURS 0,
link LIKE mara-matnr,
matnr LIKE mara-matnr,
werks LIKE marc-werks,
mstae(2) TYPE c,
perkz(2) TYPE c,
END OF t_header.
DATA: BEGIN OF t_details OCCURS 0,
muvbr(5) TYPE c,
unvbr(5) TYPE c,
matnr LIKE mara-matnr,
priod(6) TYPE c,
gsvbr(5) TYPE c,
END OF t_details.
DATA: v_count(3) TYPE n,
v_week LIKE scal-week,
v_week1(6) TYPE n,
v_week2(6) TYPE n,
v_page(5) TYPE p DECIMALS 2,
v_index(3) TYPE n,
v_field(19) TYPE c,
v_mode TYPE c,
v_date1 LIKE sy-datum,
v_date2 LIKE sy-datum,
v_date3 TYPE i.
Screen definition
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
PARAMETERS: headfile LIKE rfpdo1-febauszf OBLIGATORY,
detsfile LIKE rfpdo1-febauszf OBLIGATORY.
SELECTION-SCREEN END OF BLOCK 1.
File selection
AT SELECTION-SCREEN ON VALUE-REQUEST FOR headfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Multicash,*.txt'
static = 'X'
CHANGING
file_name = headfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR detsfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Multicash,*.txt'
static = 'X'
CHANGING
file_name = detsfile.
START-OF-SELECTION *
START-OF-SELECTION.
Load files
PERFORM load_files.
PERFORM process_file.
*& Form LOAD_FILES
Load files from network to SAP
FORM load_files .
File upload
DATA: l_filename TYPE string.
l_filename = headfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
TABLES
data_tab = t_header.
IF sy-subrc <> 0.
ENDIF.
l_filename = detsfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
TABLES
data_tab = t_details.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " LOAD_FILES
*& Form process_file
Load files into Material Master
FORM process_file .
LOOP AT t_header.
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'RMMG1-MATNR' t_header-matnr.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SELA'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0080'.
PERFORM bdc_field USING 'RMMG1-WERKS' t_header-werks.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SP12'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PB42'.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0010'.
PERFORM bdc_field USING 'SMDMA-BERID(01)' 'X'.
PERFORM bdc_field USING 'BDC_OKCODE' '=AEND'.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SP04'.
CLEAR v_week.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = sy-datum
IMPORTING
week = v_week.
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week = v_week
IMPORTING
date = v_date1.
LOOP AT t_details WHERE matnr = t_header-matnr.
CLEAR: v_week1, v_week2.
v_week1 = v_week.
v_week = t_details-priod.
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week = v_week
IMPORTING
date = v_date2.
v_date3 = v_date1 - v_date2.
v_page = v_date3 / 7.
IF v_page > 11.
v_index = v_page MOD 11.
v_page = v_page / 11.
COMPUTE v_count = TRUNC( v_page ).
ELSE.
v_index = v_page.
ENDIF.
IF v_index IS INITIAL.
v_index = 11.
v_count = v_count - 1.
ELSE.
v_index = v_index + 1.
ENDIF.
Paging
IF v_count NE 0.
v_count = v_count + 1.
DO v_count TIMES.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P-'.
ENDDO.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P++'.
v_count = v_count - 1.
DO v_count TIMES.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P-'.
ENDDO.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
v_field = 'RM03M_DB-KOVBW(*)'.
REPLACE '*' WITH v_index INTO v_field.
PERFORM bdc_field USING v_field t_details-muvbr.
v_field = 'RM03M_DB-VBWRT(*)'.
REPLACE '*' WITH v_index INTO v_field.
PERFORM bdc_field USING v_field t_details-unvbr.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WEIT'.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P++'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=UEBE'.
PERFORM bdc_dynpro USING 'SAPLMD_MGD1' '0010'.
PERFORM bdc_field USING 'BDC_OKCODE' '=UEBE'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
v_mode = 'N'.
CALL TRANSACTION 'MM02' USING bdcdata
MODE v_mode
UPDATE 'S'
MESSAGES INTO ITAB.
if sy-subrc is initial.
endif.
ENDLOOP.
ENDFORM. " process_file
*& Form BDC_DYNPRO
text
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
*& Form BDC_FIELD
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
Can anyone help? Please!
Thanks and regards,
FernandaYou are trying to access one of the MRP area which is not yet assigned to CH01 plant. You need to make sure wheather the MRP view was already created for that material for CH01 plant.
So, first check your data against the MARC for material and plant. If you don't fine any material for that plant than don't run BDC for that plant.
Regards,
Naimesh Patel -
BDC for Purchase order text updation in MM02 Transaction
Hi ALL,
I am updating purchase order text of a material in MM02 using BDC program.
I have done recording, and the program is updating text if the text field already contains some value. but,
when the field is empty and if the program tries to feed new data then it is not working.
Please help me!
regds,
RajanHi
material master purchase order long text
you can use through BDC or LSMW it is possible,
here we need to check in lsmw Direct input mentod Program name "/SAPDMC/SAP_LSMW_IMPORT_TEXTS" object name (0001) method(0001) program type (D).
Header we have --- MATNR and TEXT ID
Item ---LINE(Text line).
in header- for NAME and ID map the source fields MATNR and TEXID respectively.
OBJECT and SPRAS pass the constants.
in Item--for TEXTFORMAT pass the constant '*' and for the TEXTLINE map the input field LINE of the ITEM structure.
or else u can check in SE37 'CREATE_TEXT' , in that function module check it object Id , name , spras, lineitem, language "E"
here i mention example of text flat file,
H 100-100 best
longtext1 -
MM02 Upload Problem in BDC in Quality
Hello Experts ,
Currently I have situation here with BDC for MM02 . In sandbox I have recoded for only Quality Management View (which is at the 10th position). For all material types this is working fine.
But , when in Quality Server , the position of the views are changing dynamically with each material type. Hence BDC fails to select only Quality View during Upload.
Can anybody tell me if there is a way to encounter this ?
Thanks ,
TrishnaHi!
use fm 'MATERIAL_BTCI_SELECTION_NEW' to get view positon
FORM GET_POSITION USING P_MATNR LIKE MARA-MATNR
CHANGING P_POSITION TYPE N.
DATA:
S_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'
EXPORTING
MATERIAL = P_MATNR
SELECTION = 'D' <-- put here you view
TCODE = 'MM02'
* IMPORTING
* SELSTATUS =
* SELSTATUS_IN =
TABLES
BTCI_D0070 = S_BDCDATA
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.
ELSE.
*-> in der Annahme, dau043F der Dispobereich immer auf der Sicht
*-> 'Dispositon 1' zu finden ist.
READ TABLE S_BDCDATA WITH KEY FVAL = K_CHAR_X.
P_POSITION = SY-TABIX - 1.
ENDIF.
ENDFORM. " GET_POSITION
Search forum for MATERIAL_BTCI_SELECTION_NEW and you find more examples. -
How to find the position of view in MM02 transaction for coding BDC?
Hi Guys,
Is there any FM or BAPI Available to find the position of the view in MM02 transaction. I tried FM SELECTION_VIEWS_FIND. But getting inconsistent results
i.e Some materials it is giving correct positions but for others i am getting wrong position. So my BDC is getting failed.
Thanks in advance.
Vinod.Hi,
data : i_t133a like t133a occurs 0 with header line,
ch(1),
viewno(2) type n.
clear viewno.
select * from t133a into corresponding fields of table i_t133a
where bilds = '21' and guifu like 'SP%' .
loop at i_t133a .
ch = i_t133a-pstat.
if mara-vpsta na ch .
delete i_t133a .
continue .
endif .
endloop.
sort i_t133a by guifu ascending .
loop at i_t133a .
viewno = viewno + 1 .
if i_t133a-guifu = 'SP01'. "FOR BASIC DATA1 CHANGES ACCORDINGLY REFER TABLE T133A TO FIND VTHE VALUE
exit .
endif .
endloop .
reward if usefull -
BDC with MM01/ MM02 from MARA table
Can anybody suggest me for the following problem.
I want to construct a BDC with MM01/ MM02 from MARA table.
And I want the source file to be a notepad or Excel sheet. But i am not
getting, that how to write the data in Notepad/Excel sheet, to feed to the
master table according to the MM01/MM02 fields .This is the sample code for creation of flatfile for MM01 this will be definetly helping you to create a flatfile.
REPORT ZBDC_FF MESSAGE-ID BCTRAIN .
TYPES: BEGIN OF STU,
MATNR LIKE RMMG1-MATNR,
MBRSH LIKE RMMG1-MBRSH,
MTART LIKE RMMG1-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
END OF STU.
DATA WA_ITAB TYPE STU.
DATA ITAB TYPE TABLE OF STU.
WA_ITAB-MATNR = 'T1'. "MATERIAL NUMBER"
WA_ITAB-MBRSH = 'K'. "INDUSTRY SECTOR"
WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
WA_ITAB-MEINS = 'EE'. "BASE UNIT OF MEASURE"
APPEND WA_ITAB TO ITAB.
CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL2'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL3'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
*WA_ITAB-MATNR = 'TOL4'. "MATERIAL NUMBER"
*WA_ITAB-MBRSH = 'M'. "INDUSTRY SECTOR"
*WA_ITAB-MTART = 'VKHM'. "MATERIAL TYPE"
*WA_ITAB-MAKTX = 'TOOLEMATERIAL'. "MATERIAL DESCRIPTION"
*WA_ITAB-MEINS = 'EA'. "BASE UNIT OF MEASURE"
*APPEND WA_ITAB TO ITAB.
*CLEAR WA_ITAB.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Documents and Settings\chiranjeevi\Desktop\BDC.TXT'
TABLES
DATA_TAB = ITAB
IF SY-SUBRC <> 0.
MESSAGE S999 WITH 'EXECUTED'.
ENDIF.
Cheers!!! -
How to upload material text in mm02 using bdc table control
i have problem to upload material Description in mm02 using bdc.
my text file is like
2000251 AF A12345
2000251 AR B12345
2000251 BG C12345
2000252 AF F12345
2000252 AR G12345
2000252 AF H12345
i want to upload material number, language, and material description, how can i upload pls help me.Hi,
Try with bapi , bapi_material_save_data.. didn't exactly remember it,Please check the same.
Regards,
Nagaraj -
How to do BDC in mm02 ? as different materials have different view.
hi,
refer to the threads.
mm01/mm02 different views, bdc
BDC on MM02 with user view
regards,
srelakshmi -
Hi,
I am working on a BDC for the tcode MM02 in which i have to insert the Inspection Type in the Quality Managment View of materials. i had executed the code which was working fine,but when i executed it ,it remains on the same screen where the after specifying on the file path. I dont know why it is happening ,plzz provide me guidelines for solving this problem.report ZMM02 no standard page heading line-size 255.
include bdcrecx1.
DATA: BEGIN OF ZVBM OCCURS 0,
MATNR(18) TYPE C,
BRGEW(16) TYPE C,
NTGEW(16) TYPE C,
END OF ZVBM.
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'c:\vijay.txt'
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ZVBM
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform open_group.
LOOP AT ZVBM.
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'
zvbm-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
'VIJAY3'.
perform bdc_field using 'MARA-MEINS'
'KG'.
perform bdc_field using 'MARA-MATKL'
'01'.
perform bdc_field using 'MARA-SPART'
'01'.
perform bdc_field using 'BDC_CURSOR'
'MARA-NTGEW'.
perform bdc_field using 'MARA-BRGEW'
zvbm-brgew.
perform bdc_field using 'MARA-GEWEI'
'KG'.
perform bdc_field using 'MARA-NTGEW'
zvbm-ntgew.
perform bdc_transaction using 'MM02'.
ENDLOOP.
perform close_group. -
Hi Friends,
i want to write a BDC FOR MM02 T.CODE AT PLANT LEVEL AND METERIAL LEVEL.
I WANT UPLOAD THE BELOW FEILDS DATA :
THE FIELDS THAT I WANT UPLOAD IS EISBE(SAFETY STOCK) , MAABC(ABC INDICATOR)
AND WZEIT(LEAD TIME).....AT PLANT LEVEL AND METERIAL LEVEL.
PLS HELP ME.... IT IS AN URGENT.
REGARDS,because with LSMW , you can standard program RMDATIND (direct input ==> faster than batch input.
In step 1 : you select standard program (OBject 0020 method 0000)
In step 2 you define source structure ZSRC_MARA
In step 3 you list the fields : MATNR, WERKS, MAABC, MINBE
In step 4 you make the link of your source struture to BGR00, BMM00, BMMH1
In step 5 you map your fields + BMM00-XEID1 ( you have to flag the views you consider).
Finished from developpement side
DAvid -
Hi
I have problem while inserting values in UNIT of measure in MM02 transaction. I recorded transaction for second field of table control , but while running BDC it inserts value in 2nd row only. How to increase counter while inserting values.
Plz do needful.hi,
*& Report ZMMGB_MM02PLANPRICE_BDC
report zmmgb_mm02planprice_bdc.
tables : marc.
data: begin of bdcdata occurs 0.
include structure bdcdata.
data: end of bdcdata.
data: w_tcode like sy-tcode, " Transaction code
w_tkstatus like t130m-pstat, " SAP Transaction status
w_anzgstatus like t130m-pstat, " Summary Display status
w_t130m like t130m, " Transaction control: mat.master
w_bilds like t133a-bilds, " Screen sequence
w_dytxt like t133b-dytxt, " View description
w_linex(5) type c, " View # in table
w_line like sy-tabix, " View # on selection screen
w_num like sy-tabix,
w_matnr like mara-matnr, " Material
w_mtart like mara-mtart, " Material type
w_vpsta like mara-vpsta, " Material maintenance status
w_pstat like t134-pstat. " Material type maintenance status
data: begin of it_views occurs 30.
include structure mbildtab. " Selection Views
data: end of it_views.
data : mbrsh(1) type c,
mtart(4) type c,
kzsel(20) type c,
price(14) type c,
pdate(10) type c,
dytxt(20) type c,
pos(2) type n.
data : begin of itab occurs 0,
matnr like mara-matnr, "Material
werks like t001w-werks, "Plant
zplp1 like mbew-zplp1, "Planned Price1
zpld1 like mbew-zpld1, "Planned Price1 Date
end of itab.
parameters : upd as checkbox.
start-of-selection.
check upd eq 'X'.
perform upload_data.
loop at itab.
refresh bdcdata.
perform get_viewpos.
w_linex = w_linex - 17 .
pos = w_linex+2(2).
concatenate 'MSICHTAUSW-KZSEL(' pos ')' into kzsel.
concatenate 'MSICHTAUSW-DYTXT(' pos ')' into dytxt.
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'
itab-matnr . "'93110989'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(08)'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
dytxt. "'MSICHTAUSW-DYTXT(05)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using kzsel "'MSICHTAUSW-KZSEL(05)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
itab-werks. "'7100'.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
move itab-zplp1 to price.
perform bdc_field using 'BDC_CURSOR'
'MBEW-ZPLP1'.
perform bdc_field using 'MBEW-ZPLP1'
price. "'103.00'.
PERFORM convert_date_external.
perform bdc_field using 'MBEW-ZPLD1'
pdate. "'27.03.2008'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
call transaction 'MM02' using bdcdata mode 'A' update 'S'.
clear : itab,price,pdate,pos,w_linex.
endloop.
* Start new screen *
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform. "BDC_DYNPRO
* Insert field *
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform. "BDC_FIELD
*& Form GET_VIEWPOS
* text
* --> p1 text
* <-- p2 text
form get_viewpos .
if itab-matnr na sy-abcde.
unpack itab-matnr to itab-matnr.
endif.
select single * from marc where matnr = itab-matnr and
werks = itab-werks.
if sy-subrc eq 0.
w_tcode = 'MM02'. "Change view
endif.
call function 'MATERIAL_INIT'
exporting
tcode = w_tcode
kz_berprf = 'X'
importing
it130m = w_t130m
tkstatus = w_tkstatus
exceptions
no_authority = 1
wrong_call = 2
kstatus_empty = 3
tkstatus_empty = 4
aktyp_tcode_mismatch = 5
tcode_not_found = 6
material_article_mismatch = 7
others = 8.
if sy-subrc <> 0.
write: 'MATERIAL_INIT error code =', sy-subrc.
exit.
endif.
* 2. Get Material type and maintenance statuses
select single matnr mtart vpsta from mara
into (w_matnr, w_mtart, w_vpsta)
where matnr = itab-matnr.
* if sy-subrc <> 0.
* write: 'Material', material, 'not in material master'.
* exit.
* endif.
select single pstat from t134 into w_pstat
where mtart = w_mtart.
if sy-subrc <> 0.
write: 'Material type', w_mtart, 'not found'.
endif.
* 3. Get Screen Sequence for Tcode/Material
call function 'BILDSEQUENZ_IDENTIFY'
exporting
materialart = w_mtart
tcode_ref = w_t130m-trref
importing
bildsequenz = w_bilds
exceptions
wrong_call = 1
not_found = 2
others = 3.
if sy-subrc <> 0.
write: 'BILDSEQUENZ_IDENTIFY error code =', sy-subrc.
exit.
endif.
* 4. Get Summary status (Transaction+Material+Material Type)
call function 'ANZGSTATUS_SETZEN'
exporting
aktyp = w_t130m-aktyp
marastatus = w_vpsta
t134status = w_pstat
tkstatus = w_tkstatus
importing
anzgstatus = w_anzgstatus
exceptions
anzgstatus_empty = 1
wrong_call = 2
others = 3.
if sy-subrc <> 0.
write: 'ANZGSTATUS_SETZEN error code =', sy-subrc.
exit.
endif.
* 5. Get all selection views:
call function 'SELECTION_VIEWS_FIND'
exporting
bildsequenz = w_bilds
pflegestatus = w_anzgstatus
tables
bildtab = it_views
exceptions
call_wrong = 1
empty_selection = 2
others = 3.
if sy-subrc <> 0.
write: 'SELECTION_VIEWS_FIND error code =', sy-subrc.
exit.
endif.
* 5. Get view #:
read table it_views with key auswg = 35 . "35 - Costing View 2
if sy-subrc = 0.
w_linex = sy-tabix.
* else.
* write: 'View', view, 'not found'.
* exit.
endif.
endform. " GET_VIEWPOS
*& Form CONVERT_DATE_EXTERNAL
* text
* --> p1 text
* <-- p2 text
form convert_date_external .
call function 'CONVERT_DATE_TO_EXTERNAL'
exporting
date_internal = itab-zpld1
importing
date_external = pdate
exceptions
date_internal_is_invalid = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " CONVERT_DATE_EXTERNAL
*& Form UPLOAD_DATA
* text
* --> p1 text
* <-- p2 text
form upload_data .
data : file_table type file_table occurs 0,
fwa type file_table,
filename type string,
rc type i.
call method cl_gui_frontend_services=>file_open_dialog
exporting
window_title = 'Open File'
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* MULTISELECTION =
* WITH_ENCODING =
changing
file_table = file_table
rc = rc
* USER_ACTION =
* FILE_ENCODING =
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
read table file_table index 1 into fwa.
filename = fwa-filename.
call function 'GUI_UPLOAD'
exporting
filename = filename
filetype = 'DAT'
* IMPORTING
* FILELENGTH =
tables
data_tab = itab
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
others = 6 .
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " UPLOAD_DATA
Regards,
Morris Bond.
Reward Points if Helpful. -
BDC for MM02 Internal comments - Not working
I have created a BDC that inputs internal comments using MM02. It moves the data in okay in the BDC. The data is there the way it was formated. Several lines of comments added. But after it saves the data - it takes all of the lines and appends them into one and fills up the lines. For example - enter: line 1, then enter line: 2. Instead of having 2 lines showing 1 on the first and 2 on the second - I get 1 lines howing both: 2.
Any ideas?Check this. I think you may like it. This program excepts the material number and changes the internal comment text. I am forcing two lines, when I check after executing this program, the text is there in two lines. Please see if you can use the BAPI instead of BDC.
report zrich_0003 .
data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: matlongtext type table of bapi_mltx with header line.
data: return type bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.
parameters: p_matnr type mara-matnr.
select single * from mara into xmara
where matnr = p_matnr.
headdata-material = xmara-matnr.
headdata-ind_sector = xmara-mbrsh.
headdata-matl_type = xmara-mtart.
<b>matlongtext-applobject = 'MATERIAL'.
matlongtext-text_name = p_matnr.
matlongtext-text_id = 'IVER'.
matlongtext-langu = sy-langu.
matlongtext-text_line = 'This is line 1'.
append matlongtext.
matlongtext-applobject = 'MATERIAL'.
matlongtext-text_name = p_matnr.
matlongtext-text_id = 'IVER'.
matlongtext-langu = sy-langu.
matlongtext-text_line = 'This is line 2'.
append matlongtext.</b>
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
importing
return = return
tables
<b> materiallongtext = matlongtext</b>
returnmessages = returnm.
Regards,
Rich Heilman
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d!
Maybe you are looking for
-
Regarding Workflow Error and Notification problem
Hi, I am working on Workflow. I imported data <b>first time</b> in Data Manager and created <b>new</b> workflow. Now while "Launching" this workflow it is showing error "<b>The record is currently used in workflow</b>". I was using this repository
-
Block Active X on Browser Preview (~!@#$%^&*)
Hello again... Whenever I attempt to preview web page design changes in my browser (IE7), the Block Active X header appears at the top of the browser window...warning me about possible malicious content...asking me to click for options...& then givin
-
I installed the latest updaet for my 3G iphone last night and now the apps e.g. Facebook, ebay... that need the internet to run don't work. I have check the settings and I'm hooked into my modem.
-
Call bpws:getVariableData from xslt
Hello, I need to access a global xml BPEL variable from my xslt script called by a ora:processXSLT function, from an assign block. In order to have this, I tried to call âbpws:getVariableDataâ inside the xslt, but I receive the following error at
-
New mac pro with fiber attached san storage
We have a digital media department that uses After Effects to produce content for different types of media boards, digital signage, post production etc. They start with Red 4K files which get edited in AE and rendered to different video formats. The