on 06-17-2015 8:09 PM
Hi Experts,
With same document number,document type,Document part and document version,I want to upload 10,000 materials in object links in material master tab.
I have tried batch input recording only single material is assigning.
Please suggest me hoe to proceed.
Regards,
Gyan
Hi Gyan,
I think there is no standard solution for this. You will need a separate tool for this. Batch input will have some trouble because of the table control to handle thousands of entries and the performance will be sad, I think.
Background:
Every object link is stored in table DRAD. Links to material master use DOKOB = MARA.
Here is one example ...
So all you have to do is to write a little ABAP code to copy an already existing link by a new value of material master.
I did already such a development, see below.
The code works like this:
You have to choose an document information record with an already existing object link to a material master.
Then you have to upload a list of material master by using the multiple selection button ...
Use the green button to load a prepared list like this:
104124
104125
104160
104700
...
Note: there is sometimes an upload limit because of the memory. Perhaps you have to separate your 10.000 items on 3-5 single steps.
Then do an execution in test mode. No change will be written to the database.
If everything is fine, do a run without test mode flag.
After the run you will get a little protocol ...
That's all.
The program copies an existing link, updated the material master (MATNR) and creates a new entry for the document information record in the data base.
I copied the code in an attached text file, too.
Keep in mind: use the code at your own risk
REPORT zmad_dms.
TABLES: mara.
DATA: lt_matnr TYPE STANDARD TABLE OF matnr,
lv_matnr TYPE matnr,
ls_drad TYPE drad,
lv_result TYPE string,
lv_subrc TYPE sysubrc.
*****************************************************
* SELECTION SCREEN
*****************************************************
PARAMETERS: p_dokar TYPE dokar OBLIGATORY.
PARAMETERS: p_doknr TYPE doknr OBLIGATORY.
PARAMETERS: p_doktl TYPE doktl_d OBLIGATORY.
PARAMETERS: p_dokvr TYPE dokvr OBLIGATORY.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: so_matnr FOR mara-matnr.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_test TYPE flag DEFAULT 'X'.
*****************************************************
INITIALIZATION.
*****************************************************
*****************************************************
AT SELECTION-SCREEN.
*****************************************************
* select the first MARA oject link to fill link structure
SELECT SINGLE * FROM drad INTO ls_drad
WHERE dokar = p_dokar AND
doknr = p_doknr AND
doktl = p_doktl AND
dokvr = p_dokvr AND
dokob = 'MARA'.
* valid ?
IF sy-subrc <> 0.
MESSAGE e711(cfx_bi_ri_msg1). "Choose a valid document
ENDIF.
*****************************************************
START-OF-SELECTION.
*****************************************************
* select material master
SELECT matnr FROM mara INTO TABLE lt_matnr
WHERE matnr IN so_matnr.
* loop with each material master
LOOP AT lt_matnr INTO lv_matnr.
* set object link
ls_drad-objky = lv_matnr.
* change database
MODIFY drad FROM ls_drad.
lv_subrc = sy-subrc.
* check result
IF lv_subrc = 0.
CONCATENATE lv_matnr ': successful' INTO lv_result.
ELSE.
CONCATENATE lv_matnr ': error' INTO lv_result.
ENDIF.
* do the output
WRITE / lv_result.
* testmode or proceed booking ?
IF p_test IS INITIAL AND
lv_subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDLOOP.
Regards,
Markus
P.S. pls rate if this was helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.