Application Development and Automation 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: 
Read only

select statement to get value

Former Member
0 Likes
638

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
Read only

bpawanchand
Active Contributor
0 Likes
611

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
Read only

Former Member
0 Likes
611

Hi,

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

endselect.

Regards

Lekha.

Read only

bpawanchand
Active Contributor
0 Likes
612

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

Read only

Former Member
0 Likes
611

SELECT *

FROM bseg

INTO TABLE it_tab

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

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

Regards

Anbu

Read only

Former Member
0 Likes
611

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.