Application Development 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: 

issue in simple select statement

former_member477101
Participant
0 Kudos

Hi,

     i am not knowing where i am going wrong,i checked with entries in se11 for faglflexa, there are many records in table but i am not able to fetch,

     please check below code,and find the error where iam going wrong.

types: BEGIN OF ty_faglflexa,

        RYEAR  TYPE GJAHR,

        DOCNR  type BELNR_D,

        RLDNR  TYPE FAGL_RLDNR,

        RBUKRS TYPE BUKRS,

        RRCTY  TYPE RRCTY,

        RACCT  TYPE RACCT,

        RCNTR  TYPE KOSTL,

        PRCTR  TYPE PRCTR,

        RFAREA TYPE FKBER,

        RBUSA  TYPE GSBER,

        KOKRS  TYPE KOKRS,

        poper  TYPE POPER,

        gjahr  TYPE gJAHR,

        END OF ty_faglflexa.

data:it_faglflexa TYPE TABLE OF ty_faglflexa,

      wa_faglflexa TYPE ty_faglflexa.

TABLES :skb1,faglflexa.

SELECTION-SCREEN :BEGIN OF block b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS :S_BUKRS for FAGLFLEXA-RBUKRS ,"OBLIGATORY,"comp code

S_SAKNR for  FAGLFLEXA-RACCT,"gl account

S_POPER for FAGLFLEXA-POPER ."OBLIGATORY. "posting period

PARAMETERS :S_year type FAGLFLEXA-RYEAR ,"OBLIGATORY," fiscal year

P_RRCTY type FAGLFLEXA-RRCTY.

SELECTion-SCREEN :END OF BLOCK b1.

START-OF-SELECTION.

SELECT RYEAR DOCNR RLDNR RBUKRS RRCTY RACCT RCNTR PRCTR RFAREA RBUSA KOKRS POPER GJAHR from

faglflexa into TABLE it_faglflexa where RYEAR = S_YEAR AND rbukrs in S_BUKRS and rrcty = p_rrcty

and racct in s_saknr and poper in s_poper.

if it_faglflexa is NOT INITIAL.

  endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Neither S_YEAR nor P_RRCTY are obligatory, but you do have to make a valid entry in each.

Rob

4 REPLIES 4

Former Member
0 Kudos

Neither S_YEAR nor P_RRCTY are obligatory, but you do have to make a valid entry in each.

Rob

former_member477101
Participant
0 Kudos

Hi ,

      i found the answer , the internal table since input paramter p_rrcty was empty, and there were no records as such with empty rrcty in faglflexa table, so i made two diffrenct selections ,one with p_rrcty is initial and p_rrcty is not initial.

Thanks &Regards,

J.prakash

0 Kudos

Or you could have made it a SELECT-OPTION instead and stayed with a single SELECT statement.

Rob

0 Kudos

Hi Prakash,


prakash rao wrote:

Hi ,

      i found the answer , the internal table since input paramter p_rrcty was empty, and there were no records as such with empty rrcty in faglflexa table, so i made two diffrenct selections ,one with p_rrcty is initial and p_rrcty is not initial.

Thanks &Regards,

J.prakash

Instead of mentioning p_rrcty is initial and p_rrcty is not initial, It is recommendable to use the below code.


It is recommendable to use select-option in this case instead of parameter..


PARAMETERS :S_year type FAGLFLEXA-RYEAR. "OBLIGATORY," fiscal year

"P_RRCTY type FAGLFLEXA-RRCTY.

SELECT-OPTION: P_RRCTY type FAGLFLEXA-RRCTY.

SELECTion-SCREEN :END OF BLOCK b1.

START-OF-SELECTION.

SELECT RYEAR DOCNR RLDNR RBUKRS RRCTY RACCT RCNTR PRCTR RFAREA RBUSA KOKRS POPER GJAHR from

faglflexa into TABLE it_faglflexa where RYEAR = S_YEAR AND rbukrs in S_BUKRS

and rrcty IN p_rrcty.

Regards

Rajkumar Narasimman