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

ABAP code

fhfarooqui1913
Explorer
0 Likes
1,399

Hi Experts....

Can you guys look at this and tell me whats wrong with this code:

DATA : LS_9105 TYPE HRP9105.

DATA: ls_act_beh_flag TYPE string.

DATA: LS_WPLOG_VDATA TYPE string.

DATA: LS_cand_id TYPE string.

DATA: ls_hrobject TYPE hrobject.

SELECT * FROM HRP9105 INTO LS_9105

WHERE LS_cand_id = ls_hrobject-objid

AND subty = ‘INVB’

AND endda > SY-DATUM.

IF SY-SUBRC = 0

SEND ‘false’ to ls_act_beh_flag

ELSE

SEND ‘true’ to <ls_act_beh_flag

ENDIF.

The error I am getting is : LS_cand_id unknown.

Can you guys help me on this...

Thanks

fhf

8 REPLIES 8
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,346

hi,

check fields of table HRP9105 (in SE11), LS_cand_id does not exist (which you use in WHERE)...

ec

Read only

0 Likes
1,346

I cannot see this table in my system sap, but, i am sure that the field LS_cand_id is dificult to be in a standard table of sap. Perhaps it not exists, or have another name similar.

Read only

naimesh_patel
Active Contributor
0 Likes
1,346

HRP9105 must not have a component with the name LS_cand_id .

Open HRP9105 it into SE11 and try to check the components.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
1,346

Hi

The error should be here:

SELECT * FROM HRP9105 INTO LS_9105
         WHERE LS_cand_id = ls_hrobject-objid <---

It seems the table

HRP9105

hasn't the field

LS_CAN_ID



LS_CAN_ID

is a variable of your program, check which field has to be used by SE11

U could have other problem with the statament SEND, I suppose you want to use MOVE:

SELECT * FROM HRP9105 INTO LS_9105
          WHERE LS_cand_id = ls_hrobject-objid
            AND subty = ‘INVB’
            AND endda > SY-DATUM.
  IF SY-SUBRC = 0
*  SEND ‘false’ to ls_act_beh_flag
   MOVE 'false' to ls_act_beh_flag
  ELSE
*  SEND ‘true’ to  ls_act_beh_flag
   MOVE 'true' to  ls_act_beh_flag
  ENDIF.

At the last you should considere if the program run the abap code inclused in a SELECT statament the SY-SUBRC is always true, so your code should be:

SELECT * FROM HRP9105 INTO LS_9105
          WHERE LS_cand_id = ls_hrobject-objid
            AND subty = ‘INVB’
            AND endda > SY-DATUM.
  ENDSELECT.      
  IF SY-SUBRC = 0
   MOVE 'false' to ls_act_beh_flag
  ELSE
   MOVE 'true' to  ls_act_beh_flag
  ENDIF.

Max

Read only

0 Likes
1,346

Thanks for this code. However, I am now I am getting an error saying: subty is not a valid comparison operator>. Can you help??

Read only

fhfarooqui1913
Explorer
0 Likes
1,346

I am sorry guys to not tell you the whole scenario, I am using this code in a method in the bsp application. I am declaring LS_cand_id as local, DATA: LS_cand_id TYPE string. HRP9105 is a custom infotype and this does not has the fiels LS_cand_id. In other words, I am using ls_hrobject to read the data and move it into ls_cand_id. The code for ls_hrobject is not included in this conversation where ls_hrobject is reading the candidate ID. Anyway, I thought, if I declare LS_cand_id as local than it should recognize it. I am still lost....

Read only

Former Member
0 Likes
1,346

HI,

I think LS_cand_id field does not exist in the table HRP9105, check table HRP9105 in SE11.

Please Reward,

Mahi.

Read only

0 Likes
1,346

You are correct, it doesn't exist as I mentioned it in my previous post. I declared the field as local and am moving the data into it. Its not an issue anymore. I fixed it.

Thanks

fhf