Skip to Content
author's profile photo Former Member
Former Member

Field in internal table is empty after selection though the field has value in database

Hello All,

I have never seen this kind of scenario before. In a program, data is being selected from BSAD table depending on company code and record creation date, into one internal table which is declared as :

it_bsad type table of bsad.

Now after select query, what i see is data is available in internal table ( The number of records fetched in internal table is correct).

Only one field PRCTR in internal table has weird values like if PRCTR is alphabetic in database table then this value is present in internal table's field (PRCTR) also. But if PRCTR is numeric in database table then value is not present in internal table's field.

Please see below for what i meant. (Lets assume BSAD has two fields BELNR and PRCTR)

BSAD IT_BSAD

BELNR PRCTR BELNR PRCTR

000123888 000123567 000123888

000125454 PXHYHK 000125454 PXHYHK

000176572 000009871 000176572

000189867 ABDC 000189867 ABDC

What could be reason?

Thanks in advance,

Manisha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 24, 2012 at 01:11 PM

    Can you put the Data declaration and Select statement piece here?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 24, 2012 at 01:56 PM

    How are you viewing the internal table content, debugger or screen output?

    Sometimes field contents with numbers only might be displayed right-justified, so if your column is not wide enough you see only leading spaces.

    Also, do not use CLIENT SPECIFIED and then MANDT = SY-MANDT, get rid of both, this will reduce code inspector warnings.

    Thomas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Thomas,

      Thank you for your reply. I am viewing table contents in debugger and not in output. Also the field contents ( When these are alphabets ) fully justify the length of field. And hence i am worried as i can not see any data in that field when other fields are filled.

      Also i have used MANDT to increase the performance as its popping up in st12 and i am not getting any kind of warnings or errors in code inspector.

  • Posted on Jul 25, 2012 at 06:24 AM

    Are you sure you cross checked the data correctly because the BELNR will be repeated for the same company code. In SE11 try passing values to all the key fields. In your case you have only used BUKRS which is a partial key field.

    What I mean to say is both the below records will be existing in DB table.

    000176572 000009871

    000176572

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Rob Postema

      Hi Manisha,

      I have modified the code as below and now im able to see the expected output.

      Better do like this..


      SELECT-OPTIONS : s_date FOR bsad-augdt.
      TYPES : BEGIN OF y_miss,
      bukrs TYPE bukrs,
      kunnr TYPE kunnr,
      umsks TYPE umsks,
      umskz TYPE umskz,
      augdt TYPE augdt,
      augbl TYPE augbl,
      zuonr TYPE dzuonr,
      gjahr TYPE gjahr,
      belnr TYPE belnr_d,
      buzei TYPE buzei,
      prctr TYPE prctr,
      END OF y_miss.

      DATA : it_bsad TYPE STANDARD TABLE OF y_miss WITH HEADER LINE.

      SELECT bukrs
      kunnr
      umsks
      umskz
      augdt
      augbl
      zuonr
      gjahr
      belnr
      buzei
      prctr
      FROM bsad
      INTO TABLE it_bsad
      WHERE bukrs EQ '0001'
      AND cpudt in s_date.

      LOOP AT it_bsad.
      WRITE:/ it_bsad-bukrs.
      WRITE:/ it_bsad-kunnr.
      ENDLOOP.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.