TABLES SSCRFIELDS.

* Þirket Verilerinin Tutulduðu Tablo
DATA : BEGIN OF STAB OCCURS 0 ,
     SAD(25),
     PAD(25),
     MAAS TYPE  I,
     CH(1) ,

END OF STAB,
* collect table
* CTAB TABLOSUNDA BENZER FIELD ICERIKLERI TOPLANACAK

CTAB LIKE STAB OCCURS 0 WITH HEADER LINE .

SELECTION-SCREEN BEGIN OF BLOCK B1
                 WITH FRAME TITLE TEXT-002.

PARAMETERS : SIR  TYPE TEXT20 ,
             AD   TYPE TEXT20 ,
             MAAS TYPE I      .






*SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN PUSHBUTTON /20(10) TEXT-003 USER-COMMAND EKL.


SELECTION-SCREEN END   OF BLOCK B1 .

* AT SELECTION-SCREEN.
AT SELECTION-SCREEN  .
  IF SSCRFIELDS-UCOMM EQ 'EKL'.
* ÞIRKET STAB DOLDURULMASý
    PERFORM FILL_TABLE.
  ENDIF.

END-OF-SELECTION.
  PERFORM COLLECT_TABLE.

AT USER-COMMAND.

  IF SY-UCOMM EQ 'AYRINTI'.
    PERFORM FETCG_SCREEN.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  fill_table
*&---------------------------------------------------------------------*
FORM FILL_TABLE.




  MOVE : SIR     TO STAB-SAD ,
         AD      TO  STAB-PAD ,
         MAAS    TO STAB-MAAS .

  APPEND STAB.
  CLEAR STAB.
ENDFORM.                    " fill_table
*&---------------------------------------------------------------------*
*&      Form  collect_table
*&---------------------------------------------------------------------*
FORM COLLECT_TABLE.
  SORT STAB ASCENDING BY SAD .
  LOOP AT STAB.

* SIRKETE GORE COLLECT
    MOVE : STAB-SAD TO CTAB-SAD ,
           STAB-MAAS TO CTAB-MAAS .

    COLLECT CTAB.

  ENDLOOP.
* tus yarattik.
  SET PF-STATUS 'DE'.

  LOOP AT CTAB.
    WRITE : /  CTAB-CH AS CHECKBOX,
                          CTAB-SAD ,
                          CTAB-MAAS .
    HIDE :  CTAB-CH,
            CTAB-SAD.
  ENDLOOP.
  CLEAR CTAB.


ENDFORM.                      " collect_table
*&---------------------------------------------------------------------*
*&      Form  write
*&---------------------------------------------------------------------*
FORM WRITE.

  DATA : KARS(25).
  BREAK-POINT.
  MOVE CTAB-SAD TO KARS .
  LOOP AT STAB WHERE SAD EQ KARS .
    WRITE : / STAB-SAD ,
              STAB-PAD ,
             STAB-MAAS .
  ENDLOOP.
  READ TABLE CTAB WITH KEY SAD = KARS .
  WRITE : / 'Genel Toplam',  CTAB-MAAS .
ENDFORM.                    " write


*&---------------------------------------------------------------------*
*&      Form  FETCH_SCREEN
*&---------------------------------------------------------------------*

FORM FETCG_SCREEN.

  DO .

    READ LINE SY-INDEX FIELD VALUE CTAB-CH .
* SAYFA BITENE KADAR OKU
*------------------------
    IF SY-SUBRC NE 0.

      BREAK-POINT.
      EXIT.
    ENDIF.
*------------------------


    BREAK-POINT.

    IF CTAB-CH = 'X'.

      LOOP AT STAB WHERE SAD EQ CTAB-SAD.

        WRITE:/ STAB-SAD,
               STAB-PAD,
               STAB-MAAS.
      ENDLOOP.

    ENDIF.

  ENDDO.

ENDFORM.                    "FETCG_SCREEN

Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
SAP ve ABAP ile ilgili tüm sorularınızı gönderebilirsiniz.