Make your own free website on Tripod.com
SAP ABAP Programming, Functional and Basis Components Books


BAPI - Mass change MRP indicator

The MRP indicator for storage location does not change the MRP indicator in the material master that have already been saved before the change.  This ABAP BAPI (Business Application Programming Interfaces) program was created to mass change all the material master MRP indicator whenever the user want to.

REPORT ZMRPIND.
*
*  Author by  : SAP Hints and Tips on Configuration and ABAP/4 Programming
*                http://sapr3.tripod.com
*
TABLES: T001L,
        MARD.

DATA: BAPI_HEAD   LIKE BAPIMATHEAD,
      BAPI_MARD1  LIKE BAPI_MARD,
      BAPI_MARDX1 LIKE BAPI_MARDX,
      BAPI_RETURN LIKE BAPIRET2.

SELECT-OPTIONS:
            PLANT    FOR  MARD-WERKS OBLIGATORY MEMORY ID M01,
            MATERIAL FOR  MARD-MATNR MEMORY ID M02.

SELECT * FROM T001L WHERE WERKS IN PLANT.
   SELECT * FROM MARD WHERE WERKS  = T001L-WERKS
                        AND LGORT  = T001L-LGORT
                        AND MATNR IN MATERIAL.

    IF T001L-DISKZ = MARD-DISKZ.
       CONTINUE.
    ENDIF.

    BAPI_HEAD-MATERIAL   = MARD-MATNR.
    BAPI_HEAD-MRP_VIEW   = 'X'.

    BAPI_MARD1-PLANT     = MARD-WERKS.
    BAPI_MARD1-STGE_LOC  = MARD-LGORT.
    BAPI_MARD1-MRP_IND   = T001L-DISKZ.

    BAPI_MARDX1-PLANT    = MARD-WERKS.
    BAPI_MARDX1-STGE_LOC = MARD-LGORT.
    BAPI_MARDX1-MRP_IND  = 'X'.

    WRITE:/ BAPI_HEAD, BAPI_MARD1.

    call function 'BAPI_MATERIAL_SAVEDATA'
      exporting
        headdata                   = BAPI_HEAD
*       CLIENTDATA                 =
*       CLIENTDATAX                =
*       PLANTDATA                  =
*       PLANTDATAX                 =
*       FORECASTPARAMETERS         =
*       FORECASTPARAMETERSX        =
*       PLANNINGDATA               =
*       PLANNINGDATAX              =
        STORAGELOCATIONDATA        = BAPI_MARD1
        STORAGELOCATIONDATAX       = BAPI_MARDX1
*       VALUATIONDATA              =
*       VALUATIONDATAX             =
*       WAREHOUSENUMBERDATA        =
*       WAREHOUSENUMBERDATAX       =
*       SALESDATA                  =
*       SALESDATAX                 =
*       STORAGETYPEDATA            =
*       STORAGETYPEDATAX           =
      IMPORTING
        RETURN                     = BAPI_RETURN
*     TABLES
*       MATERIALDESCRIPTION        =
*       UNITSOFMEASURE             =
*       UNITSOFMEASUREX            =
*       INTERNATIONALARTNOS        =
*       MATERIALLONGTEXT           =
*       TAXCLASSIFICATIONS         =
*       RETURNMESSAGES             =
*       PRTDATA                    =
*       PRTDATAX                   =
*       EXTENSIONIN                =
*       EXTENSIONINX               =
          .

IF BAPI_RETURN-TYPE = 'E'.
   WRITE:/ BAPI_RETURN.
ENDIF.

   ENDSELECT.
ENDSELECT.

Back to Previous

Return to :-
SAP Hints and Tips on Configuration and ABAP/4 Programming