‎2006 May 31 5:11 PM
Hello guys,
i have one more problem.
Please take a look at my code..
FORM get_unit_price TABLES in_par STRUCTURE itcsy
out_par STRUCTURE itcsy.
DATA : lv_fkimg TYPE i,
lv_netwr TYPE i,
lv_netpr TYPE i.
*-- Initialize the values
CLEAR : lv_fkimg,
lv_netwr,
lv_netpr.
*-- Get the Incoming Values
READ TABLE in_par WITH KEY 'VBDPR-NETWR'.
TRANSLATE in_par-value USING ', '.
CONDENSE in_par-value NO-GAPS.
IF sy-subrc EQ 0.
lv_netwr = in_par-value.
ENDIF.
READ TABLE in_par WITH KEY 'VBDPR-FKIMG'.
TRANSLATE in_par-value USING ', '.
CONDENSE in_par-value NO-GAPS.
IF sy-subrc EQ 0.
lv_fkimg = in_par-value.
ENDIF.
lv_netpr = lv_netwr / lv_fkimg.
READ TABLE out_par WITH KEY 'W_PRICE'.
IF sy-subrc EQ 0.
out_par-value = lv_netpr.
APPEND out_par .
ENDIF.
ENDFORM. "get_unit_price
Here.. lv_netpr does have a value 20
but is not being assigned to out_par-value. It remains empty. any suggestions would be welcome.
Regards
‎2006 May 31 5:16 PM
‎2006 May 31 5:14 PM
Well,
out_par-value = lv_netprsets the value of lv_netpr to teh value of out_par-value, not vice versa!!!
‎2006 May 31 5:16 PM
‎2006 May 31 5:18 PM
Hi Rich,
I had already tried uSing MODIFY .. It didnt work either.
Regards
Message was edited by: Nishant Gupta
‎2006 May 31 5:35 PM
‎2006 May 31 5:36 PM
‎2006 May 31 5:38 PM
‎2006 May 31 5:40 PM
Try this.
DATA: l_index LIKE sy-tabix.
READ TABLE out_par WITH KEY 'W_PRICE'.
IF sy-subrc EQ 0.
l_index = sy-tabix.
out_par-value = lv_netpr.
MODIFY out_par INDEX l_index.
ENDIF.I meant l_index instead of sy-index and lost some points in the process!!!
Message was edited by: Srinivas Adavi
‎2006 May 31 5:41 PM
i checked it in debugging mode....
Sy-subrc is 0.
and i used sy-tabix, not sy-index..
Out_par table has no value in its value field.
‎2006 May 31 5:45 PM
‎2006 May 31 5:47 PM
no it is not moving....
regards
Message was edited by: Nishant Gupta
‎2006 May 31 5:47 PM
The problem is that you can see it. It is there, but to the right a bit. The reason is because the out_par-value field is 255 characters. You can use the SHIFT statement to get rid of all of the blank spaces. then you will be able to see the value for l_netpr.
Please add the following code.
READ TABLE out_par WITH KEY 'W_PRICE'.
IF sy-subrc EQ 0.
out_par-value = lv_netpr.
<b>shift out_par-value left deleting leading space.</b>
Modify out_par index sy-tabix.
ENDIF.Regards,
Rich Heilman
Message was edited by: Rich Heilman
‎2006 May 31 5:53 PM
!!!!! thanks Rich..why was this happening? have given u 26 points for this.
Message was edited by: Nishant Gupta
‎2006 May 31 5:59 PM
‎2006 May 31 6:00 PM
Here is a sample program to better illistrate.
report zrich_0001 line-size 255.
data: out_par type table of itcsy with header line.
data: l_netpr type i value '20'.
out_par-value = l_netpr.
write:/ 'Check this out, OUT_PAR-VALUE is way out there --->'.
write:/ l_netpr.
write:/ out_par-value.
skip 2.
write:/ 'Getting rid of the space will fix it'.
shift out_par-value left deleting leading space.
write:/ l_netpr.
write:/ out_par-value.
check sy-subrc = 0.
Regards,
Rich Heilman
‎2006 May 31 6:05 PM
‎2006 May 31 5:34 PM
hi
why dont you try this
wa_outpar type itcsy.
read table out_par into wa_outpar with key 'W_PRICE'.
wa_outpar-value = lv_netpr.
modify outpar from wa_outpar transporting value.
Hope this works