SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Example showing list handling in ABAP List Processor



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> List Generation, LDB, Spool Process, SAP Query, Report Painter
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Mon Feb 25, 2008 1:27 pm    Post subject: Example showing list handling in ABAP List Processor Reply with quote

Code:
report zexp_lists no standard page heading.
***********************************************************
* List Handling Example
*
*   This is freeware. Please read the terms of use.
*   Written by Urs Rohner, Rohner IT Consulting & Engineering
*
*   Contact Author: Urs Rohner
*
*
*history
*  History
*    Vers  Date                Own   Remark
*    ----  ------------------  ---   ----------------------------------
*    1.00  22nd February 2001  rnr   Initial version
*
*
***********************************************************

  include <icon>.

  types:
    begin of t_line_e,
      i     type i,
      s(20) type c,
      c     type c,
    end of t_line_e,
    t_line type t_line_e occurs 0.

  data:
    c_     type i,
    l_     type t_line,
    p_     type t_line_e, " picked line (global for list processor)
    i_     type i,
    s_(30) type c.


*
* P A I ( )
*
  start-of-selection.

    perform m_fill_table using l_[].
    perform m_write_list using l_[].
    leave to list-processing.

  at line-selection.
    clear i_.
    read line sy-lilli field value p_-i into c_. " get cursor position
    do.
      add 1 to i_.
      read line i_ field value p_-s into s_.
      if sy-subrc is initial.
        read table l_[] into p_ index i_.
        if sy-subrc is initial.
          p_-s = s_.
          if sy-cucol eq 14 and p_-i eq c_.
            case p_-c.
              when '1'. p_-c = 2.
              when '2'. p_-c = 3.
              when '3'. p_-c = 1.
            endcase.
          endif.
          modify l_[] from p_ index i_.
        endif.
      else.
        exit.
      endif.
    enddo.
    clear sy-lsind.
    perform m_write_list using l_[].


*
* C o R o u t i n e s
*
  form m_fill_table using _l type t_line.
    data:
      l_ type t_line_e.

    l_-i = 1. l_-s = 'Alpha'. l_-c = '1'. append l_ to _l[].
    l_-i = 2. l_-s = 'Beta '. l_-c = '2'. append l_ to _l[].
    l_-i = 3. l_-s = 'Gamma'. l_-c = '3'. append l_ to _l[].
    l_-i = 4. l_-s = 'Delta'. l_-c = 'T'. append l_ to _l[].
  endform.


  form m_write_list using _l type t_line.
    loop at _l[] into p_.
      hide p_.  " save information to list processor
      write: / p_-i.
      perform m_write_icon using p_-c.
      perform m_write_input using p_-s p_-c.
      write p_-c.
    endloop.
  endform.

  form m_write_icon using _i.
    data c_(20) type c.

    if _i na '123'.
      write (3) space.
    else.
      perform m_create_sem using _i c_.
      format hotspot on.
      write c_   no-gap.
      format hotspot off.
    endif.
  endform.

  form m_write_input using _f _m.
    if _m na '23'.
      write _f no-gap.
    else.
      format input on.
      write _f no-gap.
      format input off.
    endif.
  endform.


  form m_create_sem using _s type c _r.
    data n_ like icont-quickinfo.

    case _s.
      when '1'. " hidden
        n_ = 'ICON_LED_INACTIVE'.
      when '2'. " regular
        n_ = 'ICON_LED_GREEN'.

      when '3'. " mandatory
        n_ = 'ICON_LED_YELLOW'.
      when others. " control field
        n_ = 'ICON_LED_RED'.
    endcase.
    call function 'ICON_CREATE'
      exporting name    = n_
     importing  result  = _r.
  endform.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> List Generation, LDB, Spool Process, SAP Query, Report Painter All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.