12-26-2007 10:35 AM
Hi all,
i have the below code as input screen.
PARAMETERS : P_BUKRS TYPE BKPF-BUKRS OBLIGATORY. "Company Code
data : belnr type bkpf-belnr.
SELECT-OPTIONS : s_belnr FOR belnr. "Document number
PARAMETERS : P_GJAHR TYPE BKPF-GJAHR OBLIGATORY. "Fiscal Year
PARAMETERS : P_USNAM TYPE BKPF-USNAM .
After the above i have the code
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_USNAM.
After this i neede to use the select statement
SELECT DISTINCT USNAM FROM BKPF
INTO CORRESPONDING FIELDS OF TABLE it_bkpf1
WHERE bukrs eq p_bukrs AND gjahr eq p_gjahr
and belnr IN s_belnr.
But wen am using the above code S_BELNR is a SELECT-OPTION field so its value is not passing when i checked debugging so i kept the SELECT statement above AT SELECTION-SCREEN i can see the S_BELNR is there when i debugged but its not passing into the AT SELECTION-SCREEN.Please help
Vijay
12-26-2007 10:41 AM
Hi,
still you are in selection-screen events, that is the reason why the values are not getting assigned to your S_BELNR, there are 2 solutions for this.
1) after entering the values into S_BELNR, press ENTER key and then go for F4 help in P_USNAM.
i think the above one is not feasible solution.
2) use the function module "DYNP_VALUES_READ" function module by using this you can read any of your selection screen field along with their values.
Reward if useful.
Thanks,
Sreeram.
12-26-2007 10:42 AM
Hi,
If this the same code u have written and u r not getting the output then after at selection screen output statements and before writing the select statements write Start-of-selection..
then only it will aceept tht statement and gives the otuput orelse it will take it as the at selection screen area only..
Hope it might solve ur prolem..
Regards,
sana.
reward points if found helpful./
12-26-2007 10:53 AM
Hi misbah,,
Very good answer but i didnt mention one point here
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_USNAM.
PERFORM read_selection_screen.
SELECT * FROM BKPF
INTO CORRESPONDING FIELDS OF TABLE it_bkpf1
where belnr IN s_belnr and
bukrs = p_bukrs AND gjahr = p_gjahr.
You can see there is a PERFORM function and because of that now if am keeping the START-OF-SELECTION its not working.Am mentioning the total code so that you will have an idea about it.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_USNAM.
PERFORM read_selection_screen.
SELECT * FROM BKPF
INTO CORRESPONDING FIELDS OF TABLE it_bkpf1
where belnr IN s_belnr and
bukrs = p_bukrs AND gjahr = p_gjahr.
IF NOT it_bkpf1[] IS INITIAL.
SORT it_bkpf1 BY BELNR.
DELETE ADJACENT DUPLICATES FROM it_bkpf1 COMPARING USNAM.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'USNAM'
dynpprog = SY-REPID
dynpnr = '1000'
dynprofield = 'P_USNAM'
value_org = 'S'
TABLES
value_tab = it_bkpf1
return_tab = t_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE it_bkpf INDEX 1.
MOVE it_bkpf1-usnam TO P_USNAM.
ENDIF.
ENDIF.
12-26-2007 10:47 AM
Hi Vijay
Values entered on the selection screen will be considered only after the PAI of the screen is triggered. The VALUE-REQUEST event does not trigger the PAI and so the values of the parameters will not be available. (To verify this, first enter some data and press ENTER key. Now if u do an F4 on P_USNAM, the parameter values will be available).
To overcome this, use the Function module DYNP_VALUES_UPDATE under the value-request event and update the parameters with the already existing values. After that do the Select.
Thanks
Sharath.
12-26-2007 10:53 AM
Hi Vijay,
Here I'm giving Sample Program. It is same as per ur requirement. Try in this way.
REPORT ZAN_SELSCR.
PARAMETERS : P_MATKL TYPE MARA-MATKL,
P_MATNR TYPE MARA-MATNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
DATA: BEGIN OF DYNPFIELDS OCCURS 1.
INCLUDE STRUCTURE DYNPREAD.
DATA: END OF DYNPFIELDS.
DATA: BEGIN OF IT_MATNR OCCURS 0,
MATNR TYPE MARA-MATNR,
END OF IT_MATNR.
MOVE 'P_MATKL' TO DYNPFIELDS-FIELDNAME.
APPEND DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
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
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE DYNPFIELDS WITH KEY FIELDNAME = 'P_MATKL'.
P_MATKL = DYNPFIELDS-FIELDVALUE .
SELECT MATNR FROM MARA
INTO TABLE IT_MATNR
WHERE MATKL = P_MATKL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = 'MARA'
RETFIELD = 'MATNR'
PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_MATNR
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
12-26-2007 10:59 AM
Hi Vijay Krishna,
Check the value of the field lv_dyname.
DATA: lv_dyname LIKE d020s-prog VALUE 'ZJOURNALREGISTER_NEW',
assign the value sy-repid to the field lv_dyname instead of hard-coding
FORM read_selection_screen.
DATA: lv_dyname LIKE d020s-prog VALUE 'ZJOURNALREGISTER_NEW', " Check if you are passing current program name herelv_dynumb LIKE d020s-dnum VALUE '1000'.
DATA: BEGIN OF lt_dynpfields OCCURS 3.
INCLUDE STRUCTURE dynpread.
DATA: END OF lt_dynpfields.
MOVE 'P_BUKRS' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE '' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'P_GJAHR' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'S_BELNR-LOW' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'S_BELNR-HIGH' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'P_USNAM' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
lv_dyname = sy-repid.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = lv_dyname
dynumb = lv_dynumb
translate_to_upper = 'X'
TABLES
dynpfields = lt_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
ENDFORM. " read_selection_screen
12-26-2007 11:14 AM
Hi Vijay,
I think tht here in ur code u hav used at selection screen on value request as per my knowledge genrally we use this for before using fm F4_filename ..providing F4 functionality..
If u r using it to validate then do not use this instead use AT selection-screen on pa_filedname. and use start-of-selection.
i guess it will solve ur problem..
REgards,
Sana.
12-26-2007 11:30 AM
Hi misbah,
Actually i need the F4 functionality for this program..Please help.
Vijay
12-26-2007 12:11 PM
Hi Vijay,
Try this u are using at selection screen oin value request on value fine there itself after tht u call the f4 functionality function module later then u write start-of-selection,
then perform. form then it will work fine.here u are using At selection-screen on value request and somewhere else u r using the f4_function module thts the reason it is not accepting start of selection. do like this it may be solved.
Regards,
Sana..
Reward points for helpful answers...