‎2008 Mar 24 11:27 AM
Hi Gurus,
here i hav some complication for displaying data in output.In output I have to show characteristics(ysd-characteristics,,,, ysd is a customized tablehaving fields vbeln, matnr, posnr, characteristics......) of material with respect to sales document number(vbap-vbeln).when I am executing the prog with below SELECT statement----
________________________________________________
select distinct
ysd~vbeln
ysdposnr ysdmatnr
ysd~characteristic
vbapposnr vbapmatnr
vbap~arktx
vbap~kwmeng
into corresponding fields of table itab1
from ysd_famd_chrctcs as ysd inner join vbap
on ysdvbeln = vbapvbeln
and ysdposnr = vbapposnr
where vbap~vbeln = p_vbeln.
_______________________________________________
After looping itab1 it is giving output like below.
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
1 | 00000012 | CCslab | over size | 50
1 | 00000012 | CCslab | under size | 50
1 | 00000012 | CCslab | phos percnt | 50
1 | 00000012 | CCslab | chrome | 50
1 | 00000012 | CCslab | Ferrous | 50
-
but output should be like below
-->>
-
Sr | MatNum | MatDesc | Charecteristics | Quantity
no | | | |
-
1 | 00000012 | CCslab | Moisture | 50
| over size |
| under size |
| phos percnt |
| chrome |
| Ferrous |
-
what should i write with select statement to get this.
I tried using DELETE ADJACENT...... but it is deletin all characteristics from output.
pls help...
Regard
Saif
‎2008 Mar 24 11:39 AM
Hi Saifur Rahaman
Try this
AT NEW MATNR(Material Field)
reward me points ,if it helpful.
By
pari
‎2008 Mar 24 11:32 AM
Hi
Try using loop at itab
at new f1.
write : / f1, f2, 45 f3,f4.
endat.
write the remaining by using the position of the above
write :/45 F3.
regards
Shiva
‎2008 Mar 24 11:33 AM
Loop at itab.
at new MatDesc.
write : itab-Sr ,
itab-MatNum,
itab-MatDesc,
itab-Charecteristics,
itab-Quantity ..
endat.
write 😕 itab-Charecteristics,
itab-Quantity.
endloop.
‎2008 Mar 24 11:33 AM
hi,
in the loop use the following code.
if sy-subrc = 1.
write: (all the field names)
else.
write:/ (single feild which u want to display).
endif.
‎2008 Mar 24 11:39 AM
Hi Rahaman,
I'm unable to catch ur doubt, could u plz send ur full code , once i will verify it and i will try to rectify it,
what r the field u want to see in the output?
Thanks & regards,
Ganesh.
‎2008 Mar 24 11:39 AM
Hi Saifur Rahaman
Try this
AT NEW MATNR(Material Field)
reward me points ,if it helpful.
By
pari
‎2008 Mar 24 11:54 AM
Hi,
You can make use of AT NEW .... ENDAT statements.
Declare another internal table ITAB2 & its corresponding work area.
Refer the below code:
Loop at ITAB1 INTO WA_ITAB1.
CLEAR F_FLAG.
AT NEW MATNR.
WA_ITAB2-MATNR = WA_ITAB1-MATNR.
WA_ITAB2-DESC = WA_ITAB1-DESC.
similarly do the same for other fields...
f_flag = 1.
ENDAT.
IF f_flag NE '1'.
WA_ITAB2-MATNR = SPACE.
WA_ITAB2-DESC = SPACE.
WA_ITAB2-CHAR = WA_ITAB1-CHAR.
ENDIF.
APPEND WA_ITAB2 TO ITAB2.
CLEAR WA_ITAB2.
ENDLOOP.
Just try and see.
reward points if useful.
Thanks,
Asha