메뉴 건너뛰기

SAP 한국 커뮤니티



REPORT z_demo_print_selections

노름마치 2007.11.05 22:00 조회 수 : 3745

REPORT z_demo_print_selections.
*---------------------------------------------------------------------*
* Print Selection Parameters - Function PRINT_SELECTIONS              *
*---------------------------------------------------------------------*
* Author : Michel PIOUD                                               *
* Email : mpioud@yahoo.fr  HomePage : http://www.geocities.com/mpioud *
*---------------------------------------------------------------------*


TABLES : vbak.                         " Sales Document: Header Data


SELECT-OPTIONS :
* Sold-to party
  s_kunnr FOR vbak-kunnr,
* Sales Organization
  s_vkorg FOR vbak-vkorg DEFAULT '0100' TO '0200'.


PARAMETERS :
  p_datum TYPE datum DEFAULT sy-datum.


*---------------------------------------------------------------------*
INITIALIZATION.


* Fill S_KUNNR
  CLEAR s_kunnr.
  s_kunnr-sign = 'I'.
  s_kunnr-option = 'EQ'.
  s_kunnr-low = '1000'.
  APPEND s_kunnr.
  s_kunnr-low = '1010'.
  APPEND s_kunnr.
  s_kunnr-low = '1020'.
  APPEND s_kunnr.


  s_kunnr-sign = 'I'.
  s_kunnr-option = 'BT'.
  s_kunnr-low = '2000'.
  s_kunnr-high = '3000'.
  APPEND s_kunnr.


  s_kunnr-sign = 'E'.
  s_kunnr-option = 'BT'.
  s_kunnr-low = '2800'.
  s_kunnr-high = '2900'.
  APPEND s_kunnr.


  CLEAR s_kunnr.
  s_kunnr-sign = 'E'.
  s_kunnr-option = 'EQ'.
  s_kunnr-low = '2700'.
  APPEND s_kunnr.


*---------------------------------------------------------------------*
START-OF-SELECTION.


* Print Selection Parameters
  PERFORM f_print_selections.


*---------------------------------------------------------------------*
*      Form  f_print_selections
*---------------------------------------------------------------------*
FORM f_print_selections .


  DATA:
    l_even TYPE p,
    l_offset TYPE i VALUE 0,


    BEGIN OF lt_info OCCURS 20,
      flag,
      olength TYPE x,
      line  LIKE raldb-infoline,
    END OF lt_info.


  CALL FUNCTION 'PRINT_SELECTIONS'
    EXPORTING
      mode      = 'TABLE'
      rname     = sy-cprog
      rvariante = sy-slset
    TABLES
      infotab   = lt_info.


  WRITE :/ '--- SELECTION PARAMETERS ---'(001).
  SKIP.


  LOOP AT lt_info FROM 6.
    IF lt_info-line+1(1) <> '-'.
      l_even = ( sy-tabix + l_offset ) MOD 2.
      IF l_even = 0 AND
         lt_info-line+5(4) <> 'or  '(002) AND
         lt_info-line+5(4) <> 'and '(003).
        WRITE : / lt_info-line+2(30).
      ELSEIF lt_info-line+5(4) = 'or  '(002) OR
             lt_info-line+5(4) = 'and '(003).
        l_offset = 1 - l_offset.
        WRITE : /21 lt_info-line+5(60).
      ELSE.
        WRITE :   lt_info-line+16(49).
      ENDIF.
    ENDIF.
  ENDLOOP.


ENDFORM.                    " f_print_selections
************** END OF PROGRAM Z_DEMO_PRINT_SELECTIONS *****************