ABAP TABLO İÇİNDE KAYIT ARAMAK


data : begin of it_dd03l_one occurs 0,
         tabname   type dd03l-tabname,
         fieldname type dd03l-fieldname,
         keyflag   type dd03l-keyflag,
       end of it_dd03l_one.
data : begin of it_dd03l_two occurs 0,
         tabname   type dd03l-tabname,
         fieldname type dd03l-fieldname,
         keyflag   type dd03l-keyflag,
       end of it_dd03l_two.
data : begin of it_details occurs 0,
         tabname   type dd03l-tabname,
         keyfl1    type dd03l-keyflag,
         keyfl2    type dd03l-keyflag,
         ddtext    type dd02t-ddtext,
       end of it_details.
tables : dd03l, dd02l.
parameters : p_field1 type dd03l-fieldname,
             p_field2 type dd03l-fieldname.
parameters : P_struc radiobutton group rb1,
             P_table radiobutton group rb1,
             P_all   radiobutton group rb1.

select-options s_search for dd03l-tabname.

select tabname
       fieldname
       keyflag
  from dd03l
  into table it_dd03l_one
 where tabname   in s_search
   and fieldname =  p_field1
   and as4local = 'A'.

select tabname
       fieldname
       keyflag
  from dd03l
  into table it_dd03l_two
 where tabname   in s_search
   and fieldname =  p_field2
   and as4local = 'A'.

loop at it_dd03l_one.
  if p_table = 'X'.
    select single *
      from dd02l
     where tabname = it_dd03l_one-tabname
       and tabclass <> 'INTTAB'.
     if sy-subrc <> 0.
       continue.
     endif.
  elseif p_struc = 'X'.
    select single *
      from dd02l
     where tabname = it_dd03l_one-tabname
       and tabclass = 'INTTAB'.
     if sy-subrc <> 0.
       continue.
     endif.
  endif.
  read table it_dd03l_two with key tabname = it_dd03l_one-tabname.
  if sy-subrc = 0.
    it_details-tabname = it_dd03l_one-tabname.
    it_details-keyfl1  = it_dd03l_one-keyflag.
    it_details-keyfl2  = it_dd03l_two-keyflag.
    select single ddtext
      from dd02t
      into it_details-ddtext
     where tabname = it_details-tabname
       and ddlanguage = 'EN'
       and AS4local   = 'A'.
    append it_details.
    clear  it_details.
  endif.
endloop.
data : w_text1(30) type c,
       w_text2(30) type c.
concatenate 'Field' p_field1 'Key in table?' into w_text1 separated by space.
concatenate 'Field' p_field2 'Key in table?' into w_text2 separated by space.
write : /(30) 'Table Name'        color col_heading,
         (30) w_text1 color col_heading,
         (30) w_text2 color col_heading,
         (60) 'Table Description' color col_heading.
sort it_details by tabname.
loop at it_details.
  write :/ it_details-tabname  color col_key hotspot on,
          46 it_details-keyfl1 as checkbox,
          76 it_details-keyfl1 as checkbox,
          94 it_details-ddtext color col_normal.
  hide it_Details-tabname.
endloop.
at line-selection.
  set parameter id 'DTB' field it_details-tabname.
  call transaction 'SE11' and skip first screen.