Skip to Content
author's profile photo Former Member
Former Member

DISPLAYING -DYNAMIC COLUM IN ALV ??? READ MESSGAE

hi friends ,

Thanks for your reply , here is one question i am displaying my code

in short .. what i want is to display column dynamically using the

field-symbols.... can anybody help me with syntax or code i wil be

thank full to him .i find little code for it on sdn also .

sdn code,

1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE.

Add more rows to the field catalog table (T_FIELDCAT) at run time.

2. Use the field catalog to create a table dynamically using the method below.

DATA: T_OUTPUT TYPE REF TO DATA

FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE

Call Method CL_ALV_TABLE_CREATE->CREATE_DYNAMIC_TABLE

Exporting

IT_FIELDCATALOG = T_FIELDCAT

Importing

EP_TABLE = T_OUTPUT

ASSIGN T_OUTPUT->* TO <T_OUTPUT>.

Now the field symbol <T_OUTPUT> is pointing to an output table of the structure that contains the fields which were determined at runtime.

Now fill this table with the data and pass <T_OUTPUT> to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly.

....................

here is my code."""" IAM USING SCREEN..HERE

after the start of selection .

LOOP AT i_vat.

IF i_vat-mwskz IS NOT INITIAL.

  • 'CALCULATE_TAX_ITEM'

i_itaxcom-bukrs = i_vat-bukrs.

i_itaxcom-waers = i_vat-waers.

i_itaxcom-kposn = i_vat-ebelp.

i_itaxcom-mwskz = i_vat-mwskz.

i_itaxcom-wrbtr = i_vat-netwr.

i_itaxcom-matnr = i_vat-matnr.

i_itaxcom-mglme = i_vat-menge.

i_itaxcom-werks = i_vat-werks.

i_itaxcom-bldat = i_vat-bedat.

i_itaxcom-budat = i_vat-bedat.

i_itaxcom-lifnr = i_vat-lifnr.

  • i_itaxcom-shkzg = 'H'.

i_itaxcom-xmwst = 'X'.

i_itaxcom-matkl = i_vat-matkl.

i_itaxcom-meins = i_vat-meins.

i_itaxcom-mtart = i_vat-mtart.

  • i_itaxcom-land1 = 'IN'.

  • i_itaxcom-ebeln = zxekko-ebeln.

  • i_itaxcom-ebelp = <fs>-ebelp.

  • *end of correction 20.10.2004

REFRESH i_otaxcom.

CALL FUNCTION 'CALCULATE_TAX_ITEM'

EXPORTING

i_taxcom = i_itaxcom

TABLES

t_xkomv = i_otaxcom.

LOOP AT i_otaxcom WHERE kposn = i_vat-ebelp. "kposn - condition item number

READ TABLE i_tcode WITH KEY ebeln = i_vat-ebeln

ebelp = i_vat-ebelp

kschl = i_otaxcom-kschl.

IF sy-subrc <> 0.

IF i_otaxcom-kwert <> 0.

i_tcode-kschl = i_otaxcom-kschl.

tcode-ebeln = i_vat-ebeln.

i_tcode-ebelp = i_vat-ebelp.

i_tcode-kschl = i_otaxcom-kschl.

i_tcode-kwert = i_otaxcom-kwert.

APPEND i_tcode.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

LOOP AT i_vat.

count1 = 1.

LOOP AT i_tcode WHERE ebeln = i_vat-ebeln AND ebelp = i_vat-ebelp.

Alv_fieldname+5 = count1.

ASSIGN COMPONENT Alv_fieldname OF STRUCTURE i_vat

TO <fs_value>.

IF sy-subrc EQ 0.

<fs_value> = i_tcode-kwert.

ENDIF.

count1 = count1 + 1.

MODIFY i_vat.

ENDLOOP.

ENDLOOP.

SELECT DISTINCT kschl

vtext

INTO CORRESPONDING FIELDS OF TABLE i_tcode1

FROM t685t

FOR ALL ENTRIES IN i_tcode

WHERE kschl = i_tcode-kschl AND

kappl = 'TX' AND

spras = sy-langu.

count1 = 1..

LOOP AT i_tcode1

READ TABLE i_tcode WITH KEY kschl = i_tcode1-kschl .

IF sy-subrc = 0.

CONCATENATE 'BAVAL' count1 INTO fld_name.

i_tcode1-text = fld_name.

MODIFY i_tcode1.

count1 = count1 + 1.

ENDIF.

ENDLOOP.

PERFORM sort_build USING gt_sort[].

PERFORM layout_init USING gs_layout.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'EBELN' 'C' 'Documnet No'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'EBELP' 'C' 'Line Item'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'WERKS' 'C' 'Plant'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'LIFNR' 'C' 'Vendor'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NAME1' 'C' 'Vendor Name '.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MATNR' 'C' 'Material'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MAKTX' 'C' 'Material Description'.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'MENGE' 'QUAN' 'Order Quantity '.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] 'NETPR' 'CURR' 'Price Rate'.

OR DYNAMIC DISLPLAY.

BUT I WANT IN FIELD SYMBOL WAY

LOOP AT i_tcode1.

PERFORM fieldcatalog_init USING gt_fieldcatalog[] i_tcode1-text 'QUAN' i_tcode1-vtext.

ENDLOOP

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 12, 2005 at 05:23 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2005 at 05:27 AM

    The above thread will help you...

    please have a look into that

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2005 at 05:40 AM

    Hi Farukh,

    Regarding ALv u can find full details in this below link.This should help u better.

    http://help.sap.com/saphelp_erp2005/helpdata/en/b8/d84f59aac911d295e300a0c9306433/frameset.htm

    In this goto ABAP List viwer to c all the details and functions of ALv.

    Regards,

    Nagarajan.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.