2008 Dec 05 11:33 PM
I am trying to use.
/: IF &S_DATE& > &RF140-SALDO&.
/: &S_VALUE1& = &RF140-WRSHB&+&S_VALUE1.
/:endif.
I want to add up all into &S_VALUE1& and want to display at the end.?
I get the error as
AND, OR or end of condition expected
Control commands were not closed within the text element
IF
Is there some thing which I am missing..?let me know.
Thanks,
2008 Dec 06 2:18 AM
Use subroutine pools in Script.
for more infor you can search in SCN with term subroutine pools
2008 Dec 06 5:28 AM
HI
use following code
if you smartforms/sapscript
use program line
IF S_DATE > RF140-SALDO
S_VALUE1 = RF140-WRSHB+S_VALUE1.
endif.
and after retrive taht value in smartforms
Regards
Sam
2008 Dec 08 9:52 AM
Hi,
I think there must be some condition for which you are adding these values like for the same values of a field add these .Make use of the command PERFORM in Script:
IN Script:
DEFINE &S_VALUE1& = ' '
IF &S_DATE& > &RF140-SALDO&.
PERFORM get_total IN PROGRAM <xyz>
USING &RF140-WRSHB&
CHANGING &S_VALUE1&
endif.
in Program:
"Declare a global variable of type RF140-WRSHB.
g_WRSHB_t type RF140-WRSHB.
FORM get_total TABLES input_table STRUCTURE itcsy
output_table STRUCTURE itcsy.
LOOP AT input_table.
CASE input_table-name.
WHEN 'RF140-WRSHB'.
g_wrshb = input_table-value.
WHEN OTHERS.
ENDCASE.
if g_int = 0. "for the 1st record
g_WRSHB_t = g_wrshb.
READ TABLE output_table WITH KEY name = 'S_VALUE1'.
if sy-subrc = 0.
MOVE g_wrshb TO output_table-value.
MODIFY output_table INDEX sy-tabix.
CLEAR output_table.
endif.
else "For 2nd rec onwards
g_WRSHB_t = g_wrshb + g_WRSHB_t .
READ TABLE output_table WITH KEY name = 'S_VALUE1'.
if sy-subrc = 0.
MOVE g_wrshb_t TO output_table-value.
MODIFY output_table INDEX sy-tabix.
CLEAR output_table.
endif.
endif.
g_int = g_int + 1.
ENDFORM.
2008 Dec 08 6:50 PM