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

Iam not getting any values from my code.

Former Member
0 Likes
1,052

IF RDSTDCover = 'ST' do the following:

-If PA0001-BURKS='1009' go to Table

ZGTPA_TL_SSNHIST to retrieve previous Company Code Text for

PA0002-PERID and send

the corresponding Sub Code according to table ZGTBA_TL_SUBCODE

-Else if If no value is found Lookup

PA0001-BURKS along with Report Number '100525'

and send Sub Code value from ZGTBA_TL_SUBCODE

Else, send blanks.

I have developed the code.But Iam not getting the any values.

if w_MetLife_detail-rdstdcover = c_st.
      if p0001-bukrs = c_1009.
select single ZBUKRS_TEXT from ZGTPA_TL_SSNHIST into l_ZBUKRS_TEXT where perid = w0002-perid.
 if sy-subrc eq 0.
w_MetLife_detail-rdstdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
 else.
  select single HIST_BUKRS from ZGTBA_TL_SUBCODE
                            into   l_bukrs
                            where ZREPORTNO  = c_100525.

          w_MetLife_detail-rdstdsubcde = ZGTBA_TL_SUBCODE-zsubcode.
        endif.
      endif.
    endif.

I was stuck up in the code.Please help me.

10 REPLIES 10
Read only

Former Member
0 Likes
1,024

Hi,

Are you debugging the code. If you can debug it properly then you can know the mistake..

And in spec you have If PA0001-BURKS='1009' go to Table

but in code it is if p0001-bukrs = c_1009.

Read only

0 Likes
1,024

Hi Venkat,

Thanks for your reply.

The table in the spec p0001 only.

My doubt is as per requirement is it correct code?or any changes are required.

Please help me.

Regards,

Sujan

Read only

0 Likes
1,024

Hi Sujan,

Is ZGTBA_TL_SUBCODE is a table or structure.

when u r assigning ZGTBA_TL_SUBCODE-zsubcode to ur variable what value it has as u have not performed any query on this table and stored the data in this structure. U can assign ZGTBA_TL_SUBCODE-zsubcode to a variable only if its a structure.

U should query on this subcode table and select subcode into some variable and then assign it. hope i am clear. Try to debug and see ur value for subcode.

Read only

0 Likes
1,024

Hi,

ZGTBA_TL_SUBCODE is a table.This table is having report number,ZBUKRS_TEXT(company code text) and subcode and paypoint,bukrs as a filed.

if f w_MetLife_detail-rdstdcover = c_st.

if p0001-bukrs = c_1009.

then iam sending subcode value into final table.That is iam doing.Is it correct way?

Regards,

Sujan

Read only

0 Likes
1,024

There is no problem wiyth these 2 lines.

1. Declare ZGTBA_TL_SUBCODE type ZGTBA_TL_SUBCODE.

2. But after ur first select query u need to fetch subcode value from table ZGTBA_TL_SUBCODE.

select single ZBUKRS_TEXT from ZGTPA_TL_SSNHIST into l_ZBUKRS_TEXT where perid = w0002-perid.

if sy-subrc eq 0.

Select zsubcode from table ZGTBA_TL_SUBCODE into corresponding fields of ZGTBA_TL_SUBCODE

where .....(whatever ur condition is).

w_MetLife_detail-rdstdsubcde = ZGTBA_TL_SUBCODE-zsubcode.

Similarly, in the else condition.

Read only

0 Likes
1,024

Hi,

Check this code

IF w_metlife_detail-rdstdcover = c_st.
  IF p0001-bukrs = c_1009.
    SELECT SINGLE zbukrs_text FROM zgtpa_tl_ssnhist
      INTO l_zbukrs_text
     WHERE perid = w0002-perid.
    IF sy-subrc EQ 0.
      w_metlife_detail-rdstdsubcde = zgtba_tl_subcode-zsubcode.
    ENDIF.
  ENDIF.
" Get if no values found in case BUKRS is 1009 for the perid
  IF w_metlife_detail-rdstdsubcde IS INITIAL.
    SELECT SINGLE hist_bukrs FROM zgtba_tl_subcode
                              INTO   l_bukrs
                              WHERE zreportno  = c_100525.

    w_metlife_detail-rdstdsubcde = zgtba_tl_subcode-zsubcode.
  ENDIF.
ENDIF.

Read only

0 Likes
1,024

Thanks for reply.

Regards,

Sujan

Read only

Former Member
0 Likes
1,024

Use the check on sy-subrc after each select single, so that you can put some messages there whether the code find anything in the tables or not. Of course you can try to debug and check sy-subrc and se16 t-code in the meanwhile how many data can be found there!

Read only

Sm1tje
Active Contributor
0 Likes
1,024

'Not getting any values'

This is bit too general. Try to debug the coding first and see where it fails. It's hard to say what exactly is going wrong 'from a distance'. Debugging will probably help you to get to code running properly, otherwise get back with a more specific question.

Read only

Former Member
0 Likes
1,024

Hi...

Ur passing same values in both cases ZGTBA_TL_SUBCODE-zsubcode Any way there are 2 posibilities to get subrc not getting 0 .

1)Try w0002-perid & c_100525. Values with PACK & UNPACK statement

2)Use w0002-perid & c_100525 this fields in select selection fields also ( sometime itu2019s required if itu2019s primary key ) means select single perid ....

Salil u2026

Edited by: salil chavan on Apr 29, 2009 4:54 AM