Application Development 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: 

ALV Problem? urgent

Former Member
0 Kudos

hi friends,

i want to display in my ALV Report s707-vkgrp,

tvkgr-bezei.

as one column separated by '-'.

In the tvkgr table, i m only seeing vkgrp value, but when i saw the contents of tvkgr. It displaying vkgrp and as well description(bezei).

how should i get bezei field in my rep.

This is my first secondary list in ALV Report.

i want to sort this column based on vkgrp.

i want to do subtotal this column, such that if the

first character of vkgrp value = 3 rd character of vkgrp value.(in the table data)

eg:- if in table data..vkgrp values are 10c, 20d,10h, 12c.

Here 10c and 12c subtotals should be done.

should i hav to use "for all entries option in select statement" because this is my first secondary list in alv report.

how should i write select query and fieldcatalog as well??

15 REPLIES 15

former_member188685
Active Contributor
0 Kudos

Hi Hari,

take another field , and concatenate the two fields separated by '-' and modify the internal table,

and for getting the value use table TVGRT it is the text table. you can see that in menu GO TO -> Text table of

tvkgr. and fetch the data./

vijay

0 Kudos

plz check this select

WHEN '&IC1'.

IF fields-fieldname = 'SALES_OFF'.

READ TABLE tbl_basic_list INDEX fields-tabindex.

SELECT vkgrp FROM s707

INTO TABLE tbl_first_list

FOR ALL ENTRIES IN tbl_basic_list

WHERE vkbur EQ tbl_basic_list-vkbur

and vkbur EQ fields-value.

SELECT bezei FROM tvgrt INTO CORRESPONDING FIELDS OF TABLE

tbl_first_list WHERE vkgrp = tbl_first_list-vkgrp AND

spras = sy-langu.

APPEND tbl_first_list.

LOOP AT tbl_first_list.

CONCATENATE tbl_first_list-vkgrp '-'

tbl_first_list-bezei INTO

tbl_first_list-sgroup

SEPARATED BY space.

MODIFY tbl_first_list INDEX sy-tabix.

ENDLOOP.

0 Kudos

Hi Hari,

SELECT s707~vkgrp
       tvgrt~bezei
INTO TABLE tbl_first_list
from s707 join tvgrt
on s707~vkgrp = tvgrt~vkgrp 
WHERE s707~vkbur EQ tbl_basic_list-vkbur
and s707~vkbur EQ fields-value
and tvgrt~spras = sy-langu.


LOOP AT tbl_first_list.
CONCATENATE tbl_first_list-vkgrp '-'
tbl_first_list-bezei INTO
tbl_first_list-sgroup
SEPARATED BY space.
MODIFY tbl_first_list INDEX sy-tabix.
ENDLOOP.

check this..

Message was edited by: Vijay Babu Dudla

Former Member
0 Kudos

Hi Hari,

You will find all the information that you need (including the description) in TVGRT.

Regards,

Madhur

Former Member
0 Kudos

It is tvkgrt table which is used to display the text. This is std practise of SAP.

former_member188685
Active Contributor
0 Kudos

get the TVGRT-bezei and s707-vkgrp and concatenate.

to extra field added to internal table.

build the field cata log for all the all the fields

but for the fields vkgrp,bezei don't show them using

no_out = 'X'.

for secondary report

build the sort table based on vkgrp,

    L_SPOS                 = L_SPOS + 1.    
    IT_SORT_DATA-SPOS      = L_SPOS.
    IT_SORT_DATA-FIELDNAME = 'VKGRP'.
    IT_SORT_DATA-TABNAME   = 'ITAB'.
    IT_SORT_DATA-UP        = 'X'.
    IT_SORT_DATA-SUBTOT = 'X'.

and based on the record selected populate the secondary internal table (in that case why you want for all entries) what ever record fetch the corresponding items from what ever table you need.

0 Kudos

check my sorting ...

i want to sort based on vkgrp.

but if 1st char of vkgrp value = 3rd char of vkgrp..subtotal should be done.

Is this right?? check it.

FORM fieldcat_sort USING gs_sort TYPE slis_t_sortinfo_alv.

DATA : ls_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE,

ls_spos TYPE alvdynp-sortpos.

IF ( tbl_first_list-vkgrp0(1) EQ tbl_first_list-vkgrp2(1) ).

ls_sort-spos = 1.

ls_sort-fieldname = 'VKGRP'.

ls_sort-up = 'X'.

ls_sort-subtot = 'X'.

    • If 1st character of Salesgroup value is equal to the

    • 3rd character then do subtotal.

ls_sort-group = 'X'.

ls_sort-expa = ''.

APPEND ls_sort TO gs_sort.

ELSE.

ls_sort-spos = 1.

ls_sort-fieldname = 'VKGRP'.

ls_sort-up = 'X'.

ls_sort-group = 'X'.

ls_sort-expa = ''.

APPEND ls_sort TO gs_sort.

ENDIF.

ENDFORM. " fieldcat_sort

0 Kudos

Yes Hari,

it looks fine,

and you should call it before calling the FM.

regards

vijay

0 Kudos

Thanx vijay.

i hav one doubt. but we are not displaying this field(VKGRP) in the report output by no_out.

so, how the sorting and subtotals can be done.

0 Kudos

though it is not displaye, it is built in the fieldcatalog no, so it sorts based on fieldcat

0 Kudos

thats what i mentioned, even if you don't show it is there in fieldcatalog, so it can take it from there,

don't worry about that..

regards

vijay

0 Kudos

ok..i have written ls_sort-subtot = 'X'.

should i have to write do_sum in all fieldcalculation columns ??

Check my fieldcatalog and do changes.

IF fcat1[] IS INITIAL.

CLEAR fcat1.

fcat1-fieldname = 'VKGRP'.

fcat1-tabname = 'TBL_FIRST_LIST'.

fcat1-ref_tabname = 'S707'.

fcat1-key = 'X'.

fcat1-emphasize = 'C111'.

fcat-datatype = 'CHAR'.

fcat1-outputlen = 3.

fcat1-hotspot = 'X'.

  • fcat1-tech = 'X'. "technical field

fcat1-no_out = 'X'.

APPEND fcat1.

CLEAR fcat1.

fcat1-fieldname = 'BEZEI'.

fcat1-tabname = 'TBL_FIRST_LIST'.

fcat1-ref_tabname = 'TVGRT'.

fcat1-emphasize = 'C111'.

fcat-datatype = 'CHAR'.

fcat1-outputlen = 20.

fcat1-no_out = 'X'.

  • fcat1-tech = 'X'. "technical field

APPEND fcat1.

CLEAR fcat1.

fcat1-col_pos = 1.

fcat1-fieldname = 'SGROUP'.

fcat1-tabname = 'TBL_FIRST_LIST'.

fcat1-outputlen = 28.

fcat1-datatype = 'CHAR'.

fcat1-emphasize = 'C111'.

fcat1-seltext_s = text-013.

fcat1-hotspot = 'X'.

fcat1-emphasize = 'X'.

<b>fcat1-do_sum = 'X'.</b>

<b>* should i write do_sum here</b>

APPEND fcat1.

CLEAR fcat1.

fcat1-col_pos = 2.

fcat1-fieldname = 'ZZ_INVOICED'.

fcat1-tabname = 'TBL_FIRST_LIST'.

fcat1-seltext_l = text-002.

fcat1-emphasize = 'C100'.

fcat1-outputlen = 6.

fcat1-datatype = 'CURR'.

APPEND fcat1.

CLEAR fcat1.

fcat1-col_pos = 3.

fcat1-fieldname = 'ZZ_BOOKED'.

fcat1-tabname = 'TBL_FIRST_LIST'.

fcat1-seltext_l = text-003.

fcat1-outputlen = 6.

fcat1-emphasize = 'C200'.

fcat1-datatype = 'CURR'.

APPEND fcat1.

ENDIF.

where should i write do_sum.

also tell me what is the difference between no_out and tech in fcat??

0 Kudos

s where u have written is correct

0 Kudos
CLEAR fcat1.
fcat1-col_pos = 1.
fcat1-fieldname = 'SGROUP'.
fcat1-tabname = 'TBL_FIRST_LIST'.
fcat1-outputlen = 28.
<b>fcat1-datatype = 'CHAR'.</b>
fcat1-emphasize = 'C111'.
fcat1-seltext_s = text-013.
fcat1-hotspot = 'X'.
fcat1-emphasize = 'X'.
<b>fcat1-do_sum = 'X'.</b>
* should i write do_sum here
APPEND fcat1.

i doubt you can do that or not,

only if it is non char field you can do that.

Former Member
0 Kudos

see the records in table TVGRT.

u will find the related field in this table. and hope ur problem will be solved.

reward points if helpful