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

ABAP Coding issue

Former Member
0 Likes
877

Hi Abapers,

I am new to ABAP, I am in the process of learning.

I want to do

IF KNVK-PAFKT = Z1

 select single smtp_addr FROM adr6 INTO v_smtp_addr
                          WHERE ADDRNUMBER =   v_adrnr.
Endif.

But i am able to get the EMail without IF condition, waht else I need to do if I want to fulfil the IF condition.

Thanks in Advance,

Rishik.

7 REPLIES 7
Read only

SujeetMishra
Active Contributor
0 Likes
839

Hello Rishik,

Please do like below :

IF KNVK-PAFKT = 'Z1'.

select single smtp_addr FROM adr6 INTO v_smtp_addr

WHERE ADDRNUMBER = v_adrnr.

Endif.

Regards,

Sujeet

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
839

Hi,

Always check the values using quotes:-


IF KNVK-PAFKT = 'Z1'. "<--refer this
 select single smtp_addr FROM adr6 INTO v_smtp_addr
                          WHERE ADDRNUMBER =   v_adrnr.
Endif.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
839

I did like that but I forgot put it in the post. I don't have any syntax errors, but these are picking from different tables

i.e KNVK and ADR6

do I need to do the select single for KNVK-PAFKT?

Thanks,

Rishik.

Edited by: Rishik on Oct 27, 2009 4:33 AM

Read only

Former Member
0 Likes
839

you need to select values from table knvk in a work area based on your requirement

then use wa_knvk-PAFKT in if condition

Read only

0 Likes
839

Hi,

Can you plz eloberate it for me.

Thanks in Advance,

Rishik.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
839

Hi,

Use CLEAR statement before using SELECT


CLEAR v_smtp_addr.

IF KNVK-PAFKT = 'Z1'.
 select single smtp_addr FROM adr6 INTO v_smtp_addr
                          WHERE ADDRNUMBER =   v_adrnr.

  IF sy-subrc NE 0. "<--no record found
    CLEAR v_smtp_addr.
  ENDIF.
ENDIF.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
839

There would be some condition based on which you would have to fetch from KNVK table.

May be on the basis of partner number PARNR

Select single PAFKT from KNVK into v_pafkt

where PARNR = some value

now check

if v_pafkt = 'K1'.

select query

endif.