Hi,

Some days before, I seen one post, adding Extra fields in MCBE(Material Analysis) At Standard T-Code, the person want to Add one extra field and he need to pick the data from the Marc table.(This is the Actual Requirement to him But he has not got any replies) So, The below document explains, the details about How to add columns and how to fetch data from Marc Table.

Task: Adding extra field in MCBE Report and Fetch the Maintain. Status (PSTAT) Field From the MARC table.

Step1: First We need to add field, for displaying in the report Layout , for this  We need to check, At which place Fields to be add.

/wp-content/uploads/2015/12/s1_850321.jpg

Step2: Go to Se11  and open the Structure  s039  and Append the structure In my case, i need only one field, I was added  maintain status field of Marc Like

   Below.

  ./wp-content/uploads/2015/12/s2_850331.png

Stpe3: Now Open the MCBE and  Check the Layout , You can able to see the New field

/wp-content/uploads/2015/12/s3_850332.png

Step4: Before Moving moving or enabling the column You have to do One more task. In the table TMC73  We need to maintain the column into the table. Other wise. the Newly added column will not activated You will get error message While moving from Left to Right.

/wp-content/uploads/2015/12/s4_850333.png

   Once Complete the above task You can move the column from Left to right. The column will be appear but there is not data. Now we need to write the code

   for getting the data from Marc. And need to append the standard Internal table declaration in the Source Code.

Step5: RMCB0300 This is the main program of the T-Code MCBE. It is having some included, Open the Main program and have a look At Include

           RMCB01TP  It is having declaration and Structures(Through the Enhancement spot we can write the code). If we wont do this step, The newly added              columns will not show in the source code.Exactly At the End of the Structure Declaration You need to add newly added column at Structure aus_s000.            Just have a  look on below image.

          s6.jgg.JPG

  We need to append one more place also in the code. As per the Standard source code. Please have a look below attached image. And Translate the      Highlighted Text to English You can understood. Why we are adding the structure in two places And activated the Enhancement spot in the code.

            /wp-content/uploads/2015/12/s7_850338.jpg

    Step6: Now Through the Custom Exit We can Fetch the data from the Marc and we can Make communicate to the Final internal table of the
    Standard Code.

    Custom Exit name : MCR00002 => Standard analyses: Key figure display
    Function Exit Name : EXIT_SAPLMCS2_001
    Include Name:  ZXMC0U03

   

    Create  a Project At Cmod And enable the include . And put the break point and check it. Whether the code is triggering or not.

             /wp-content/uploads/2015/12/s8_850339.jpg

Step7:  By using the Field Symbols We Can get the Material Code, From the Source code,

field-symbols : <fs_mc51> type any,

                 <fs_zzstatus> type pstat_d. 

field-symbols:<fs_dmatnr> type any.

data: stat type s039-zzstatus.

loop at t_aus_s000 assigning <fs_mc51>.

    assign component ‘objekt’ of structure <fs_mc51> to <fs_dmatnr>.  “for getting material code from the standard source code

   select single pstat from marc into stat where  matnr eq <fs_dmatnr>.  “fetching from pstat  from marc input matnr output pstat

    assign component ‘zzstatus’  of structure <fs_mc51> to <fs_zzstatus>.  “assing the zzstatus exactly like s039

    <fs_zzstatus> = stat.

endloop.

Step 8: In debugging check it, Whether it is, maintain status field value is picking from the marc or not.  The result will be look like below.

             /wp-content/uploads/2015/12/ff_850347.jpg

       

       

  

     Regards,

     NewB

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Sefa Kocali

    Hi,

    Thanks for document. But there is a very big error on user exit.

    You are selecting data from MARC. To select data from MARC you’ve to give Material and Plant. But you are giving material only and your code is select single. So if material is extended for another plant, select single will not work.

    I think, we should use plant also while fetching data from MARC. But I couldn’t find where to get plant 🙂

    Thanks.

    (0) 
    1. Kali Charan Post author

      Hi,

      Yes your correct, Plant wise i had not captured, If u need plant wise, First had u seen there is no column plant in the list layout i mean column, Am i correct. Which means After u select the plant either single or  N number. U r going to execute the report

      1)Material wise data will column

      2) There is no plant column as per my knowledge.

      3)So material wise data will come which means the result is all the plants based on the

         selection criteria it is showing.

      4)I hope mcbe is interactive report. which means, Just click on the Material. Plant wise data will come.

      5)After came result if u double click on material, you had written some code. in the exit. same exit will be triggered again u need to write the code. as per your requirement.I can sure exit will trigger./wp-content/uploads/2015/12/pf1_852648.png

      /wp-content/uploads/2015/12/pf_852649.png

      (0) 
      1. Sefa Kocali

        I think the values on the report is plant based.

        For example even I haven’t given any plant on selection screen, I can get the Valuation Class value. If valuation class is more than one, the result seems as ***.

        So the algorithm on the background is not so simple.

        Screenshot_2.png

        (0) 
        1. Kali Charan Post author

          The valuation class is not coming. if the two plants are having two diff valuation class.

          Have u observed val.Strkrec qty and val.strk iss qty values are combing.  So, it is summarizing. if u give n number of plants. if u give specific based on that plant it will come that plant only.

          (0) 
            1. Kali Charan Post author

              Hi,

              Suppose material  1000t  it is having two plant details.

              What i given the code if u check it. After execute the report it will come. i had not consider the plant. So, as per the tables which table is 1st line it will pick it . working.

              But if u double click on material storage location wise data will come.

              Here i had not written the code. Ok just change the code as per your requirement. in the exit. ok

              Bcz i had not noticed until u post the reply to this document ok. just change it it will work.

              (0) 
                1. Kali Charan Post author

                  Still i am thinking it is possible. what u expected, I had not written. But i think possible.

                  Please have a look on below image.

                  T_DRILLDOWN[]

                  This is the table After execute t-codem, Internal table rows are 1.

                  means first stage like below
                  material     col1   col2

                  matcode1   0.00  0.1

                  Now you are double click on the material code. plant wise detail will come stage 2.

                  Now,

                  T_DRILLDOWN[]  no of rows are 2.

                  Same thing like stage3.

                  Here important thing is we need to get material code and plant in the line.

                  At first stage if internal table is  1 take the material code.

                  At second stage if internal table is 2 take the plant  code.

                  save the material code and plant details in the variables then fetch your variable from the marc. apply the same logic what i written  previously.

                  /wp-content/uploads/2015/12/logic_852803.png

                  (0) 

Leave a Reply