Skip to Content

issue in simple select statement

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 06, 2015 at 07:43 PM

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

    Rob

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 06, 2015 at 08:04 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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