07-24-2012 1:54 PM
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
07-24-2012 2:11 PM
Can you put the Data declaration and Select statement piece here?
07-24-2012 2:45 PM
Hi,
Thank you for your reply.Please see the test code mentioned below.
tables : bsad.
TYPES : BEGIN OF ty_bsad,
bukrs TYPE char4,
kunnr(10),
umsks(1),
umskz(1),
augdt TYPE datum,
augbl(10),
zuonr(18),
gjahr(4),
belnr(10),
buzei(3),
prctr(10),
END OF ty_bsad.
DATA : it_bsad TYPE TABLE OF ty_bsad.
SELECT-OPTIONS : s_date FOR bsad-augdt.
SELECT * FROM bsad CLIENT SPECIFIED
INTO CORRESPONDING FIELDS OF TABLE it_bsad
WHERE mandt = sy-mandt
AND cpudt IN s_date.
07-24-2012 2:48 PM
Hi Again,
Above is test program i created. And below is the actual program where this problem is coming.
DATA : it_bsad TYPE STANDARD TABLE OF bsad.
SELECT *
FROM bsad CLIENT SPECIFIED
INTO TABLE it_bsad
WHERE mandt = sy-mandt
AND bukrs = p_bukrs
AND cpudt <= startdate.
* AND prctr = '0000005030'.
(Start date is calculated from the period and year mentioned in selection selection).
Do let me know if you need more information.
Thanks
Manisha
07-24-2012 2:58 PM
07-24-2012 2: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
07-25-2012 6:57 AM
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.
07-25-2012 7: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
07-25-2012 8:48 AM
Just to be sure yo have all the right formats for your fields in your itab, you better do like below
TYPES : BEGIN OF ty_bsad,
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 ty_bsad.
DATA : it_bsad TYPE STANDARD TABLE OF ty_bsad.
And what is the output if you write a quickview? (SQVI), will take you two minutes and than you know.
07-26-2012 12:17 PM
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.