11-14-2005 5:21 AM
ranges: rg_ord for vbap-vbeln.
REFRESH rg_ord[].
SELECT vbeln AS low
INTO CORRESPONDING FIELDS OF TABLE rg_ord
FROM vbap
WHERE vbeln . . . . some condition.
IF rg_ord[] IS NOT INITIAL.
LOOP AT rg_ord.
rg_ord-sign = 'I'.
rg_ord-option = 'EQ'.
MODIFY rg_ord TRANSPORTING sign option.
ENDLOOP.
CONCATENATE cond_syntax ' vbap~vbeln in rg_ord'
INTO cond_syntax SEPARATED BY space.
ENDIF.
<b>IS there anyway i can avoid the loop</b>. I can think of modifying the sql like this
SELECT
vbeln AS low
'I' as sign
'EQ' as option
INTO CORRESPONDING FIELDS OF TABLE rg_ord
FROM vbap
WHERE vbeln . . . . some condition.
but regrettably open sql is not allowing literals into the select list.
11-14-2005 5:30 AM
hi,
try this one
rg_ord-sign = 'I'.
rg_ord-option = 'EQ'.
MODIFY rg_ord FROM rgord TRANSPORTING sign option
cheers,
sasi
11-14-2005 5:31 AM
Hi,
I think you only to sign to be 'I' and option to be 'EQ'.
your code should be..
if not rg_ord[] is initial.
rg_ord-sign = 'I'.
rg_ord-option = 'EQ'.
MODIFY rg_ord TRANSPORTING sign option where value ne space.
*here since you are not modifying the value,the value remains the same
endif.
You cannot code as you stated in SQL.
If you make your code as
SELECT
vbeln INTO CORRESPONDING FIELDS OF TABLE rg_ord
FROM vbap
WHERE vbeln in rg_ord.
will handle the for the condition you specified.
Kindly reward points by clicking the star on the left of reply,if it helps.
Message was edited by: Jayanthi Jayaraman
11-14-2005 5:37 AM
If I understood your question correclty then I don't think you populate a range without LOOPing. In your code you are selecting sales orders and populating into a range, so I don't think you can avoid LOOPing. Alterntively you can use select ... endselect as below
select vbeln into rg_ord-low from vabp where ... some condition
rg_ord-sign = 'I'.
rg_ord-option = 'EQ'.
append rg_ord.
endselect.
Cheers,
Satya
11-14-2005 5:38 AM
Hi,
There is no need for loop in your code.
See this sample code for filling values in Ranges:
RANGES:
r_matnr for mara-matnr.
Filling the range is accomplished by:
r_matnr-low = '000000000000000001'.
r_matnr-low = '000000000000009999'.
r_matnr-option = 'BT'.
r_matnr-sign = 'I'.
APPEND r_matnr.
The selection is then accomplished by:
SELECT * FROM mara WHERE matnt in r_matnr.
Best Regards,
Anjali
11-14-2005 5:50 AM
sasikumar palanichamy :
MODIFY rg_ord FROM rgord TRANSPORTING sign option
resulting in dump
Jayanthi Jayaraman :
Modifying ur statement
MODIFY rg_ord TRANSPORTING sign option where value ne space.
as
MODIFY rg_ord TRANSPORTING sign option where low ne space.
is acheiving the goal here
Nekenti Vera Venkata Satyanarayana:
My goal was to avoid loop and select..end select is another kind of loop only
Anjali Devi: Sorry, but my question was directed towrds some other prob
11-14-2005 7:10 AM
hi,
try this one
MODIFY rg_ord FROM rgord TRANSPORTING sign option
where sign = space.
cheers,
sasi