Hi Abapers,
I've been using this FM in the past with no issues until now. I am using it in the Enhanc./User exit (EXIT_SAPLCOZV_001) Func.Group XCO1, to check a value from field AFPOD-ABLAD (Uploading Point) at the Prod.Order creation and so far this exit get trigger anytime trying to Save the Prod.Order.
As you know, the Prod.Order screen (CO01) has multiples Subscreens, and this field is located is Subscreen 0190 (Tab Goods Receipts).
The problem rise when I try to save the order from a different Subscreen (Ex. Master Data tab). The FM 'DYNP_VALUES_READ' give the exception error:
invalid_dynproname, because does not recognize the Subscreen 0190 (Goods Receipt) that I need to read to check the value for Uploading Point.
By the way, I already tried using the Exit (EXIT_SAPLCOKO1_004) which has the field AFPOD-ABLAD as part of the parameter, but it get by-passed when you finally save the Order.
I cannot find any other FM to read subscreens or to make this FM to work from a different Subcreen.
Here is my code:
data: progname type sy-repid,
dynnum type sy-dynnr,
dynpro_values type table of dynpread,
field_value like line of dynpro_values.
field-symbols: <fs> type sy-repid,
<fv> type sy-dynnr.
if sy-tcode = 'CO01' or sy-tcode = 'CO02'.
if header_imp-werks = '5510'.
refresh dynpro_values.
progname = 'SAPLCOKO1'.
assign progname to <fs>.
dynnum = '0190'.
assign dynnum to <fv>.
move 'AFPOD-ABLAD' to field_value-fieldname.
append field_value to dynpro_values.
call function 'DYNP_VALUES_READ'
exporting
dyname = <fs>
dynumb = <fv>
translate_to_upper = 'X'
tables
dynpfields = dynpro_values
exceptions
invalid_dynproname = 1
invalid_dynpronummer = 2
invalid_dynprofield = 4
no_fielddescription = 6
invalid_parameter = 8.
if sy-subrc = 0.
loop at dynpro_values into field_value where fieldname = 'AFPOD-ABLAD'.
if field_value-fieldvalue is initial.
no_update = 'X'.
clear sy-ucomm.
message id 'ZEN' type 'E' number 035. "Give the error message to user asking for Uploading Point value
endif.
endloop.
elseif sy-subrc = 1.
no_update = 'X'. "Does not allow the Order to be saved
set screen '0190'. "Trying to force the program to go to the screen, but it doesn't work
endif.
endif.
endif.
Thanks for any suggestion or help.
Juan