2011 Oct 06 3:23 PM
Hello,
In a query that I'm writing I have batch number (MCHB-CHARG) and have to find the material document (MSEG-MBLNR) that contains this batch (to print out copy of a label that attached to the material document).
I saw that in MSEG there is a field of CHARG but it's not key and not in standart indexes,
so because it's a huge table, I don't want to do direct select from it.
In the other way, the field MBLNR doesn't exists in MCHA nor MCHB tables.
Do anyone know how can I do this linkage ? is there any appropriate BAPI or standart function ?
Thank you,
Kind Regards,
Amit Berku
2011 Oct 07 3:18 AM
Amit,
No need to create new index on such a large table like MSEG for this requirement atleast.
Select matnr werks lgort charg from mchb into table lt_mchb where charg = ' ...........'.
select * from mseg into table lt_mseg for all entries in lt_mchb
where matnr = lt_mseg-matnr.
werks = ....
lgort = .............
This will use the partial secondary index 'M' of MSEG and should be Fast enough. It is almost the same as Srikant mentioned but I don't feel the need of using MCH1.
Regards,
Diwakar
Amit,
No need to create new index on such a large table like MSEG for this requirement atleast.
Select matnr werks lgort charg from mchb into table lt_mchb where charg = ' ...........'.
select * from mseg into table lt_mseg for all entries in lt_mchb
where matnr = lt_mseg-matnr.
werks = ....
lgort = .............
This will use the partial secondary index 'M' of MSEG and should be Fast enough. It is almost the same as Srikant mentioned but I don't feel the need of using MCH1.
Regards,
Diwakar
2011 Oct 06 4:34 PM
Hi ,
1. U can create a secondary index in the table mseg with the field CHARG , LGORT . Then we can link
MSEG-CHARG = MCHB-CHARG
MSEG-LGORT =MCHB-LGORT
Plant , material , company code , storage location are the primary key fields of the table MCHB.
The only problem with secondary index is it might increase the data load on the system
2. We can set automatic external serial number in migo but this is not a direct link
http://wiki.sdn.sap.com/wiki/display/ABAP/HowtosetautomaticexternalserialnumberinMigo
Thanks,
Rajat Kumar Sharma
2011 Oct 06 7:21 PM
Hi Amit,
Try with the following LINKAGES
LINK1 LNK2 LINK3
MSEG-MATNR MCHB-MATNR MCH1-MATNR
MSEG-WERKS MCHB-WERKS MCH1-CHARG
MSEG-LGORT MCHB-LGORT
MSEG-CHARG MCHB-CHARG
and GET
MSEG-MBLNR
MSEG-MJAHR
Try it out it may work
Revert if found any alternate solution
Thanks
Sri
2011 Oct 07 3:18 AM
Amit,
No need to create new index on such a large table like MSEG for this requirement atleast.
Select matnr werks lgort charg from mchb into table lt_mchb where charg = ' ...........'.
select * from mseg into table lt_mseg for all entries in lt_mchb
where matnr = lt_mseg-matnr.
werks = ....
lgort = .............
This will use the partial secondary index 'M' of MSEG and should be Fast enough. It is almost the same as Srikant mentioned but I don't feel the need of using MCH1.
Regards,
Diwakar
2011 Oct 09 7:18 AM
Hello Diwakar,
Thank you for your quick answer, I didn't think of this direction, you solved my question.
Kind Regrads,
Amit Berku
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |