‎2009 Dec 04 11:14 AM
Hallo Gurus,
I have this problem:
in transaction ME21N I have linked a custom Search help on field "Outline agreement" (on PO position).
To develop search help I have used a "search help exit" using a custom function.
In this function I have used function DYNP_VALUES_READ to read the fields that user has filled on the main screen of Purchase order, but the function does not give any result (table empty...).
I have used both SAPLMEGUI 1211
and SAPLMEGUI 0014
as program / dynpro in the function interface.
Could I trouble you for a help...?
Thank you very much!!!
‎2009 Dec 04 11:20 AM
Hi
data : dynpread type standard table of dynpread with header line.
* You need to pass fieldname to the Dynpread-fieldname.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = dyname
dynumb = dynumb
TABLES
dynpfields = dynpfields " You need to pass this one
EXCEPTIONS " All exceptions should uncommented
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
if sy-subrc is initial.
read table dynpread with key fieldname = 'YOUR_FIELD_NAME'
endifCheerz
Ram
‎2009 Dec 04 11:25 AM
Hallo Ram,
thanks for your kind answer.
Actually the instruction "tables ******" and the exceptions were already uncommented.
Mick
‎2009 Dec 04 11:43 AM
Try the following code i hope this will resolve your concern
TABLES:dd03l.
DATA : BEGIN OF ptab OCCURS 0,
field LIKE dd03l-fieldname,
END OF ptab.
DATA : BEGIN OF dynpfields OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA : END OF dynpfields.
DATA: it_ret TYPE STANDARD TABLE OF ddshretval,
wa_ret TYPE ddshretval.
data: read_table TYPE char7.
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS : p_table TYPE dd03l-tabname OBLIGATORY. "Table name
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN : BEGIN OF BLOCK block2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK block2.
‎2009 Dec 04 11:43 AM
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_field-low.
MOVE 'P_TABLE' TO dynpfields-fieldname.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = dynpfields
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.
IF sy-subrc <> 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO "comment thiese two lines and execute now
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE dynpfields INDEX 1 TRANSPORTING fieldvalue.
MOVE dynpfields-fieldvalue TO p_table.
SELECT fieldname FROM dd03l INTO TABLE ptab WHERE tabname = p_table.
‎2009 Dec 04 11:44 AM
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'S_FIELD-LOW'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_FIELD-LOW'
value_org = 'S'
multiple_choice = 'X'
TABLES
value_tab = ptab[]
return_tab = it_ret.
IF sy-subrc = 0.
CLEAR: read_table.
IF s_field[] IS INITIAL.
read_table = 'S_FIELD'.
ELSE.
read_table = 'IT_RET'.
ENDIF.
LOOP AT it_ret INTO wa_ret.
s_field-sign = 'I'.
s_field-option = 'EQ'.
s_field-low = wa_ret-fieldval.
APPEND s_field.
ENDLOOP.
IF read_table = 'S_FIELD'.
READ TABLE s_field INDEX 1.
ELSEIF read_table = 'IT_RET'.
CLEAR: s_field.
READ TABLE it_ret INTO wa_ret INDEX 1.
ENDIF.
ENDIF.
‎2009 Dec 04 1:39 PM