Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need help in ABAP coding

Former Member
0 Likes
614

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi Saifur Rahaman

Try this

AT NEW MATNR(Material Field)

reward me points ,if it helpful.

By

pari

6 REPLIES 6
Read only

Former Member
0 Likes
593

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

Read only

Former Member
0 Likes
593

Loop at itab.

at new MatDesc.

write : itab-Sr ,

itab-MatNum,

itab-MatDesc,

itab-Charecteristics,

itab-Quantity ..

endat.

write 😕 itab-Charecteristics,

itab-Quantity.

endloop.

Read only

Former Member
0 Likes
593

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.

Read only

Former Member
0 Likes
593

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.

Read only

Former Member
0 Likes
594

Hi Saifur Rahaman

Try this

AT NEW MATNR(Material Field)

reward me points ,if it helpful.

By

pari

Read only

Former Member
0 Likes
593

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