SAP Bilgi Merkezi
Ana Sayfa  ABAP   FI   CO   MM   SD   PP   QM   HR   BW 
ABAP Destek
ALV Ağaç Kodlama (Hiyerarşik ALV Kodlama)

ALV de ağaç kodlama için REUSE_ALV_HIERSEQ_LIST_DISPLAY fonksiyonu kullanılabilir. Başlık ve kalem tablolarını aşağıdaki programda görüldüğü gibi oluşturup bu fonksiyona göndererek ALV de ağaç sistemini elde edebilirsiniz.

Örnek Program:

*&---------------------------------------------------------------------
*& Created Date : 1.2.2005                                             *
*& Created By   : Yavuz KOMUT                                          *
*&---------------------------------------------------------------------*
 report zoint01 no standard page heading line-size 166
                                       line-count 65(3).
  TABLES:icon,zoint01,skb1.
  DATA:BEGIN OF file OCCURS 10,
  filechar(100),
  END OF file.

  DATA:BEGIN OF itabh OCCURS 10,
  mark(1) TYPE c,
  id LIKE icon-id,
  line(1),
  bukrs(4),
  trnumber(15),
  fkdat LIKE sy-datum,
  budat LIKE sy-datum,
  invnumber(16),
  blart(2),
  waers(3),
  county TYPE i,
  flag,
  END OF itabh.

  DATA:BEGIN OF itabd OCCURS 10,
  line(1),
  hkont(10),
  bschl(2),
  tutar LIKE bseg-dmbtr,
  zfbdt LIKE sy-datum,
  sgtxt(50),
  gsber(4),
  county TYPE i,
  END OF itabd.
  DATA:tempitabd LIKE itabd OCCURS 10 WITH HEADER LINE.

  DATA: BEGIN OF bdcdata OCCURS 0.
          INCLUDE STRUCTURE bdcdata.
  DATA: END OF bdcdata.
  DATA  BEGIN OF messtab OCCURS 1.
          INCLUDE STRUCTURE bdcmsgcoll.
  DATA  END   OF messtab.

  DATA:countx TYPE i,
       county TYPE i,
       trnumber(15),
       count TYPE i,
       flagmasr,
       mwskz LIKE skb1-mwskz.

  TYPE-POOLS: slis.

  DATA : er_layout TYPE slis_layout_alv,
         er_fieldcat TYPE slis_t_fieldcat_alv,
         er_sp_group TYPE slis_t_sp_group_alv,
         e_save(1) TYPE c,
         e_variant LIKE disvariant,
         er_events TYPE slis_t_event,
         keyinfo   TYPE slis_keyinfo_alv ,
         t_sort  TYPE  slis_sortinfo_alv OCCURS 1 WITH HEADER LINE ,
         t_list_top_of_page TYPE slis_t_listheader,
         color   TYPE  slis_t_specialcol_alv WITH HEADER LINE.

  DATA: gt_list_top_of_page TYPE slis_t_listheader.

  START-OF-SELECTION.
    PERFORM upload_data.
    PERFORM arrange_data.
    PERFORM write_data.
*&---------------------------------------------------------------------*
*&      Form  write_data
*&---------------------------------------------------------------------*
  FORM write_data.
    PERFORM e03_eventtab_build USING er_events[].
    PERFORM e04_comment_build USING gt_list_top_of_page[].
    PERFORM get_format.
    PERFORM alv_tables.
    PERFORM alv_alv.
  ENDFORM.                    " write_data
*&---------------------------------------------------------------------*
*&      Form  E03_EVENTTAB_BUILD
*&---------------------------------------------------------------------*
  FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
      EXPORTING
        i_list_type = 0
      IMPORTING
        et_events   = e03_lt_events.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
                             INTO ls_event.
    IF sy-subrc = 0.
      MOVE 'SAYFA_BASI' TO ls_event-form.
      APPEND ls_event TO e03_lt_events.
    ENDIF.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_pf_status_set
                             INTO ls_event.
    IF sy-subrc = 0.
      MOVE 'SET_PF_STATUS' TO ls_event-form.
      APPEND ls_event TO e03_lt_events.
    ENDIF.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_user_command
                             INTO ls_event.
    IF sy-subrc = 0.
      MOVE 'AT_USER_COMMAND' TO ls_event-form.
      APPEND ls_event TO e03_lt_events.
    ENDIF.

  ENDFORM.                    " E03_EVENTTAB_BUILD
*&---------------------------------------------------------------------*
*&      Form  E04_COMMENT_BUILD
*&---------------------------------------------------------------------*
  FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
    DATA: ls_line TYPE slis_listheader.
    DATA : _tarih(10).
    DATA : _saat(10).

    ls_line-typ = 'H'.
    ls_line-info = 'Obase-SAP Aktarım Programı'.
    APPEND ls_line TO e04_lt_top_of_page.
    CLEAR ls_line.
    ls_line-typ = 'S'.
    ls_line-info = ' '.
    APPEND ls_line TO e04_lt_top_of_page.
    CLEAR ls_line.
    ls_line-typ = 'S'.
    ls_line-key = 'Raporu Alan'.
    ls_line-info = sy-uname.
    ls_line-info+35(10) = sy-tcode.
    APPEND ls_line TO e04_lt_top_of_page.
    CLEAR ls_line.
    ls_line-typ = 'S'.
    ls_line-key = 'Tarih'.
    ls_line-info(2) = sy-datum+6(2).
    ls_line-info+2(1) = '.'.
    ls_line-info+3(2) = sy-datum+4(2).
    ls_line-info+5(1) = '.'.
    ls_line-info+6(4) = sy-datum(4).
    APPEND ls_line TO e04_lt_top_of_page.
    CLEAR ls_line.
  ENDFORM.                    " E04_COMMENT_BUILD
*&---------------------------------------------------------------------*
*&      Form  GET_FORMAT
*&---------------------------------------------------------------------*
  FORM get_format.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name         = 'zoint01'
        i_internal_tabname     = 'ITABH'
        i_inclname             = 'zoint01'
        i_client_never_display = 'X'
        i_bypassing_buffer     = 'X'
      CHANGING
        ct_fieldcat            = er_fieldcat[]
      EXCEPTIONS
        OTHERS                 = 3.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      PERFORM fieldcat_modify USING er_fieldcat[].
    ENDIF.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name         = 'zoint01'
        i_internal_tabname     = 'ITABD'
        i_inclname             = 'zoint01'
      CHANGING
        ct_fieldcat            = er_fieldcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      PERFORM fieldcat_modify USING er_fieldcat[].
    ENDIF.
  ENDFORM.                    " GET_FORMAT

*&---------------------------------------------------------------------*
*&      Form  FIELDCAT_MODIFY
*&---------------------------------------------------------------------*
  FORM fieldcat_modify USING u_er_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: xs_fieldcat TYPE slis_fieldcat_alv.
    LOOP AT u_er_fieldcat INTO xs_fieldcat.
      CASE xs_fieldcat-fieldname.

        WHEN 'MARK'.
          xs_fieldcat-seltext_l = 'S'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-input = 'X'.
          xs_fieldcat-checkbox = 'X'.
          xs_fieldcat-outputlen = 1.

        WHEN 'ID'.
          xs_fieldcat-seltext_l = 'Durum'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.

        WHEN 'LINE'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'S'.

        WHEN 'BUKRS'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Şirket Kodu'.

        WHEN 'COUNTY'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Kayıt No'.

        WHEN 'TRNUMBER'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Obase Kayıt No'.

        WHEN 'FKDAT'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Fatura Tarihi'.

        WHEN 'BUDAT'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Kayıt Tarihi'.

        WHEN 'INVNUMBER'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Fatura No'.

        WHEN 'BLART'.
          xs_fieldcat-key = 'X'.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Belge Türü'.

        WHEN 'WAERS'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'PBM.'.

        WHEN 'HKONT'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Hesap Numarası'.

        WHEN 'BSCHL'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'KA'.

        WHEN 'TUTAR'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Tutar'.
          xs_fieldcat-ctabname  = 'ITABH'.
          xs_fieldcat-cfieldname  = 'WAERS'.

        WHEN 'ZFBDT'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Vade Tarihi'.

        WHEN 'SGTXT'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'Metin'.

        WHEN 'GSBER'.
          xs_fieldcat-key = ' '.
          xs_fieldcat-ddictxt = 'L'.
          xs_fieldcat-seltext_l = 'İş Alanı'.

      ENDCASE.
      xs_fieldcat-reptext_ddic = xs_fieldcat-seltext_l.
      MODIFY u_er_fieldcat FROM xs_fieldcat.
    ENDLOOP.
  ENDFORM.                    " FIELDCAT_MODIFY
*&---------------------------------------------------------------------*
*&      Form  ALV_ALV
*&---------------------------------------------------------------------*
  FORM alv_alv.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      EXPORTING
        i_callback_program      = 'zoint01'
*  i_callback_user_command = 'USER_COMMAND'
        is_layout               = er_layout
        it_fieldcat             = er_fieldcat[]
        it_sort                 = t_sort[]
        it_events               = er_events
        i_tabname_header        = 'ITABH'
        i_tabname_item          = 'ITABD'
        is_keyinfo              = keyinfo
      TABLES
        t_outtab_header         = itabh
        t_outtab_item           = itabd.
    LEAVE SCREEN.
*break eakan.
  ENDFORM.                    " ALV_ALV
*&---------------------------------------------------------------------*
*& Form sayfa_basi
*&---------------------------------------------------------------------*
  FORM sayfa_basi.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary = gt_list_top_of_page.
  ENDFORM. " sayfa_basi
*&---------------------------------------------------------------------*
*&      Form  upload_data
*&---------------------------------------------------------------------*
  FORM upload_data .
    CALL FUNCTION 'UPLOAD'
      EXPORTING
        filename            = ' '
        filetype            = ' '
*      importing
*        act_filename        = filename
      TABLES
        data_tab            = file
      EXCEPTIONS
        conversion_error    = 1
        invalid_table_width = 2
        invalid_type        = 3
        no_batch            = 4
        unknown_error       = 5
        OTHERS              = 6.
  ENDFORM.                    " upload_data
*&---------------------------------------------------------------------*
*&      Form  arrange_data
*&---------------------------------------------------------------------*
  FORM arrange_data .
    CLEAR:countx,county.
    LOOP AT file.
      countx = countx + 1.
      IF file-filechar(1) EQ 'H'.
        county = county + 1.
      ENDIF.
      IF countx EQ 1 AND file-filechar(1) NE 'H'.
        MESSAGE a001(zinto).
      ENDIF.
      IF file-filechar(1) EQ 'H'.
        CLEAR trnumber.
        trnumber = file-filechar+5(15).
        CLEAR zoint01.
        SELECT SINGLE * FROM zoint01 WHERE trnumber EQ trnumber.
        IF sy-subrc EQ 0.
          CLEAR icon.
          SELECT SINGLE * FROM icon WHERE name EQ 'ICON_GREEN_LIGHT'.
        ELSE.
          CLEAR icon.
          SELECT SINGLE * FROM icon WHERE name EQ 'ICON_YELLOW_LIGHT'.
        ENDIF.
        CLEAR itabh.
        MOVE:file-filechar(1)     TO itabh-line,
             file-filechar+1(4)   TO itabh-bukrs,
             file-filechar+5(15)  TO itabh-trnumber,
             file-filechar+20(2)  TO itabh-fkdat+6(2),
             file-filechar+22(2)  TO itabh-fkdat+4(2),
             file-filechar+24(4)  TO itabh-fkdat(4),
             file-filechar+28(2)  TO itabh-budat+6(2),
             file-filechar+30(2)  TO itabh-budat+4(2),
             file-filechar+32(4)  TO itabh-budat(4),
             file-filechar+36(16) TO itabh-invnumber,
             file-filechar+52(2)  TO itabh-blart,
             file-filechar+54(3)  TO itabh-waers,
             county               TO itabh-county,
             ' '                  TO itabh-mark,
             icon-id              TO itabh-id,
             file-filechar+57(1)  TO itabh-flag.
        APPEND itabh.
      ENDIF.
      IF file-filechar(1) EQ 'D'.
        CLEAR itabd.
        MOVE:file-filechar(1)     TO itabd-line,
             file-filechar+1(10)  TO itabd-hkont,
             file-filechar+11(2)  TO itabd-bschl,
             file-filechar+13(15) TO itabd-tutar,
             file-filechar+28(2)  TO itabd-zfbdt+6(2),
             file-filechar+30(2)  TO itabd-zfbdt+4(2),
             file-filechar+32(4)  TO itabd-zfbdt(4),
             file-filechar+36(50) TO itabd-sgtxt,
             file-filechar+86(4)  TO itabd-gsber,
             county               TO itabd-county.
        APPEND itabd.
      ENDIF.
    ENDLOOP.
  ENDFORM.                    " arrange_data
*&---------------------------------------------------------------------*
*&      Form  alv_tables
*&---------------------------------------------------------------------*
  FORM alv_tables .
    keyinfo-header01 = 'COUNTY' .
    keyinfo-item01   = 'COUNTY' .

    er_layout-coltab_fieldname = 'COLOR'.
    er_layout-colwidth_optimize = 'X'.
    er_layout-zebra = 'X'.

  ENDFORM.                    " alv_tables
*&---------------------------------------------------------------------*
*& Form SET_PF_STATUS
*&---------------------------------------------------------------------*
  FORM  set_pf_status USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'AAAA'.
  ENDFORM. " SET_PF_STATUS
*&---------------------------------------------------------------------*
*& Form AT_USER_COMMAND
*&---------------------------------------------------------------------*
  FORM  at_user_command USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
      WHEN 'TUM'.
        LOOP AT itabh.
          itabh-mark = 'X'.
          MODIFY itabh.
        ENDLOOP.
        PERFORM alv_alv.
      WHEN 'DTUM'.
        LOOP AT itabh WHERE mark EQ 'X'.
          itabh-mark = ' '.
          MODIFY itabh.
        ENDLOOP.
        sy-lsind = 1.
        PERFORM alv_alv.
        sy-lsind = 1.
      WHEN 'YRT'.
        PERFORM create_document.
      WHEN 'TERS'.
      WHEN OTHERS.
    ENDCASE.
  ENDFORM. " AT_USER_COMMAND
*&---------------------------------------------------------------------*
*&      Form  create_document
*&---------------------------------------------------------------------*
  FORM create_document .
    DATA:bldat(8),
         budat(8),
         zfbdt(8),
         wrbtr(16),
         invnumber LIKE bkpf-xblnr,
         blart(2).

    LOOP AT itabh.
      break eakan.
      CLEAR:bldat,budat,invnumber,blart.
      bldat(2) = itabh-fkdat+6(2).
      bldat+2(2) = itabh-fkdat+4(2).
      bldat+4(4) = itabh-fkdat(4).
      budat(2) = itabh-budat+6(2).
      budat+2(2) = itabh-budat+4(2).
      budat+4(4) = itabh-budat(4).
      invnumber = itabh-invnumber.
      CONDENSE invnumber NO-GAPS.
      FREE tempitabd.
      LOOP AT itabd WHERE county EQ itabh-trnumber.
        CLEAR tempitabd.
        MOVE-CORRESPONDING itabd TO tempitabd.
        APPEND tempitabd.
      ENDLOOP.
      count = 1.
      CLEAR messtab.
      REFRESH messtab.
      IF itabh-flag EQ 'X'.
        blart = 'TK'.
      ELSE.
        blart = itabh-blart.
      ENDIF.
      REFRESH bdcdata.
      PERFORM bdc_dynpro      USING 'SAPMF05A' '0100'.
      PERFORM bdc_field       USING 'BKPF-BLDAT' bldat.
      PERFORM bdc_field       USING 'BKPF-BLART' blart.
      PERFORM bdc_field       USING 'BKPF-BUKRS' itabh-bukrs.
      PERFORM bdc_field       USING 'BKPF-BUDAT' budat.
      PERFORM bdc_field       USING 'BKPF-WAERS' itabh-waers.
      PERFORM bdc_field       USING 'BKPF-XBLNR' invnumber.
      PERFORM bdc_field       USING 'BKPF-BKTXT' itabh-trnumber.

      CLEAR tempitabd.
      READ TABLE tempitabd INDEX count.

      PERFORM bdc_field       USING 'RF05A-NEWBS' tempitabd-bschl.
      PERFORM bdc_field       USING 'RF05A-NEWKO' tempitabd-hkont.
      PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
      LOOP AT itabd WHERE county EQ itabh-county.
        zfbdt(2) = itabd-zfbdt+6(2).
        zfbdt+2(2) = itabd-zfbdt+4(2).
        zfbdt+4(4) = itabd-zfbdt(4).
        count = count + 1.
        PERFORM skb1.
        CLEAR wrbtr.
        WRITE itabd-tutar TO wrbtr CURRENCY itabh-waers.
        IF tempitabd-bschl EQ '40' OR tempitabd-bschl EQ '50'.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0300'.
          PERFORM bdc_field       USING 'BSEG-WRBTR'  wrbtr.
          PERFORM bdc_field       USING 'BSEG-ZUONR' 'Dosya_adı'.
          PERFORM bdc_field       USING 'BSEG-SGTXT' itabd-sgtxt.
          IF mwskz NE space.
            PERFORM bdc_field       USING 'BSEG-MWSKZ'  mwskz.
          ENDIF.
          CLEAR tempitabd.
          READ TABLE tempitabd INDEX count.
          IF sy-subrc EQ 0.
            PERFORM bdc_field       USING 'RF05A-NEWBS' tempitabd-bschl.
            PERFORM bdc_field       USING 'RF05A-NEWKO' tempitabd-hkont.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
          ELSE.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
          ENDIF.
          IF flagmasr EQ 'X'.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'COBL-GSBER' itabd-gsber.
            PERFORM bdc_field       USING 'COBL-KOSTL' itabd-gsber.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=ENTE'.
          ELSE.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'COBL-GSBER' itabd-gsber.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=ENTE'.
          ENDIF.
        ELSEIF tempitabd-bschl EQ '31' OR tempitabd-bschl EQ '21'.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0302'.
          PERFORM bdc_field       USING 'BSEG-WRBTR'  wrbtr.
          PERFORM bdc_field       USING 'BSEG-ZFBDT'  zfbdt.
          PERFORM bdc_field       USING 'BSEG-GSBER'  itabd-gsber.
          PERFORM bdc_field       USING 'BSEG-ZUONR' 'Dosya_adı'.
          PERFORM bdc_field       USING 'BSEG-SGTXT' itabd-sgtxt.
          IF mwskz NE space.
            PERFORM bdc_field       USING 'BSEG-MWSKZ'  mwskz.
          ENDIF.
          CLEAR tempitabd.
          READ TABLE tempitabd INDEX count.
          IF sy-subrc EQ 0.
            PERFORM bdc_field       USING 'RF05A-NEWBS' tempitabd-bschl.
            PERFORM bdc_field       USING 'RF05A-NEWKO' tempitabd-hkont.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
          ELSE.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
          ENDIF.
          IF flagmasr EQ 'X'.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'COBL-KOSTL' itabd-gsber.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=ENTE'.
          ENDIF.
        ELSEIF tempitabd-bschl EQ '01' OR tempitabd-bschl EQ '11'.
          PERFORM bdc_dynpro      USING 'SAPMF05A' '0301'.
          PERFORM bdc_field       USING 'BSEG-WRBTR'  wrbtr.
          PERFORM bdc_field       USING 'BSEG-ZFBDT'  zfbdt.
          PERFORM bdc_field       USING 'BSEG-GSBER'  itabd-gsber.
          PERFORM bdc_field       USING 'BSEG-ZUONR' 'Dosya_adı'.
          PERFORM bdc_field       USING 'BSEG-SGTXT' itabd-sgtxt.
          IF mwskz NE space.
            PERFORM bdc_field       USING 'BSEG-MWSKZ'  mwskz.
          ENDIF.
          CLEAR tempitabd.
          READ TABLE tempitabd INDEX count.
          IF sy-subrc EQ 0.
            PERFORM bdc_field       USING 'RF05A-NEWBS' tempitabd-bschl.
            PERFORM bdc_field       USING 'RF05A-NEWKO' tempitabd-hkont.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '/00'.
          ELSE.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
          ENDIF.
          IF flagmasr EQ 'X'.
            PERFORM bdc_dynpro      USING 'SAPLKACB' '0002'.
            PERFORM bdc_field       USING 'COBL-KOSTL' itabd-gsber.
            PERFORM bdc_field       USING 'BDC_OKCODE'  '=ENTE'.
          ENDIF.
        ENDIF.
      ENDLOOP.
*    perform bdc_field       using 'BDC_OKCODE' '/00'.
      FREE messtab.
      CALL TRANSACTION  'F-02' USING bdcdata
                              MODE 'A'
                              UPDATE 'S'
                          MESSAGES INTO messtab.

      IF sy-subrc EQ 0.
        CLEAR icon.
        SELECT SINGLE * FROM icon WHERE name EQ 'ICON_GREEN_LIGHT'.
        itabh-id = icon-id.
        MODIFY itabh.
        MOVE:itabh-trnumber TO zoint01-trnumber,
             itabh-bukrs    TO zoint01-bukrs,
             itabh-budat(4) TO zoint01-gjahr.
        INSERT zoint01.
      ELSE.
*hata logu kaydet
      ENDIF.
    ENDLOOP.
  ENDFORM.                    " create_document
*&---------------------------------------------------------------------*
*&      Form  BDC_DYNPRO
*&---------------------------------------------------------------------*
  FORM bdc_dynpro USING program dynpro.
    CLEAR bdcdata.
    bdcdata-program  = program.
    bdcdata-dynpro   = dynpro.
    bdcdata-dynbegin = 'X'.
    APPEND bdcdata.
  ENDFORM.                    " BDC_DYNPRO
*&---------------------------------------------------------------------*
*&      Form  BDC_FIELD
*&---------------------------------------------------------------------*
  FORM bdc_field USING fnam fval.
    CLEAR bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    APPEND bdcdata.
  ENDFORM.                    " BDC_FIELD
*&---------------------------------------------------------------------*
*&      Form  skb1
*&---------------------------------------------------------------------*
  FORM skb1 .
    DATA:hkont(10) TYPE n,
         temphkont(10).
    IF tempitabd-hkont CO ' 0123456789'.
      hkont = tempitabd-hkont.
      temphkont = hkont.
    ELSE.
      temphkont = tempitabd-hkont.
    ENDIF.
    CLEAR:flagmasr.
    CLEAR skb1.
    SELECT SINGLE * FROM skb1 WHERE bukrs EQ itabh-bukrs
                                AND saknr EQ temphkont.
    IF skb1-fstag EQ 'G006' OR skb1-fstag EQ 'G015' OR
       skb1-fstag EQ 'G029' OR skb1-fstag EQ 'G033' OR
       skb1-fstag EQ 'G052'.
      flagmasr = 'X'.
    ENDIF.
    CLEAR:mwskz.
    IF skb1-mwskz EQ '*' OR skb1-mwskz EQ '+' OR skb1-mwskz EQ 'A0'.
      mwskz = 'A0'.
    ELSEIF skb1-mwskz EQ '-'.
      mwskz = 'V0'.
    ELSEIF skb1-mwskz EQ space.
    ENDIF.
  ENDFORM.                                                  " skb1
ABAP Programlar
SAP Chain
SAP NetWeaver
ticket sistemimize katılın ve ücretsiz
10 adam gün kazanın >>
 Ana Sayfa  |  ABAP  |  FI  |  CO  |  MM  |  SD  |  PP  |  QM  |  HR  |  BW 
ykomut@gmail.com