2007 Nov 29 1:55 PM
2007 Nov 29 2:00 PM
REPORT zsel_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.
**Read the Values of the SCREEN FIELDs
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.
**Find out the Value of P_VBELN
READ TABLE dynfields WITH KEY fieldname = 'P_VBELN'.
p_vbeln = dynfields-fieldvalue.
**Convert the Value into internal format
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_vbeln
IMPORTING
output = p_vbeln.
**Fetch the correponding itemnos from VBAP
SELECT posnr matnr arktx INTO TABLE help_item
FROM vbap
WHERE vbeln = p_vbeln.
**Generate the F4 help with internal table values
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.
2007 Nov 29 2:02 PM
Hi,
Make use of the sample code.
*Internal table for capturing input data
DATA : BEGIN OF T_VALIDATION OCCURS 0.
INCLUDE STRUCTURE DYNPREAD.
DATA END OF T_VALIDATION.
V_PROGNAME = SY-REPID.
W_SCR_NUMBER = SY-DYNNR.
T_VALIDATION-FIELDNAME = 'P_COMP'.
APPEND T_VALIDATION.
CLEAR T_VALIDATION.
*Picking Input value of domain
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = V_PROGNAME
DYNUMB = W_SCR_NUMBER
TABLES
DYNPFIELDS = T_VALIDATION.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_VALIDATION WHERE FIELDNAME = 'P_COMP' .
P_COMP = T_VALIDATION-FIELDVALUE.
ENDLOOP.
Hope this helps you.
Regards,
Subbu.
2007 Nov 29 2:30 PM
Hi,
pls find the below sample code.
i have taken 'Material' and 'Material description' fields on selection screen, based on the material number entered if u want to display the materila description when you press F4 on materila description field.
REPORT ZTEMP_SDN20 .
data:
begin of t_maktx occurs 0,
maktx like makt-maktx,
end of t_maktx,
t_values type DYNPREAD occurs 0 WITH HEADER LINE,
v_prog like D020S-PROG.
TYPES: BEGIN OF X_RETURN .
INCLUDE STRUCTURE DDSHRETVAL. "Search help structure
TYPES: END OF X_RETURN.
data: l_dynpprog type sy-repid,
l_dynnr type sy-dynnr,
l_dynprofld TYPE help_info-dynprofld.
data: RETURN_TAB TYPE STANDARD TABLE OF X_RETURN WITH HEADER LINE.
selection-screen begin of block b1 with frame.
parameters:
p_matnr like mara-matnr,
p_maktx like makt-maktx.
selection-screen end of block b1.
at selection-screen on value-request for p_maktx.
v_prog = sy-repid.
REFRESH: t_values.
CLEAR: t_values.
t_values-fieldname = 'P_MATNR'.
APPEND t_VALUES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = v_prog
dynumb = '1000'
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
tables
dynpfields = t_values.
IF sy-subrc = 0.
READ TABLE T_VALUES INDEX 1.
IF SY-SUBRC = 0.
select maktx from makt into table t_maktx
where matnr = t_values-FIELDVALUE AND
SPRAS = SY-LANGU.
if sy-subrc = 0.
l_dynpprog = sy-repid.
l_dynnr = sy-dynnr.
l_dynprofld = 'MAKTX' .
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MAKTX'
DYNPPROG = l_dynpprog
DYNPNR = l_dynnr
DYNPROFIELD = l_dynprofld
VALUE_ORG = 'S'
tables
value_tab = t_maktx
RETURN_TAB = RETURN_TAB.
IF sy-subrc = 0.
IF NOT RETURN_TAB[] IS INITIAL.
READ TABLE RETURN_TAB INDEX 1.
IF SY-SUBRC = 0.
p_maktx = RETURN_TAB-FIELDVAL.
ENDIF.
ENDIF.
ENDIF.
endif.
ENDIF.
ENDIF.
Reward if needful.
Thanks,
Sreeram
2007 Nov 29 2:39 PM
see this code
DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
LC_PROG LIKE D020S-PROG,
LC_DNUM LIKE D020S-DNUM.
TRANSLATE F_FIELD TO UPPER CASE.
refresh ltab_fields.
LTAB_FIELDS-FIELDNAME = F_FIELD.
append ltab_fields.
LC_PROG = SY-REPID .
LC_DNUM = SY-DYNNR .
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = LC_PROG
DYNUMB = LC_DNUM
TABLES
dynpfields = ltab_fields
EXCEPTIONS
OTHERS = 01.
http://www.sap-img.com/abap/download-and-upload-your-abap-program.htm
Also see this
DATA:
I_DFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
Parameterwerte bestimmen
I_DFIELDS-FIELDNAME = 'P_DFILE'. APPEND I_DFIELDS.
I_DFIELDS-FIELDNAME = 'P_DLOCL'. APPEND I_DFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = 'ZJABOIFD'
DYNUMB = '1000'
TABLES
DYNPFIELDS = I_DFIELDS
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.
LOOP AT I_DFIELDS.
CASE I_DFIELDS-FIELDNAME.
WHEN 'P_DFILE'. P_DFILE = I_DFIELDS-FIELDVALUE.
WHEN 'P_DLOCL'. P_DLOCL = I_DFIELDS-FIELDVALUE.
ENDCASE.
ENDLOOP.
Regards
vasu
2012 Jan 23 7:07 AM
Hi Experts,
When i tried to excute the function module
it is going to dump,
however i created a prog ,it is alos going to dump,am trying to use this functionmodule for CO11n Tcode
DATA : DYNP TYPE TABLE OF DYNPREAD WITH HEADER LINE.
DATA : A1 TYPE AUFK-AUFNR.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = 'SAPLCOVG'
DYNUMB = '0100'
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = ' '
* START_SEARCH_IN_MAIN_SCREEN = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
DYNPFIELDS = DYNP
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.
* Implement suitable error handling here
ENDIF.
IF SY-SUBRC IS INITIAL.
IF DYNP-FIELDNAME = 'AUFNR'.
A1 = DYNP-FIELDVALUE.
ENDIF.
ENDIF.
Error Analyis:::
A RAISE statement in the program "SAPLSHL2" raised the exception
condition "INVALID_DYNPRONAME".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
No valid screen name
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
If the error occures in a non-modi
find an interim solution in an SAP
If you have access to SAP Notes, c
keywords:
"RAISE_EXCEPTION" " "
"SAPLSHL2" or "LSHL2U22"
"DYNP_VALUES_READ"
or
"SAPLSHL2" "INVALID_DYNPRONAME"
Regards,
Ashok.
Edited by: Ashok26 on Jan 23, 2012 8:09 AM
++Moderator Message: Please create a new thread for your problem.
Edited by: Suhas Saha on Jan 23, 2012 12:48 PM