Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

fill the default value in ranges internal table

Former Member
0 Kudos
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.

6 REPLIES 6

Former Member
0 Kudos

hi,

try this one

rg_ord-sign = 'I'.

rg_ord-option = 'EQ'.

MODIFY rg_ord FROM rgord TRANSPORTING sign option

cheers,

sasi

jayanthi_jayaraman
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

hi,

try this one

MODIFY rg_ord FROM rgord TRANSPORTING sign option

where sign = space.

cheers,

sasi