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 code

Former Member
0 Likes
442

hi,

i am new to abap ,i have a query, in selection screen there are three inputs,like cus no,ven no,po num, suppose ven no is not given as input(it is empty).i had to write a condition for that if ven no is not given then select it from some other table.hou can do this,can any body provide some code,

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
416

Hi Venkat

Please try to build a logic similar to below:

parameters: p_cus type kunnr,
            p_ven type lifnr,
            p_po  type ebeln.
data: tab type tabname.
            
start-of-selection.

   if p_ven is initial.
      tab = 'TABLE1'.
   else.
      tab = 'TABLE2'.
   endif.
   
   select fld1 fld2 
          into table itab
          from (tab)
          where (cond).

Kind Regards

Eswar

3 REPLIES 3
Read only

Former Member
0 Likes
416

hi Venkat,

WELCOME TO SDN...

at selection-screen.

select single * from lfa1 where lifnr = s_lifnr.
if sy-subrc <> 0.
  message e100 with ' No vendor exists in the specified table'.
endif.

Regards,

Santosh

Read only

Former Member
0 Likes
417

Hi Venkat

Please try to build a logic similar to below:

parameters: p_cus type kunnr,
            p_ven type lifnr,
            p_po  type ebeln.
data: tab type tabname.
            
start-of-selection.

   if p_ven is initial.
      tab = 'TABLE1'.
   else.
      tab = 'TABLE2'.
   endif.
   
   select fld1 fld2 
          into table itab
          from (tab)
          where (cond).

Kind Regards

Eswar

Read only

Former Member
0 Likes
416

parameters: p1 like pa0001-pernr,

p2 like pa0001-plans,

p3 like pa0001-begda.

start-of-selection.

if p1 is initial.

select single pernr into p1 from pa0001.

endif.

write p1.