software, software.sap

How To Call A SAP Search Help Manually

Sample 1:

  DATA: lf_shlp TYPE shlp_descr,
 

        lf_if TYPE ddshiface,
 

        lt_ret TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE.
 
 

      CLEAR: lf_shlp, lf_if.
 

      CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
 

        EXPORTING
 

          shlpname = 'MAT1'
 

          shlptype = 'SH'
 

        IMPORTING
 

          shlp     = lf_shlp.
 

      READ TABLE lf_shlp-interface INTO lf_if
 

        WITH KEY shlpfield = 'MATNR'.
 

      IF sy-subrc EQ 0.
 

        lf_if-valfield = 'X'.
 

        MODIFY lf_shlp-interface FROM lf_if INDEX sy-tabix.
 

      ENDIF.
 

      REFRESH lt_ret.
 

      CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
 

        EXPORTING
 

          shlp          = lf_shlp
 

          maxrecords    = 500
 

        TABLES
 

          return_values = lt_ret.
 

      READ TABLE lt_ret INDEX 1.
 

      CHECK sy-subrc EQ 0.
 

      e_matnr = lt_ret-fieldval.
 
 

Sample 2:

  method zfiif_fkm_doc_vale~park_fi_doc.

 data:
 lfd_xblnr_ist type bkpf-xblnr,
 lfd_xblnr_soll type bkpf-xblnr,
 lit_ret type standard table of ddshretval with default key,
 lrc_diaper type ref to cx_root,
 lwa_fbkey like line of pit_e_key,
 lwa_shlp type shlp_descr.

 field-symbols:
 <lwa_intf> type ddshiface,
 <lwa_ret> like line of lit_ret,
 <lwa_selopt> type ddshselopt.

 try.

 """"""""""""""""""""""""""""""
 " Arama yardımı ile belge numarası al
 """"""""""""""""""""""""""""""

 lfd_xblnr_soll = zficl_fkm_imp=>build_xblnr_for_parked_fi_doc( pwa_i_invhea-ppino ).

 call function 'F4IF_GET_SHLP_DESCR'
 exporting
 shlpname = 'H_VBKPF'
 importing
 shlp = lwa_shlp.


 loop at lwa_shlp-interface assigning <lwa_intf>.

 case <lwa_intf>-shlpfield.
 when c_fnam_bukrs.
 <lwa_intf>-valfield = abap_true.

 append initial line to lwa_shlp-selopt assigning <lwa_selopt>.
 <lwa_selopt>-shlpname = lwa_shlp-shlpname.
 <lwa_selopt>-shlpfield = <lwa_intf>-shlpfield.
 <lwa_selopt>-option = c_option_eq.
 <lwa_selopt>-sign = c_sign_i.
 <lwa_selopt>-low = pwa_i_invhea-bukrs.

 when c_fnam_belnr.
 <lwa_intf>-valfield = abap_true.

 when c_fnam_gjahr.
 <lwa_intf>-valfield = abap_true.

 append initial line to lwa_shlp-selopt assigning <lwa_selopt>.
 <lwa_selopt>-shlpname = lwa_shlp-shlpname.
 <lwa_selopt>-shlpfield = <lwa_intf>-shlpfield.
 <lwa_selopt>-option = c_option_eq.
 <lwa_selopt>-sign = c_sign_i.
 <lwa_selopt>-low = pwa_i_invhea-bldat+0(4).

 when c_fnam_xblnr.
 <lwa_intf>-valfield = abap_true.

 append initial line to lwa_shlp-selopt assigning <lwa_selopt>.
 <lwa_selopt>-shlpname = lwa_shlp-shlpname.
 <lwa_selopt>-shlpfield = <lwa_intf>-shlpfield.
 <lwa_selopt>-option = c_option_eq.
 <lwa_selopt>-sign = c_sign_i.
 <lwa_selopt>-low = lfd_xblnr_soll.

 endcase.

 endloop.


 call function 'F4IF_START_VALUE_REQUEST'
 exporting
 shlp = lwa_shlp
 tables
 return_values = lit_ret.

 loop at lit_ret assigning <lwa_ret>.
 case <lwa_ret>-fieldname.
 when c_fnam_bukrs. lwa_fbkey-bukrs = <lwa_ret>-fieldval.
 when c_fnam_belnr. lwa_fbkey-belnr = <lwa_ret>-fieldval.
 when c_fnam_gjahr. lwa_fbkey-gjahr = <lwa_ret>-fieldval.
 endcase.
 endloop.

 check lwa_fbkey is not initial.

 call function 'CONVERSION_EXIT_ALPHA_INPUT'
 exporting
 input = lwa_fbkey-belnr
 importing
 output = lwa_fbkey-belnr.


 """"""""""""""""""""""""""""""
 " Belgeyi valide et: Matbu no farklı ise uyarı göster
 """"""""""""""""""""""""""""""

 select single xblnr into lfd_xblnr_ist
 from bkpf
 where bukrs eq lwa_fbkey-bukrs and
 belnr eq lwa_fbkey-belnr and
 gjahr eq lwa_fbkey-gjahr.

 if lfd_xblnr_soll ne lfd_xblnr_ist.
 check zbccl_gui_toolkit=>are_you_sure( text-106 ) eq abap_true.
 endif.


 """"""""""""""""""""""""""""""
 " Döndür
 """"""""""""""""""""""""""""""

 append lwa_fbkey to pit_e_key.

 catch cx_root into lrc_diaper.

 raise exception type zcx_bc_method_call
 exporting
 textid = zcx_bc_method_call=>method_error
 previous = lrc_diaper
 clsname = c_clsname_me
 methname = zfiif_fkm_doc_vale=>c_meth_park_fi_doc.

 endtry.

 endmethod. "zfiif_fkm_doc_vale~park_fi_Doc
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s