08-24-2009 8:51 AM
Dear guys, I have following piece of code .Here in field itab_data-inco2 ,why data while printing comes "*****".
I can see values in itab_data-inco2 fetched .but while printing it prints "***************".
code:
SORT ITAB_DATA BY LIFNR EBELN.
LOOP AT ITAB_DATA.
AT NEW LIFNR.
NEW-PAGE.
ENDAT.
AT NEW EBELN.
CLEAR ITEM_CNT.
ENDAT.
ITEM_CNT = ITEM_CNT + 1.
AT END OF EBELN.
ADD 1 TO NUM_CNT.
SUM.
SELECT SINGLE * FROM EKKO
WHERE EBELN = ITAB_DATA-EBELN.
WRITE: /1 ' ',
2 NUM_CNT,
6 ITAB_DATA-EBELN,
18 ITAB_DATA-BSART,
23 ITAB_DATA-BEDAT,
33 ITEM_CNT,
46(13) ITAB_DATA-MENGE,
61(13) ITAB_DATA-NETWR CURRENCY EKKO-WAERS,
76(10) ITAB_DATA-VERKF,
89 ITAB_DATA-ANGNR.
IF ITAB_DATA-ANGNR = 'Y'.
WRITE: 93 ITAB_DATA-IHRAN.
ENDIF.
WRITE: 105 ITAB_DATA-INCO2.
VITEM_CNT = VITEM_CNT + ITEM_CNT.
ENDAT.
.
08-24-2009 8:57 AM
Hi,
On control break events the data in the internal tables inside control break would be displayed as '****' other than the fields in the control break try like below:
SORT ITAB_DATA BY LIFNR EBELN.
LOOP AT ITAB_DATA.
move-corresponding itab_data into wa_data.<<<<create wa_data like itab_data and then use wa_data fields in the code
AT NEW LIFNR.
NEW-PAGE.
ENDAT.
AT NEW EBELN.
CLEAR ITEM_CNT.
ENDAT.
ITEM_CNT = ITEM_CNT + 1.
AT END OF EBELN.
ADD 1 TO NUM_CNT.
SUM.
SELECT SINGLE * FROM EKKO
WHERE EBELN = ITAB_DATA-EBELN. <<<here u can use itab_data as the control break is on this field
WRITE: /1 ' ',
2 NUM_CNT,
6 ITAB_DATA-EBELN,
18 ITAB_DATA-BSART, << use wa_data-bsart
23 ITAB_DATA-BEDAT, <<wa_data-bedat
33 ITEM_CNT,
46(13) ITAB_DATA-MENGE, <<wa_data-menge
61(13) ITAB_DATA-NETWR CURRENCY EKKO-WAERS,
76(10) ITAB_DATA-VERKF,
89 ITAB_DATA-ANGNR.
IF ITAB_DATA-ANGNR = 'Y'.
WRITE: 93 ITAB_DATA-IHRAN.
ENDIF.
WRITE: 105 ITAB_DATA-INCO2.
VITEM_CNT = VITEM_CNT + ITEM_CNT.
ENDAT.
I hope you got the point.
Regards,
Himanshu
08-24-2009 8:59 AM
Hi,
Declare another work area and use this work area for display.
Regards,
Surendar Reddy.
08-24-2009 9:27 AM
Either use field symbols for workarea or define new workare and move the content of previous workarea into new one and use this new workarea for printing.
08-24-2009 9:32 AM
Hi,
At new field ....... endat will display only the field values specified in the field correctly.
It will initialise the numeric values and character values will be replaced by '*'(length will be similar to field lemgth).
ex:
Suppose n1,n2 to be integer type.
at new carrrid.
write : carrid, connid.
endat.
write:/ n1, n2.
output will be
AA **** 0 0
AZ **** 0 0
LH **** 0 0
08-24-2009 9:35 AM
These asterixes "***************" come because declaration part of ITAB is wrong, namely fields order. In declaration all key fields must be in front (must go first) in such way that the widest field value goes first, then its "subgroup", then next "subgroups" .Look at this example
Field1 Field2 Field3
A 1 x
A 1 y
A 2 z
B 3 v
B 4 n
B 4 m
Field1 have widest range, within each A, there are subgroups for Field2 , within Field2 there are some subgroups of Field3 . So fields order must be like hierarchy. The most general on left, then more detailed further to the right, and most detailed on the right. There cannot be situations like
A 1
A 1
A 1
B 1 "<- here FIELD 1 will be shown as ********, becuase FIELD2 is more general and should be more detailed
B 4
B 4
Regards
Marcin
08-24-2009 9:38 AM
Hi Sudha,
try this out.
*SORT ITAB_DATA BY LIFNR EBELN.
LOOP AT ITAB_DATA into wa.
AT END OF EBELN.
ADD 1 TO NUM_CNT.
SUM.
SELECT SINGLE * FROM EKKO
WHERE EBELN = wa-EBELN.
WRITE: /1 ' ',
2 NUM_CNT,
6 wa-EBELN,
18 wa-BSART,
23 wa-BEDAT,
33 ITEM_CNT,
46(13) wa-MENGE,
61(13) wa-NETWR CURRENCY EKKO-WAERS,
76(10) wa-VERKF,
89 wa-ANGNR.
IF wa-ANGNR = 'Y'.
WRITE: 93 wa-IHRAN.
ENDIF.
WRITE: 105 wa-INCO2.
VITEM_CNT = VITEM_CNT + ITEM_CNT.
ENDAT.
AT NEW LIFNR.
NEW-PAGE.
ENDAT.
AT NEW EBELN.
CLEAR ITEM_CNT.
ENDAT.
ITEM_CNT = ITEM_CNT + 1.
ENDLOOP.*
Regards,
Vijay
01-12-2011 10:16 AM
01-12-2011 10:26 AM
Hi.,
Can you tell EBELN is first fields of internal table.
Regards.