cancel
Showing results for 
Search instead for 
Did you mean: 

How to update custom table in AMDP BADI of MD01

scj1234
Participant
0 Kudos

Hi,

We have SAP S/4 HANA 1909 system.

Requirement is to update custom Z table during the execution of MD01n transaction. We found the relevent BADI "PPH_MRP_RUN_BADI" . Method is IF_PPH_MRP_RUN_BADI~MDPS_ADJUST. I have written below code to update the custom table in this method

METHOD if_pph_mrp_run_badi~mdps_adjust
BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
options read-only.

:lt_mdps.INSERT ( ( '200' , '4401' ), 1 );

:lt_mdps.INSERT ( ( '200' , '4403' ), 2 );

INSERT INTO zldt_pp_mdps1 SELECT * FROM :lt_mdps;

ENDMETHOD.

Table ZLDT_PP_MDPS1 has two fields MANDT and WERKS.

While executing the MD01n transaction this code is causing the runtime error since method MDPS_ADJUST is read-only. I tried to remove READ-ONLY statement from method declaration but it is still ending up in run time error.

Please suggest how to fix this issue.

Thank You

Saurabh

View Entire Topic
former_member15471
Participant
0 Kudos

Hi Saurabh,

Since AMDP has a read only mode for coding purposes, what you can do is that you can write an ABAP code and then you can call the above AMDP method in your ABAP Class then make your modifications there.