Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8644

Re: BADI for MIRO

$
0
0

You are absolutely right and I should not to try use importing parameters, but I could do something.

 

data: begin of wa_tab,          ebelp type 
ekpo-ebelp,          netpr type ekpo-netpr,          MENGE type 
ekpo-MENGE,          DMBTR type ekbe-DMBTR,        end of wa_tab,        begin of wa_tab1,          ebelp type ekbe-ebelp,          DMBTR 
type ekbe-DMBTR,          SHKZG type ekbe-SHKZG,        end of 
wa_tab1,        begin of wa_tab3,          ebelp type ekbe-ebelp,          DMBTR type ekbe-DMBTR,        end of wa_tab3,        begin of 
wa_tab2,          belnr type rseg-belnr,          ebeln type 
rseg-ebeln,          ebelp type rseg-ebelp,          wrbtr type 
rseg-wrbtr,          summa type rseg-wrbtr,        end of wa_tab2.  data: tab LIKE TABLE OF wa_tab,        tab1 LIKE TABLE OF wa_tab1,        tab2 LIKE TABLE OF wa_tab2,        tab3 LIKE TABLE OF wa_tab3.  
type-pools mmcr.  data: ydrseg type table of mmcr_drseg.  field-symbols: <fs> like ydrseg.  field-symbols: <s> type mmcr_drseg.  
field-symbols: <s1> type mmcr_drseg.  data: sss(40).  sss = 
'(SAPLMR1M)YDRSEG[]'.  assign (sss) to <fs>.  read table <fs> index 1 assigning <s1>.  BREAK-POINT.  if sy-tcode <> 'MR8M'.    select ebelp netpr menge into CORRESPONDING FIELDS OF 
TABLE tab from ekpo where ebeln = <s1>-ebeln.    select * from ekbe  into CORRESPONDING FIELDS OF TABLE tab1 where ebeln = <s1>-ebeln and VGABE = 2.    loop at <fs> assigning <s>.      wa_tab3-ebelp = <s>-ebelp.      if <s>-SHKZG = 'H'.        wa_tab3-dmbtr = 
-1 * <s>-NETWR.      else.        wa_tab3-dmbtr = <s>-NETWR.      endif.      COLLECT wa_tab3 into tab3 .    
endloop.    loop at <fs> assigning <s>.      READ TABLE tab 
into wa_tab WITH KEY ebelp = <s>-ebelp.      wa_tab-DMBTR = 
wa_tab-netpr * wa_tab-menge.      if sy-subrc = 0.        loop at tab1 
into wa_tab1 where ebelp = <s>-ebelp.          if wa_tab1-SHKZG = 
'H'.            wa_tab1-dmbtr = -1 * wa_tab1-dmbtr.          endif.          wa_tab-DMBTR = wa_tab-DMBTR - wa_tab1-dmbtr.        endloop.        READ TABLE tab3 into wa_tab3 WITH KEY ebelp = <s>-ebelp.        
wa_tab-DMBTR = wa_tab-DMBTR - wa_tab3-dmbtr.        if wa_tab-DMBTR <= 
0.          <s>-erekz = 'X'.        endif.      endif.    
endloop.  else.    loop at <fs> assigning <s>.      <s>-erekz = ''.    endloop.  endif.8M

I have written a few kod and it working, but I  was not able to do with transaction MR8M. I wanted when the document would be reversed the tik would be put away. If somebody has thoughts about this I will be happy.


Viewing all articles
Browse latest Browse all 8644

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>