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 PROBLEM

Former Member
0 Likes
657

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.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

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
636

Hi this may help u.

Ur code is correct.

The values are taking only after execution and not during execution.

Pls try to initialize those variables and then try to debug. This will solve the problem.

with regards,

Hema Sundara.

pls reward if u find it helpful.

5 REPLIES 5
Read only

Former Member
0 Likes
637

Hi this may help u.

Ur code is correct.

The values are taking only after execution and not during execution.

Pls try to initialize those variables and then try to debug. This will solve the problem.

with regards,

Hema Sundara.

pls reward if u find it helpful.

Read only

0 Likes
636

Hi

can u explain me further on initializing the variables

vijay

Read only

Former Member
0 Likes
636

Hi Vijay krishna,.

This is kiran kumar.G.I will send the code for initilization check it once ok..

INITILIZATION.

S_BELNR-SIGN = 'I'.

S_BELNR-OPTION = 'BT'.

S_BELNR-LOW = '0100000000'

S_BELNR-HIGH = '0100010930'.

APPEND S_BELNR.

Award points if helpful.

Kiran Kumar.g

Have a Nice Day..

Read only

0 Likes
636

hi kiran please tell me where it should be inserterd

vijay

Read only

Former Member
0 Likes
636

Hi Vijay,

U should place these statement after these statements.

SELECT-OPTIONS : s_belnr FOR bkpf-belnr.

PARAMETERS : P_USNAM TYPE BKPF-USNAM .

INITILIZATION.

Regards,

Kiran Kumar.g

Have a Nice Day..