3 Replies Latest reply: Jan 17, 2014 5:21 AM by Peter Cammaert RSS

    select

      hi expert . Alv fields empty help me

       

       

      TABLES : t001 ,bseg ,bkpf ,knb1, bsis , bsid , bsik ,

          kna1 ,knvv , lfa1 , t151t , icon.

      TYPE-POOLS : slis.

       

      DATA : BEGIN OF gt_bkpf OCCURS 1,

             bukrs LIKE bkpf-bukrs, "ŞİRKET KODU

             belnr LIKE bkpf-belnr, "BELGE

             gjahr LIKE bkpf-gjahr, "MALİ YIL

             blart LIKE bkpf-blart, "BELGE TÜRÜ

           END OF gt_bkpf.

       

       

       

       

      DATA : BEGIN OF itab OCCURS 5,

            bukrs  LIKE bkpf-bukrs,   "ŞİRKET KODU

            belnr  LIKE bkpf-belnr,   "MUHASEBE BELGESİNİN NUMARASI

            ktokd  LIKE kna1-name1,   "HESAP GRUBU

            gjahr  LIKE bkpf-gjahr,   "MALİ YIL

            kunnr  LIKE kna1-kunnr,    "müşteri hesabı

            kdgrp  LIKE knvv-kdgrp,   " MÜŞTERİ GRUBU

            id     LIKE icon-id,      "YÖNETİCİ ONAYI

            ktext  LIKE t151t-ktext,  "TANIM

            hkont  LIKE bsis-hkont,   "HESAP NUMARASI

            name1  LIKE kna1-name1,   "HESAP ADI

            umskz  LIKE bsid-umskz,   "

            dmbtr  LIKE bsis-dmbtr,   "DÖNEM BORCU

            ktokk  LIKE lfa1-ktokk,   "GRUP(hesap grubu)

      *     dmbtr1 LIKE bsis-dmbtr,   "DÖNEM ALACAK

      *     dmbtr2 LIKE bsis-dmbtr,   "DÖNEM ALACAK

      *     dmbtr3 LIKE bsis-dmbtr,   "KÜMÜLE BAKİYE

           blart  LIKE bkpf-blart,   "BELGE TÜRÜ

           bldat  LIKE bkpf-bldat,   "BELGE TARİHİ

           budat  LIKE bkpf-budat,   "KAYIT TARİHİ

           cpudt  LIKE bkpf-cpudt,   "GİRİŞ TARİHİ

          END OF itab.

       

       

       

      DATA : gs_1 LIKE itab.

       

       

       

      DATA: gt_fieldcat    TYPE lvc_t_fcat ,

            gs_layout      TYPE lvc_s_layo,

            f_fieldcat     TYPE lvc_s_fcat.

       

       

       

       

       

      "hesap türü alanı

      SELECTION-SCREEN BEGIN OF BLOCK hsptur WITH FRAME TITLE hsptr.

      SELECT-OPTIONS : s_bukrs  FOR bkpf-bukrs DEFAULT 4000,

                       s_gsber  FOR bseg-gsber,

                       s_blart  FOR bkpf-blart,

                       s_umskz  FOR bseg-umskz DEFAULT 2,

      *                 so_bukrs FOR bkpf-bukrs,

                       s_belnr  FOR bkpf-belnr,

                       so_blart FOR bkpf-blart.

      PARAMETERS : p_gjahr     TYPE bkpf-gjahr.

       

      SELECTION-SCREEN END OF BLOCK hsptur.

      "tarih tipi

      SELECTION-SCREEN BEGIN OF BLOCK trhtip WITH FRAME TITLE thtp.

      SELECTION-SCREEN BEGIN OF LINE.

       

      PARAMETERS  :   beltar  RADIOBUTTON GROUP trtp  DEFAULT 'X'.

      SELECTION-SCREEN COMMENT 10(15) text-c01 FOR FIELD beltar.

      PARAMETERS  :    kyttar RADIOBUTTON GROUP  trtp .

      SELECTION-SCREEN COMMENT 40(15) text-c02 FOR FIELD kyttar.

      PARAMETERS  :   grstar RADIOBUTTON GROUP  trtp .

      SELECTION-SCREEN COMMENT 70(15) text-c03 FOR FIELD grstar.

      SELECTION-SCREEN END OF LINE.

      SELECTION-SCREEN END OF BLOCK trhtip.

       

       

       

       

      "belge tarihi

       

      SELECTION-SCREEN BEGIN OF BLOCK blgtar WITH FRAME TITLE blgtr.

      SELECTION-SCREEN BEGIN OF LINE .

       

      PARAMETERS  :  bgn  RADIOBUTTON GROUP bltr  .

      SELECTION-SCREEN COMMENT 10(15) text-r01 FOR FIELD bgn.

      PARAMETERS  :  chft RADIOBUTTON GROUP  bltr .

      SELECTION-SCREEN COMMENT 30(15) text-r02 FOR FIELD chft.

      PARAMETERS  :  cray RADIOBUTTON GROUP  bltr  DEFAULT 'X'.

      SELECTION-SCREEN COMMENT 50(15) text-r03 FOR FIELD cray .

      PARAMETERS  :  crayil RADIOBUTTON GROUP  bltr .

      SELECTION-SCREEN COMMENT 75(15) text-r04  FOR FIELD crayil.

       

       

      SELECTION-SCREEN END OF LINE.

      SELECTION-SCREEN BEGIN OF LINE.

      PARAMETERS dgr RADIOBUTTON GROUP bltr .

      SELECTION-SCREEN COMMENT 10(15) text-r05 FOR FIELD dgr.

      SELECT-OPTIONS dates FOR sy-datlo .

      SELECTION-SCREEN END OF LINE.

      SELECTION-SCREEN BEGIN OF  LINE .

      PARAMETERS : c_br AS CHECKBOX .

      SELECTION-SCREEN COMMENT 10(25) text-c07 FOR FIELD c_br.

      SELECTION-SCREEN END OF LINE.

      SELECTION-SCREEN END OF BLOCK blgtar.

       

       

       

       

       

      "1. screen alanı

      SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

      SELECTION-SCREEN BEGIN OF LINE.

      PARAMETERS : c_ms AS CHECKBOX.

      SELECTION-SCREEN COMMENT 10(25) text-c10 FOR FIELD c_ms.

      SELECTION-SCREEN END OF LINE.

      SELECT-OPTIONS : s_kunnr FOR knb1-kunnr,

                       s_ktokd FOR kna1-ktokd,

                       s_kdgrp FOR knvv-kdgrp,

                       s_lifnr FOR lfa1-lifnr.

       

       

       

      SELECTION-SCREEN END OF SCREEN 100.

      "2. screen alanı

      SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.

      SELECTION-SCREEN BEGIN OF LINE.

      PARAMETERS : c_ms1 AS CHECKBOX.

      SELECTION-SCREEN COMMENT 10(25) text-c09 FOR FIELD c_ms1.

      SELECTION-SCREEN END OF LINE.

      PARAMETERS : p1 TYPE c LENGTH 10,

                   p2 TYPE c LENGTH 10,

                   p3 TYPE c LENGTH 10.

       

       

      SELECTION-SCREEN END OF SCREEN 200.

      " 3. screen alanı

      SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.

      SELECTION-SCREEN  BEGIN OF BLOCK blc3 WITH FRAME TITLE bl3 NO INTERVALS.

       

       

      SELECTION-SCREEN END OF BLOCK blc3.

      SELECTION-SCREEN END OF SCREEN 300.

      SELECTION-SCREEN : BEGIN OF TABBED BLOCK blc1 FOR 10 LINES,

        TAB (20)  buton1 USER-COMMAND p1  ,

        TAB (20)  buton2 USER-COMMAND p2,

         TAB (20) buton3 USER-COMMAND usr3 ,

        END OF BLOCK blc1.

       

      START-OF-SELECTION.

        ""PERFORMLAR

        PERFORM get_data.

        PERFORM alan.

        PERFORM aln_alv.

        PERFORM select.

        PERFORM dongu.

      *perform kayit_tipi.

      *perform giris_tipi.

       

       

       

       

       

       

       

       

       

       

       

      *&---------------------------------------------------------------------*

      *&      Form  command

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

      *      -->X          text

      *      -->S1         text

      *----------------------------------------------------------------------*

      *FORM command USING  x LIKE sy-ucomm

      *                    s1 TYPE slis_selfield .

      *  IF sy-ucomm = '&F03'.

      *    LEAVE TO SCREEN 0.

      *  ENDIF.

      *ENDFORM.                    "command

       

      *&---------------------------------------------------------------------*

      *&      Form  kayit_tipi

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

      FORM kayit_tipi.

        DATA : BEGIN OF t_lvc1 OCCURS 0,

                budat LIKE bkpf-budat,

        END OF t_lvc1.

       

        DATA : gt_fcat   TYPE slis_t_fieldcat_alv WITH HEADER LINE,

               gs_layout TYPE slis_layout_alv.

       

        f_fieldcat-fieldname  = 'BUDAT'.

        f_fieldcat-tabname     = 'T_LVC'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '9'.

        f_fieldcat-coltext     = 'KAYIT TARİHİ'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

       

        SELECT budat

           FROM bkpf INTO CORRESPONDING FIELDS OF TABLE t_lvc1

          WHERE budat BETWEEN 20001201 AND 20131201.

       

      ENDFORM.                    "kayit_tipi

       

      *&---------------------------------------------------------------------*

      *&      Form  dongu

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

       

       

       

       

       

       

       

      *&---------------------------------------------------------------------*

      *&      Form  aln_alv

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

      FORM aln_alv.

       

       

       

        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

          EXPORTING

            i_callback_program     = sy-repid

            i_callback_top_of_page = 'TOP_OF_PAGE'

            is_layout_lvc          = gs_layout

            it_fieldcat_lvc        = gt_fieldcat

            i_default              = 'X'

          TABLES

            t_outtab               = itab[]

          EXCEPTIONS

            program_error          = 1

            OTHERS                 = 2.

        IF sy-subrc <> 0.

      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

        ENDIF.

       

       

       

      ENDFORM.                    "aln_alv

       

       

       

       

       

      *&---------------------------------------------------------------------*

      *&      Form  alan

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

      FORM alan.

        f_fieldcat-fieldname  = 'ID'.

        f_fieldcat-tabname    = 'ITAB'.

        f_fieldcat-no_sum     = 'X'.

        f_fieldcat-key        = 'X'.

        f_fieldcat-outputlen  = '12'.

        f_fieldcat-col_pos    = '1'.

        f_fieldcat-coltext    = 'Y.O'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

        f_fieldcat-fieldname  = 'KTOKK'.

        f_fieldcat-tabname     = 'ITAB'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '2'.

        f_fieldcat-coltext     = 'GRUP(HESAP GRUBU)'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

        f_fieldcat-fieldname  = 'KDGRP'.

        f_fieldcat-tabname     = 'ITAB'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '3'.

        f_fieldcat-coltext     = 'MÜŞTERİ GRUBU'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

       

        f_fieldcat-fieldname  = 'HKONT'.

        f_fieldcat-tabname     = 'ITAB'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '4'.

        f_fieldcat-coltext     = 'HESAP NUMARASI'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

        f_fieldcat-fieldname  = 'NAME1'.

        f_fieldcat-tabname     = 'ITAB'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '5'.

        f_fieldcat-coltext     = 'HESAP ADI'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

       

        f_fieldcat-fieldname  = 'NAME1'.

        f_fieldcat-tabname     = 'ITAB'.

        f_fieldcat-no_sum      = 'X'.

        f_fieldcat-key         = 'X'.

        f_fieldcat-outputlen   = '12'.

        f_fieldcat-col_pos     = '6'.

        f_fieldcat-coltext     = 'HESAP ADI'.

        APPEND f_fieldcat TO gt_fieldcat.

        CLEAR f_fieldcat.

       

       

       

       

       

      ENDFORM.                    "alan

       

       

       

       

       

      INITIALIZATION.

        hsptr =  'HESAP TÜRÜ'.

        thtp =   'TARİH TİPİ'.

        buton1 = 'MÜŞTERİ HESABI'.

        buton2 = 'SATICI HESABI'.

        buton3 = 'SATICI HESABI'.

        blgtr =  'BELGE TARİHİ'.

        blc1-prog = sy-repid.

        blc1-dynnr = 200.

        blc1-activetab = 'P2'.

       

      AT SELECTION-SCREEN.

      *  CASE  beltar.

      *    WHEN  'X' .

      *        PERFORM  tarih_tipi.

      *

      *  ENDCASE.

       

        "subsceen oluşturma

        CASE sy-dynnr.

          WHEN 1000.

            CASE sy-ucomm.

              WHEN 'P1'.

                blc1-dynnr = 100.

              WHEN 'P2'.

                blc1-dynnr = 200.

       

            ENDCASE.

       

        ENDCASE.

       

      *    SELECT  id

      *   FROM icon

      *  INTO CORRESPONDING FIELDS OF TABLE itab

      *WHERE name = 'ICON_BEN_OFFER' .

       

       

       

       

       

       

       

      *&---------------------------------------------------------------------*

      *&      Form  get_data

      *&---------------------------------------------------------------------*

      *       text

      *----------------------------------------------------------------------*

      FORM get_data.

       

        SELECT *  FROM bkpf INTO CORRESPONDING FIELDS OF TABLE gt_bkpf

       

          WHERE bukrs IN s_bukrs AND

                belnr IN s_belnr AND

                gjahr EQ p_gjahr AND

                blart IN s_blart.

       

      ENDFORM.                    "get_data

       

      *&---------------------------------------------------------------------

       

      *&      Form  select

      *&---------------------------------------------------------------------

       

      *       text

      *----------------------------------------------------------------------

       

      FORM select.

        SELECT * FROM bseg FOR ALL ENTRIES IN gt_bkpf

           WHERE belnr EQ gt_bkpf-belnr AND

                gjahr  EQ gt_bkpf-gjahr .

      *          hkont EQ  s_hkont.

      endselect.

      ENDFORM.                    "select

       

       

      FORM dongu.

        LOOP AT itab INTO gt_bkpf  .

          MOVE-CORRESPONDING itab TO gs_1.

          APPEND gs_1 TO itab.

        ENDLOOP.

      ENDFORM.                    "dongu