Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SELECT

Former Member
0 Likes
1,448

Hi all

In the code below am debugging at the select statement.I can see both my values of p_gjahr and p_bukrs but the field s_belnr is not showeing any value though i gave a input range in the input screen.I also tried using the START-OF-SELECTION but its not working.Please help.

Vijay

REPORT ZABAP9.

TABLES:BKPF.

TYPES:BEGIN OF t_bkpf ,

usnam type BKPF-USNAM,

belnr TYPE BKPF-belnr,

END OF t_bkpf.

DATA : t_return TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE.

DATA:it_bkpf TYPE STANDARD TABLE OF t_bkpf WITH HEADER LINE.

PARAMETERS : P_BUKRS TYPE BKPF-BUKRS OBLIGATORY.

PARAMETERS : P_GJAHR TYPE BKPF-GJAHR OBLIGATORY.

DATA:belnr TYPE bkpf-belnr.

SELECT-OPTIONS : s_belnr FOR bkpf-belnr.

PARAMETERS : P_USNAM TYPE BKPF-USNAM .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_USNAM.

PERFORM read_selection_screen.

SELECT * FROM BKPF

INTO CORRESPONDING FIELDS OF TABLE it_bkpf

WHERE bukrs eq p_bukrs AND gjahr eq p_gjahr

and belnr IN s_belnr.

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_bkpf

return_tab = t_return

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF NOT it_bkpf[] IS INITIAL.

SORT it_bkpf BY belnr.

DELETE ADJACENT DUPLICATES FROM it_bkpf COMPARING USNAM.

IF sy-subrc = 0.

READ TABLE it_bkpf INDEX 1.

ENDIF.

ENDIF.

FORM read_selection_screen.

DATA: lv_dyname LIKE d020s-prog VALUE 'ZABAP9',

lv_dynumb LIKE d020s-dnum VALUE '1000'.

DATA: BEGIN OF lt_dynpfields OCCURS 3.

INCLUDE STRUCTURE dynpread.

DATA: END OF lt_dynpfields.

lt_dynpfields-fieldname = 'P_BUKRS'.

APPEND lt_dynpfields.

lt_dynpfields-fieldname = 'P_GJAHR'.

APPEND lt_dynpfields.

lt_dynpfields-fieldname = 'S_BELNR-LOW'.

APPEND lt_dynpfields.

lt_dynpfields-fieldname = 'S_BELNR-HIGH'.

APPEND lt_dynpfields.

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

invalid_parameter = 07

undefind_error = 08

double_conversion = 09

stepl_not_found = 10

OTHERS = 11.

if sy-subrc eq 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

CLEAR: lt_dynpfields.

LOOP AT lt_dynpfields.

CASE lt_dynpfields-fieldname.

WHEN 'P_BUKRS'.

p_bukrs = lt_dynpfields-fieldvalue.

WHEN 'P_GJAHR'.

p_gjahr = lt_dynpfields-fieldvalue.

WHEN 'S_BELNR-LOW'.

p_usnam = lt_dynpfields-fieldvalue.

WHEN 'S_BELNR-HIGH'.

p_usnam = lt_dynpfields-fieldvalue.

ENDCASE.

ENDLOOP.

ENDFORM. " read_selection_screen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,424

Hi,

May be because of conversion exits.

use one of the these...

CONVERSION_EXIT_ALPHA_INPUT

CONVERSION_EXIT_ALPHA_OUTPUT function module .you will get data.

regards,

paras

17 REPLIES 17
Read only

Former Member
0 Likes
1,425

Hi,

May be because of conversion exits.

use one of the these...

CONVERSION_EXIT_ALPHA_INPUT

CONVERSION_EXIT_ALPHA_OUTPUT function module .you will get data.

regards,

paras

Read only

0 Likes
1,424

Hi paras

Can u tell me exactly where i need to use the function module.

Vijay

Read only

0 Likes
1,424

hi,

before your select query...

PERFORM read_selection_screen.

*****Here you need to call *****

SELECT * FROM BKPF

INTO CORRESPONDING FIELDS OF TABLE it_bkpf

WHERE bukrs eq p_bukrs AND gjahr eq p_gjahr

and belnr IN s_belnr.

regards,

paras

Read only

0 Likes
1,424

Hi paras

Is the code correct but am still not getting getting.Please help.

Vijay

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = s_belnr

IMPORTING

OUTPUT = s_belnr.

Read only

Former Member
0 Likes
1,424

Hi,

In the bottom part of debugging screen enter field name or double click on the field u want to see

Regards

Read only

0 Likes
1,424

Hi

When am debugging and clicking am getting the field.My question is the value am entering is not coming.Please help

Read only

0 Likes
1,424

Hi evryone,

AFter entering the values if i hit enter then if i debug and diuble click on s_belnr i can see that s_belnr is taking its value.Please help

VIjay

Read only

0 Likes
1,424

Hi,

in ur code clear statement is there after reading using fm do u think it is affecting it

Regards

Read only

0 Likes
1,424

Hi,

No its is not impacting.

Vijay

Read only

Former Member
0 Likes
1,424

Hai,

It is because of this statement:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_USNAM.

If you remove the above statement and try again, you can get the values of s_belnr also.

Read only

0 Likes
1,424

Hi eswar

i cant remove that piec of code AT_SELECTIOn....because its an input field with F4 functioanlity

VIjay

Read only

Former Member
0 Likes
1,424

Hi Vijay Krishna,

add the following statements in bold to your program.

WHEN 'S_BELNR-LOW'.

s_belnr-low = lt_dynpfields-fieldvalue.

p_usnam = lt_dynpfields-fieldvalue.

WHEN 'S_BELNR-HIGH'.

s_belnr-sign = 'I'.

s_belnr-option = 'BT'.

s_belnr-high = lt_dynpfields-fieldvalue.

APPEND s_belnr.

p_usnam = lt_dynpfields-fieldvalue.

Read only

0 Likes
1,424

Hi rajesh

added your statements the s_belnr i can see the values when am debuging.BUt in the select statement is not executing.

SELECT * FROM bkpf

INTO CORRESPONDING FIELDS OF TABLE it_bkpf

WHERE bukrs EQ p_bukrs AND gjahr EQ p_gjahr

AND belnr IN s_belnr.

What i mean is the check condition of p_gjahr and p_bukrs is checking but the selection is not applybg to the line

belnr IN s_belnr.

Read only

0 Likes
1,424

Hi Vijay,

Please ensure that you are filling both LOW and HIGH values in the selection screen, otherwise the option 'BT' doesn't work. Also add the following statement before APPEND statement

CLEAR s_belnr[].

APPEND s_belnr.

Read only

0 Likes
1,424

Hi rajesh

Its not working stll...but if hit 'ENTER' its working good.Please help

Vijay

Read only

0 Likes
1,424

Please post the table entries(s_belnr) that you see in debugging mode before the SELECT..statement

(Assuming that the problem is with the SELECT statement as you have explained before, if this is not the problem, kindly elaborate your problem, also explain the way you are expecting the program to behave)

Read only

Former Member
0 Likes
1,424

Hi Vijay,

Try changing the order of selection screen fields and/or try making belnr range as obligatory, also keep all data declerations before selection screen definition.

Award points if useful.

With Regards,

Zafar Ali