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: 

select statement to get value

Former Member
0 Kudos

hi,

i need to get value field from table bseg for the same document number.

for the same document number, there are several line item. i just want to get :

where hkont = '400000' get the value and put in wa_itab-dmbtr1.

where hkont = '700000' get the value. and put in wa_itab-dmbtr2.

may i know how to use the select statement to get both value?

thanks

1 ACCEPTED SOLUTION

bpawanchand
Active Contributor
0 Kudos

Hi

where hkont = '400000' get the value and put in wa_itab-dmbtr1.

where hkont = '700000' get the value. and put in wa_itab-dmbtr2.


         Select 
             field1
             field2
             from <tablename>
             into ( w_temp)
             where HKONT eq '400000' OR HKONT EQ '700000'.
    if HKONT EQ '400000' .
          wa_itab-dmbtr1 = w_temp.   
   elseif HKONT EQ '700000' 
      
    wa_itab-dmbt2 = w_temp.
  endif.
  endselect.
   " You need to use OR and one temporary variable 

.

Regards

Pavan

4 REPLIES 4

Former Member
0 Kudos

Hi,

Select dmbtr from bseg into ( wa_itab-dmbtr1 ) where belnr = p_belnr and ( hkont = '700000' or hkont = '400000' ).

endselect.

Regards

Lekha.

bpawanchand
Active Contributor
0 Kudos

Hi

where hkont = '400000' get the value and put in wa_itab-dmbtr1.

where hkont = '700000' get the value. and put in wa_itab-dmbtr2.


         Select 
             field1
             field2
             from <tablename>
             into ( w_temp)
             where HKONT eq '400000' OR HKONT EQ '700000'.
    if HKONT EQ '400000' .
          wa_itab-dmbtr1 = w_temp.   
   elseif HKONT EQ '700000' 
      
    wa_itab-dmbt2 = w_temp.
  endif.
  endselect.
   " You need to use OR and one temporary variable 

.

Regards

Pavan

Former Member
0 Kudos

SELECT *

FROM bseg

INTO TABLE it_tab

WHERE hkont IN (''400000' ,'700000' ).

and then pass it to the work area..........

Regards

Anbu

Former Member
0 Kudos

If you are using select........endselect, try this,


SELECT hkont
       dmbtr
  FROM bseg
  INTO (w_hkont,
        w_dmbtr)
 WHERE hkont IN ('400000','700000').

  IF w_hkont EQ '400000'.

    wa_itab-dmbtr1 = w_dmbtr.

  ELSEIF w_hkont EQ '700000'.

    wa_itab-dmbtr2 = '700000'.

  ENDIF.

ENDSELECT.