I have a requirement wherin I need to read the field KALA-KADAT (Costing date from) from CK40N transaction into and Z- function module which is called internally for costing purpose.
To read the value I am using the FM 'DYNP_VALUES_READ'
The code is as below.
DATA: gt_dyfields TYPE STANDARD TABLE OF dynpread,
gw_dyfields TYPE dynpread.
gw_dyfields-fieldname = 'KALA-KADAT'.
APPEND gw_dyfields TO gt_dyfields.
CALL FUNCTION 'DYNP_VALUES_READ'
dyname = 'SAPLCKCC02'
dynumb = '3120'
dynpfields = gt_dyfields
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
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
IF gt_dyfields IS NOT INITIAL.
READ TABLE gt_dyfields INTO gw_dyfields INDEX 1.
lv_date = gw_dyfields-fieldvalue.
Inspite of the prog name and screen number being correct I am getting sy-subrc = 3 i.e invalid_dynproname.
Can anybody please help me out with this.
The CK40N has several screens and subscreens. Is there any other parameters we need to pass in the FM??
Or is there any other way to read this field.
Points shall be rewarded for appropriate solutions.
Thanks in advance,