‎2009 Dec 03 9:52 AM
Hi Gurus,
Every time we create a material we have to extend it in all plants and in all storage location of every plant.
The steps that we are using are: We first create the material to a plant and a storage location using transaction
MM01. Then we use transaction mm17 and we extend the materials in all plants automatically.
Then we use transaction MMSC to extend material to every storage location. We enter the material code, the plant code and after hitting enter we fill the fields with the storage locations of the plant where we want to extend material to. We have 9 plants and 3 storage location on every plant, so we do this procedure (mmsc) 9 x 3 = 27 times.
Is there a way to write code to fill automatically the fields in MMSC transcaction from a file so that can automate the procedure? Any Ideas how to start?
Thank you in advance
‎2009 Dec 04 1:02 PM
Hi!
Here's an example of this stuff, 100% working, but of course you have to change the BDC part for your code...
REFRESH: gt_bdcdata.
PERFORM bdc_dynpro USING 'ZMFI_AA_KTGH' '9502'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTER'.
PERFORM bdc_field USING 'ANLZ-KOSTL' gs_change_asset-kostl.
PERFORM bdc_field USING 'ANLZ-ADATU' gs_change_asset-bdatu.
PERFORM bdc_field USING 'ANLZ-PERNR' gs_change_asset-pernr.
PERFORM bdc_field USING 'ANLZ-STADT' gs_change_asset-stadt.
PERFORM bdc_field USING 'ANLZ-XSTIL' gs_change_asset-xstil.
PERFORM bdc_field USING 'ANLZ-RAUMN' gs_change_asset-raumn.
PERFORM bdc_dynpro USING 'ZMFI_AA_KTGH' '9502'.
PERFORM bdc_field USING 'BDC_OKCODE' 'DUMMY_OK_CODE'.
MOVE 'E' TO lv_mode.
CALL TRANSACTION 'ZMFIAA_MOD' USING gt_bdcdata
MODE lv_mode.It is very important to give a 'DUMMY_OK_CODE' where you wanted to stop the processing. It is because the dummy ok code will cause a BDC error and the process will stop there and you'll get back the control.
Regards
Tamá
‎2009 Dec 04 11:21 AM
I have start writing an abap program using the following code:
CALL TRANSACTION 'MMSC' AND SKIP FIRST SCREEN.
SET parameter ID 'MAT' FIELD zmatnr. "field in first screen
SET parameter ID 'WRK' FIELD '1100'. "field in first screen
SET parameter ID 'LAG' FIELD '1120'. "field in second screen
In the second screen there are many fields with the same parameter id 'LAG'. I can't pass values to second screen probably because there are many fields with the same parameter id.
Can you help?
how can I save the transaction at the end?
Thanks.
‎2009 Dec 04 11:25 AM
Hello,
If you find that you will have to use CALL TRANSACTION with fields that have no parameter id or same parameter id for different fields, you could probably try creating a partical BDC recording the transaction till the point where user interaction is required and using the mode 'E'.
Vikranth
‎2009 Dec 04 12:57 PM
‎2009 Dec 04 11:26 AM
‎2009 Dec 04 1:02 PM
Hi!
Here's an example of this stuff, 100% working, but of course you have to change the BDC part for your code...
REFRESH: gt_bdcdata.
PERFORM bdc_dynpro USING 'ZMFI_AA_KTGH' '9502'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTER'.
PERFORM bdc_field USING 'ANLZ-KOSTL' gs_change_asset-kostl.
PERFORM bdc_field USING 'ANLZ-ADATU' gs_change_asset-bdatu.
PERFORM bdc_field USING 'ANLZ-PERNR' gs_change_asset-pernr.
PERFORM bdc_field USING 'ANLZ-STADT' gs_change_asset-stadt.
PERFORM bdc_field USING 'ANLZ-XSTIL' gs_change_asset-xstil.
PERFORM bdc_field USING 'ANLZ-RAUMN' gs_change_asset-raumn.
PERFORM bdc_dynpro USING 'ZMFI_AA_KTGH' '9502'.
PERFORM bdc_field USING 'BDC_OKCODE' 'DUMMY_OK_CODE'.
MOVE 'E' TO lv_mode.
CALL TRANSACTION 'ZMFIAA_MOD' USING gt_bdcdata
MODE lv_mode.It is very important to give a 'DUMMY_OK_CODE' where you wanted to stop the processing. It is because the dummy ok code will cause a BDC error and the process will stop there and you'll get back the control.
Regards
Tamá