SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Пример привязки динамического Search-Help к полю



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Search Help, Match Code
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Nov 04, 2007 11:03 am    Post subject: Пример привязки динамического Search-Help к полю Reply with quote

Существует два способа показа Search-Help
1) С использованием сформированной программой внутренней таблицы
2) С использованием таблицы, существующей в словаре

Вызов search-help происходит в событии
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so.
для указанного поля экрана

Пример с использованием внутренней таблицы
Code:

DATA: BEGIN OF LI_FABGRP OCCURS 0,
FABGRP LIKE ZAPO_FABGRP-FABGRP,
BEGDA LIKE ZAPO_FABGRP-BEGDA,
END OF LI_FABGRP.
 
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE,
L_RETFIELD TYPE DFIES-FIELDNAME.
 
parameters : S_FABGR like ZAPO_FABGRP-FABGRP.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
 
SELECT FABGRP BEGDA FROM ZAPO_FABGRP INTO table LI_FABGRP.
 
SORT LI_FABGRP BY FABGRP ASCENDING BEGDA DESCENDING.
 
* Henter de mulige fabriksgrupper med nyeste BEGDA *indenfor hver
DELETE ADJACENT DUPLICATES FROM LI_FABGRP COMPARING FABGRP.
 
L_RETFIELD = 'FABGRP'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = L_RETFIELD
DYNPPROG = SY-REPID
DYNPNR = '1000'
DYNPROFIELD = 'S_FABGR'
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
TABLES
VALUE_TAB = LI_FABGRP
RETURN_TAB = T_RETURN
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.


Пример с использованием таблицы в словаре

Code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_FABGR.
 
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
  EXPORTING
    tabname                   = mara
    fieldname                 = matnr
*   SEARCHHELP                = ' '
*   SHLPPARAM                 = ' '
*   DYNPPROG                  = ' '
*   DYNPNR                    = ' '
*   DYNPROFIELD               = ' '
*   STEPL                     = 0
*   VALUE                     = ' '
*   MULTIPLE_CHOICE           = ' '
*   DISPLAY                   = ' '
*   SUPPRESS_RECORDLIST       = ' '
*   CALLBACK_PROGRAM          = ' '
*   CALLBACK_FORM             = ' '
*   SELECTION_SCREEN          = ' '
* IMPORTING
*   USER_RESET                =
* TABLES
*   RETURN_TAB                =
* EXCEPTIONS
*   FIELD_NOT_FOUND           = 1
*   NO_HELP_FOR_FIELD         = 2
*   INCONSISTENT_HELP         = 3
*   NO_VALUES_FOUND           = 4
*   OTHERS                    = 5
          .


Example 2
Code:
REPORT  ZTEST_F4HELP                              .
 
*---Report with selection screen and to display the list of
* possible entries for field 'B' as per the value in field 'A'.
 
 
parameters: p_vbeln type vbak-vbeln,
            p_posnr type vbap-posnr.
 
at selection-screen on value-request for p_posnr.
 
 
  data: begin of help_item occurs 0,
          posnr type vbap-posnr,
          matnr type vbap-matnr,
          arktx type vbap-arktx,
        end of help_item.
 
  data: dynfields type table of dynpread with header line.
 
 
  dynfields-fieldname = 'P_VBELN'.
  append dynfields.
 
  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.
 
 
  read table dynfields with key fieldname = 'P_VBELN'.
 
  p_vbeln = dynfields-fieldvalue.
 
 
  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = p_vbeln
       importing
            output = p_vbeln.
 
  select posnr matnr arktx into table help_item
                 from vbap
                      where vbeln = p_vbeln.
 
 
 
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'POSNR'
            dynprofield = 'P_POSNR'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = help_item.


Example 3
Code:

report zrich_0001 .

data: begin of ihelp occurs 0,
field type char10,
ftext type char50,
end of ihelp.
data: a_field(20) type c.

select-options s_field for a_field.

initialization.

ihelp-field = 'A'.
ihelp-ftext = 'Description A'.
append ihelp.

ihelp-field = 'B'.
ihelp-ftext = 'Description B'.
append ihelp.

ihelp-field = 'C'.
ihelp-ftext = 'Description C'.
append ihelp.

at selection-screen on value-request for s_field-low.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'FIELD'
dynprofield = 'S_FIELD'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = ihelp.

start-of-selection.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Search Help, Match Code All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.