For retrieving Storage Location related data for a Material, you can use the following SAP ABAP function module.
SAP Storage Location related data for a Material.
MARD_GENERIC_READ_MATNR_PLANT
___________________________________________________________
KZRFB Indicator: Lock
MATNR Material
WERKS Plant
MAXTZ Maximum number of table lines
MATNR Material
WERKS Plant
MAXTZ Maximum number of table lines
____________________________________________________________
Values from Table
MARD Storage Location Data for Material
_____________________________________________________________
REPORT ZEX_STORAGELOC .
Parameter: p_matnr like MARD-MATNR,
p_werks like MARD-WERKS.
data: int_MARD TYPE TABLE OF MARD.
CALL FUNCTION 'MARD_GENERIC_READ_MATNR_PLANT'
EXPORTING
* KZRFB = ' '
MATNR = p_matnr
WERKS = p_werks
* MAXTZ = 0
TABLES
MARD_TAB = int_MARD
EXCEPTIONS
WRONG_CALL = 1
NOT_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Parameter: p_matnr like MARD-MATNR,
p_werks like MARD-WERKS.
data: int_MARD TYPE TABLE OF MARD.
CALL FUNCTION 'MARD_GENERIC_READ_MATNR_PLANT'
EXPORTING
* KZRFB = ' '
MATNR = p_matnr
WERKS = p_werks
* MAXTZ = 0
TABLES
MARD_TAB = int_MARD
EXCEPTIONS
WRONG_CALL = 1
NOT_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
See Also:
SAP Locating Plants for a Given Material
SAP get Plant Description For a given Material
No comments:
Post a Comment