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

What does this code mean? please help!!

Former Member
0 Likes
920

IF NOT p_htkl IS INITIAL.

r_htkl-sign='I'.

r_htkl-option='EQ'.

r_htkl-low=p_htkl.

APPEND r_htkl.

It is written after SELECTION-SCREEN block. I got the SELECTION-SCREEN part but I couldn't get this code. Please help me to understand.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
881

r_htkl must be a range table. check the declaration part of it.

p_htkl is a parameter on selection screen i hope.

so, there are four fields on a range table.(range table are similar to your select options)

1. SIGN ( I or E - Inclusive or Exculsive)

2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)

3. LOW (value)

4. HIGH (value)

so..

IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
APPEND r_htkl. " the range table is appended.
endif.

so this range table can be used in select statements as :

select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or

in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.

Had it been

r_htkl-sign='E'.

then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.

as exclusive of the option.

etc.

hope this is clear.

AND PLEASE CLOSE THE OTHER THREAD (duplicate)

7 REPLIES 7
Read only

Former Member
0 Likes
882

r_htkl must be a range table. check the declaration part of it.

p_htkl is a parameter on selection screen i hope.

so, there are four fields on a range table.(range table are similar to your select options)

1. SIGN ( I or E - Inclusive or Exculsive)

2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)

3. LOW (value)

4. HIGH (value)

so..

IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
APPEND r_htkl. " the range table is appended.
endif.

so this range table can be used in select statements as :

select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or

in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.

Had it been

r_htkl-sign='E'.

then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.

as exclusive of the option.

etc.

hope this is clear.

AND PLEASE CLOSE THE OTHER THREAD (duplicate)

Read only

0 Likes
881

So here, Are we getting data from data base or adding data to the table?

Read only

0 Likes
881

No...

Append just adds one row to the range table r_hktl. its an internal table like a temp storage in ABAP memory.. it has nothing to do with database.

and append is not used for database tables, nor the assigning can fecth data from database.

only statements like SELECT fetch data from database.

Read only

0 Likes
881

Then why SELECTION-SCREEN is used before the code that I wrote first? As I know, SELECTION-SCREEN formats the selection screen. If we don't get data from the screen, why do we used it?

Read only

0 Likes
881

do you have it in

AT SELECTION-SCREEN.

this event is triggered as the last event in selection screen and before start-of-selection. so your code is filling value before any other part starts.

show me the code for

selection screen and the code you are asking about as they are written.

Read only

0 Likes
881

This message was moderated.

Read only

0 Likes
881

This message was moderated.