Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to dequeue data with pushbutton?

Former Member
0 Likes
887

Hello everyone,

I need to dequeue(unlock) a data with pushbutton. I am able to read data from db and lock it but in selection screen there should be a button which dequeues the table. However when I click button it does nothing. Here is my code:

tables:zes_h3a_t.
data: gt_kisi type table of zes_h3a_t,
      gs_kisi type zes_h3a_t.
data: gv_unlock type sy-ucomm.

selection-screen pushbutton 1(10) but1 user-command cli.
"select-options so_id    for zes_h3a_t-id.
parameters: p_id type zes_h3a_t-id.
select-options so_ad    for zes_h3a_t-ad.
select-options so_soyad for zes_h3a_t-soyad.
select-options so_cnsyt for zes_h3a_t-cinsiyet.
select-options so_dgyer for zes_h3a_t-dogumyeri.
select-options so_dgtrh for zes_h3a_t-dogumtarihi.
select-options so_anaad for zes_h3a_t-anaadi.
select-options so_babad for zes_h3a_t-babaadi.
select-options so_krds  for zes_h3a_t-kardessayisi.
select-options so_ikmt  for zes_h3a_t-ikametsehri.
select-options so_mdnhl for zes_h3a_t-medenihal.
select-options so_boy   for zes_h3a_t-boy.
select-options so_kilo  for zes_h3a_t-kilo.
select-options so_egtm  for zes_h3a_t-egitim.
select-options so_mslk  for zes_h3a_t-meslek.
select-options so_maas  for zes_h3a_t-maas.
select-options so_ehlyt for zes_h3a_t-ehliyet.
select-options so_enstr for zes_h3a_t-enstruman.
select-options so_hobi  for zes_h3a_t-hobi.
select-options so_sigar for zes_h3a_t-sigara.

start-of-selection.
  call function 'ENQUEUE_EZ_H3A'
    exporting
      mode_zes_h3a_t = 'E'
      mandt          = sy-mandt
      id             = p_id
*     X_ID           = ' '
      _scope         = '1'
*     _WAIT          = ' '
*     _COLLECT       = ' '
    exceptions
      foreign_lock   = 1
      system_failure = 2
      others         = 3.
  if sy-subrc = 1.
    message 'Bu veri başka bir kullanıcı tarafından kilitlenmiştir.' type 'I'.
  else.

    select id         ad soyad     cinsiyet
           dogumyeri  dogumtarihi  anaadi
           babaadi    kardessayisi ikametsehri
           medenihal  boy          kilo
           egitim     meslek       maas
           ehliyet    enstruman    hobi
           sigara

    from zes_h3a_t

    into corresponding fields of table gt_kisi

      where id         eq p_id     and ad          in so_ad    and
            soyad      in so_soyad and cinsiyet    in so_cnsyt and
            dogumyeri  in so_dgyer and dogumtarihi in so_dgtrh and
            anaadi     in so_anaad and babaadi     in so_babad and
          kardessayisi in so_krds  and ikametsehri in so_ikmt  and
            medenihal  in so_mdnhl and boy         in so_boy   and
            kilo       in so_kilo  and egitim      in so_egtm  and
            meslek     in so_mslk  and maas        in so_maas  and
            ehliyet    in so_ehlyt and enstruman   in so_enstr and
    hobi       in so_hobi  and sigara      in so_sigar.

  endif.


  write:/1 'KİMLİK NO',      20 'AD',            40 'SOY AD',      60 'CİNSİYET',
        80 'DOĞUM YERİ',    100 'DOĞUM TARİHİ', 120 'ANA ADI',    140 'BABA ADI',
       160 'KARDEŞ SAYISI', 180 'İKAMET ŞEHRİ', 200 'MEDENİ HAL', 220 'BOY',
       240 'KİLO',          260 'EĞİTİM',       280 'MESLEK',     300 'MAAŞ',
       320 'EHLİYET',       340 'ENSTÜMAN',     360 'HOBİ',       380 'SİGARA'.

  skip 1.
  loop at gt_kisi into gs_kisi.
    write:/1 gs_kisi-id,          20 gs_kisi-ad,        40 gs_kisi-soyad,
          60 gs_kisi-cinsiyet,    80 gs_kisi-dogumyeri,100 gs_kisi-dogumtarihi,
         120 gs_kisi-anaadi,     140 gs_kisi-babaadi,  160 gs_kisi-kardessayisi,
         180 gs_kisi-ikametsehri,200 gs_kisi-medenihal,220 gs_kisi-boy,
         240 gs_kisi-kilo,       260 gs_kisi-egitim,   280 gs_kisi-meslek,
         300 gs_kisi-maas,       320 gs_kisi-ehliyet,  340 gs_kisi-enstruman,
         360 gs_kisi-hobi,       380 gs_kisi-sigara.
  endloop.

at user-command.
  if sy-ucomm eq 'CLI'.
    call function 'DEQUEUE_EZ_H3A'
      exporting
        mode_zes_h3a_t = 'E'
        mandt          = sy-mandt
        id             = p_id
*       X_ID           = ' '
        _scope         = '3'
*       _SYNCHRON      = ' '
*       _COLLECT       = ' '
      .
  endif.
2 REPLIES 2
Read only

lenastodal
Product and Topic Expert
Product and Topic Expert
0 Likes
847

Welcome and thanks for visiting SAP Community to get answers to your questions. Since you're new, I recommend having a look at our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members.
The more details you provide, the more likely it is that members will be able to help you. Should you wish, you can revise your question by selecting Actions, then Edit.
By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM


Join or subscribe to SAP Community Groups to stay up-to-date, including SAP TechEd Group.
Read only

Patrick_vN
Active Contributor
847

Have you checked the abap_docu on the PUSHBUTTON statement? Instead of using the AT USER COMMAND event, you should use the AT_SELECTION_SCREEN one.

Like this:

AT SELECTION-SCREEN.
  CASE sscrfields.
    WHEN 'CLI'.
      ... [insert your code here] ...
  ENDCASE.