2009 Jun 12 12:41 PM
hi
plz c the below code...
my prblm is i want to store the value of wa_final-preis into new_xeipa-preis if there is only one ebeln...
if there are more procss orders then i want to save the first value to new_xeipa-preis wn second record comes then new_xeipa-preis should be replaced by new value and old_xeipa-preis replaced by old value....
how to do this?
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
IF sy-subrc is INITIAL.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.
2009 Jun 12 12:46 PM
Hi Smitha,
Check the below given code.
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
IF sy-subrc is INITIAL.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
" First time this value is not populated. When the second value comes in,
" New value gets populated in OLD variable and New value is replaced with the latest.
*IF idx NE 1.*
*old_xeipa-preis = new_xeipa-preis.*
*ENDIF.*
*new_xeipa-preis = wa_xeipa-preis.*
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.
ENDLOOP.I hope this is what you were looking for.
Thanks & Regards,
Ram.
Edited by: ram Kumar on Jun 12, 2009 5:16 PM
2009 Jun 12 12:46 PM
Hi Smitha,
Check the below given code.
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
IF sy-subrc is INITIAL.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
" First time this value is not populated. When the second value comes in,
" New value gets populated in OLD variable and New value is replaced with the latest.
*IF idx NE 1.*
*old_xeipa-preis = new_xeipa-preis.*
*ENDIF.*
*new_xeipa-preis = wa_xeipa-preis.*
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.
ENDLOOP.I hope this is what you were looking for.
Thanks & Regards,
Ram.
Edited by: ram Kumar on Jun 12, 2009 5:16 PM
2009 Jun 12 12:53 PM
i think instead of read table u must loop .
data:cnt type sy-tabix.
cnt = 0.
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
clear cnt.
loop at xeina INTO wa_xeina where infnr = wa_xeipa-infnr.
add 1 to cnt.
if cnt = 1.
new_xeipa-preis = wa_xeipa-preis.
else.
old_xeipa-preis = new_xeipa-preis.
new_xeipa-preis = wa_xeipa-preis.
endif.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.
endloop.
2009 Jun 12 12:57 PM
Hi,
Please try using at end of .. or at new additions...
Here, is a sample code...
LOOP AT xeipa INTO wa_xeipa.
lv_count = lv_count + 1.
AT END OF ebeln.
gs_total-cov_total = lv_count.
APPEND gs_total TO gt_total.
CLEAR : gs_total,
lv_count,
gs_details.
ENDAT.
ENDLOOP.
Hope it gives you some idea.. Let me know if your problem still persits.
2009 Jun 12 12:59 PM
>
> hi
>
> plz c the below code...
> my prblm is...
"Please see the below code...
My problem is..."
Please resist the temptation to use shortened "text-message/SMS" type words. It is against the forum rules. Not all contributers are fluent in English and so cannot understand shortened words. Please be respectful to them.
matt
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |