ALV rows to column dynamic internal table
Hello People ,
I am stuck in a report which displays an output in ALV as follows :-
bukrs | kntyp | konto | knfix | period | element | emeng | emein
1000 | 10 | 1100 | berlin | 11.2011 | AG | 0.148 | kgAG
1000 | 10 | 1100 | berlin | 11.2011 | AU | 0.104 | kgAU
1000 | 10 | 1100 | berlin | 11.2011 | GA | 0.207 | kgGA
And this table has many values corresponding to element AG,AU and GA respectively . For example , there would be many element AG's with many "EMENG" values . Similarly for AU and GA .
MY question :- I am asked to make AG , AU , GA as 3 different fields which should show the value "EMENG" under respective elements . Like :-
bukrs | kntyp | konto | knfix | period | AG | AU | GA | emein
1000 | 10 | 1100 | berlin | 11.2011 | 0.148 | 0.104 | 0.207 | kgAG
That should be my output . ( elements replaced by AG , AU and GA which comes from a Metal table ZXXXX where
metal no. 1 = AU
metal no. 2 = AG
metal no. 3 = GA
If there is any metal added to it would be metal no. 4 ,5,6,7 .... so on ) and then that should be added as a field in our report .. So that has to be DYNAMIC .
I am unable to move on with problem . Pls suggest ? I am pasting my report here ...
FORM select_table_gt_bb CHANGING p_gt_bb.
TABLES : zpam_as .
DATA : i_zpam_as TYPE TABLE OF zpam_as ,
wa_zpam_as LIKE LINE OF i_zpam_as ,
i_tcurr TYPE TABLE OF tcurr ,
wa_tcurr LIKE LINE OF i_tcurr,
zt_as TYPE TABLE OF zpam_as.
SELECT * FROM zpam_as INTO TABLE gt_as
WHERE bukrs EQ bukrs
AND kntyp IN kntyp
AND konto IN konto
AND knfix IN knfix
AND buper IN buper
AND element IN element
AND ameng IN ameng
AND ashkz IN ashkz
AND emeng IN emeng
AND eshkz IN eshkz
AND emein IN emein.
SELECT * FROM zpam_tcurr INTO TABLE gt_tcurr.
IF sy-subrc IS INITIAL.
LOOP AT gt_tcurr INTO gw_tcurr.
SELECT * FROM tcurr INTO wa_tcurr WHERE fcurr = gw_tcurr-fcurr AND
tcurr = tcurr.
ENDSELECT.
APPEND wa_tcurr TO i_tcurr.
DELETE ADJACENT DUPLICATES FROM i_tcurr.
ENDLOOP.
ENDIF.
IF i_tcurr IS NOT INITIAL.
LOOP AT gt_as INTO gw_as.
CLEAR sy-subrc.
LOOP AT i_tcurr
INTO wa_tcurr
WHERE fcurr = gw_as-emein.
gw_as-tcurr = wa_tcurr-tcurr.
gw_as-ukurs = wa_tcurr-ukurs.
gw_as-total = abs( gw_as-emeng ) * wa_tcurr-ukurs.
APPEND gw_as TO zt_as.
ENDLOOP.
IF sy-subrc <> 0.
gw_as-tcurr = 'None'.
gw_as-ukurs = ''.
gw_as-total = ''.
APPEND gw_as TO zt_as.
ENDIF.
ENDLOOP.
REFRESH gt_as.
LOOP AT zt_as INTO gw_as.
APPEND gw_as TO gt_as.
ENDLOOP.
ENDIF.
ENDFORM.
Priority normalized
Edited by: Rob Burbank on Dec 28, 2011 3:44 PM
Hey,
But after understanding my question correctly , you sure that dynamic internal table is the solution for it ?
Similar Messages
-
No column text displayed in alv when i use dynamic internal table
Hi friends,
when I use dynamic internal table to display the fields in ALV formant, field column text was not displaying ,
total row of column text was blank.
can u sujjest me in this...
with regards,
prasad.Hi
That depends on how you've filled the catalog table, here u need to insert the description for the labels (short, medium and long) and the description for the layout variant management.
So u make sure to fill the fields like
SCRTEXT_L
SCRTEXT_M
SCRTEXT_S
REPTEXT
Max -
Need ALV LIST for displaying Dynamic Internal Tables
Hi Guys,
I have some thing like 2 Dynamic internal tables.
Say 1st Internal table will be filled based on some condition.
say 2nd table will be filled based on some condition.
When appending the 1st Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
In the same way when appending the 2nd Internal table, if that internal table is filled it creates another internal table of same kind and continues so on until some condition.
My requirement is I need to display all these Internal tables in the output.
The output should look something like
1st Internal Table
some gap
2nd Internal Table
some gap
so on...................
Is there any standard ALV List, to display all these Internal Tables in such a way.
Thanks,
Prasad.Hi.
One thing more here is code which get 10 records from 2 tables and then show them in ALV.
first when u execute it will show data from ist table.
when u go back (F3) then it will sow data from 2nd table.
But if u want to show both ALV on the same screen then u will have to use screen programin and using class u will have to create container and then have to do it.
But as i above mentioned. that sample code is as below.
REPORT ztn_test LINE-COUNT 100.
data: itab_ref type ref to data.
data: hstr type lvc_title.
data: tabname like DD02T-TABNAME.
tabname = 'MARA'. " First Table
create data itab_ref type standard table of (tabname).
field-symbols: <itab> type standard table.
assign itab_ref->* to <itab>.
select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
perform showalv.
tabname = 'KNA1'. " 2nd Table
create data itab_ref type standard table of (tabname).
"field-symbols: <itab> type standard table.
assign itab_ref->* to <itab>.
select * UP TO 10 ROWS from (tabname) into corresponding fields of table <itab>.
perform showalv.
form showalv.
" to show that data in alv
type-pools: slis.
data: myalv type ref to cl_gui_alv_grid, "ALV Grid
fieldcat type slis_t_fieldcat_alv, "Field Catalog Table
ls_fcat type slis_fieldcat_alv, "Line of Field catalog.
ls_heading type slis_listheader, "Line of Heading.
layout type slis_layout_alv, "layout of ALV for Heading and Logo.
event type slis_t_event, "Event Raising to Display Heading.
event_str type slis_alv_event. "Event String.
type-pools: slis.
data: heading type slis_t_listheader. "List Heading.
if heading[] is initial.
ls_heading-typ = 'H'.
ls_heading-info = 'HR: Master Data Change History'.
append ls_heading to heading.
endif.
* ls_heading-typ = 'A'.
* ls_heading-info = ''.
* APPEND ls_heading TO heading.
* ALV DISPLAY *
*******Making Layout of ALV
layout-zebra = 'X'.
layout-colwidth_optimize = 'X'.
*Calling function to raise event to display heading and icon above ALV
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = event[]
* EXCEPTIONS
* LIST_TYPE_WRONG = 1
* OTHERS = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
******calling TOP_OF_PAGE Event
read table event with key name = 'TOP_OF_PAGE' into event_str.
if sy-subrc = 0.
move: 'TOP_OF_PAGE' to event_str-form.
modify event from event_str index sy-tabix.
endif.
**** Now use this Fuction to display ALV without any Screen Programming.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = 'SAPLZFSL_HR_UTILS' "sy-cprog
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = tabname
* I_BACKGROUND_ID = ' '
i_grid_title = hstr "Heading of ALV Grid.
* I_GRID_SETTINGS =
is_layout = layout
* it_fieldcat = fieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'X'
* IS_VARIANT =
it_events = event[]
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = <itab>
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. -
How to ADD rows to a dynamic internal table??
My question is simple.
I have a dynamic internal table and I need to ADD rows to if.
I read this thread How to modify a dynamic internal table from dynamic work area but they are modifying existing data.
My internal table is EMPTY and I need to ADD new rows, so I can't use LOOP ASSIGNING.
How can I do that?
Any help is welcome!
Thanks!
BettinaHi,
try something similar.
FIELD-SYMBOLS: <fs> type any.
FIELD-SYMBOLS: <f1> type any.
ASSIGN INITIAL LINE TO lo_data ASSIGNING <fs>. " or <f_tab> - not sure w/o editor :-)
assigning component 1 of structure <fs> to <f1>.
<f1> = 'aaa'.
I write it from memory so there can be some syntax errors but focus to command APPEND INITIAL LINE ...
Regards,
Karol -
CONVERT ROWS INTO COLUMNS IN INTERNAL TABLE
Hi Experts,
I want to convert rows into coloumns in final internal table.
How to do that one. Can any one help me its very urgent.
Regards,
PBS.hi,
Find the below code for changing rows into colums.
data: begin of itab1 occurs 0,
fld,
end of itab1.
data: begin of itab2 occurs 0,
fld1,
fld2,
fld3,
end of itab2.
itab1-fld = 1.
append itab1.
itab1-fld = 2.
append itab1.
itab1-fld = 3.
append itab1.
read table itab1 index 1.
if sy-subrc eq 0.
itab2-fld1 = itab1-fld.
endif.
read table itab1 index 2.
if sy-subrc eq 0.
itab2-fld2 = itab1-fld.
endif.
read table itab1 index 3.
if sy-subrc eq 0.
itab2-fld3 = itab1-fld.
endif.
append itab2.
loop at itab1.
write:/ itab1.
endloop.
loop at itab2.
write:/ itab2.
endloop.
refer the below link for further information
internal table rows to columns
in the final display list how can i change rows to columns and vice versa -
Converting rows to columns in internal tables
hi
i have an internal table with foll strcuture
customer jan feb mar apr jun july aug sep oct nov dec
a 1 2 3 4 5 6 7 8 9 10 11
b
c
n
i need to form another internal table whose ouput will be
month custA cust B custc cust d
jan 1
feb 2
mar 3
and so on
is this possible to do ? without dynamic internal tableIf you don't know number of records in 1st table in advance you must create dynamic table at runtime.
-
How to create Dynamic Internal table in ALV?
Hi all,
I have to create a ALV report based on dynamic internal table. The requirement is that when I enter the months in my selection screen I should get the data relevant to those many months only. For eg if in selection I have given January to March, I should get an ALV output with columns from January to March only.
Please help me with the coding part as I find it a bit confusing.
Please reply immediately.
Regards,
Bhavani.Hi BHAVANI,
first you have to prapare a field catalog [(see this)|http://help.sap.com/saphelp_470/helpdata/en/52/5f060de02d11d2b47d006094192fe3/frameset.htm]
and than you can use a Method cl_alv_table_create=>create_dynamic_table
I hope that help a little.
Regards Bogdan -
Deleting selected record in Dynamic Internal table
Hi Friends,
I want to delete selected row from a dynamic internal table. The selected entry should be deleted from Adobe and as well as Webdynpro abap.
Kindly help me how to solve this problem.
Thanks in advance.
Regards,
Phani.Hi Matthias,
Thanks a lot for responding.
In my adobe i kept a check box to delete the record. It should delete the selected ones. But right now, its deleting one by one.
I have coded following script for delete button:
IT_TIME_SHEET --> is my internal table
G_ROW_STATUS is the field to track the action performed.
var tlength = xfa.resolveNodes("IT_TIME_SHEET.DATA[*]").length;
for ( var i=0; i<tlength; i++
if(xfa.resolveNode("IT_TIME_SHEET.DATA["i"].FLAG").rawValue ==
1 )
IT_TIME_SHEET.DATA.instanceManager.removeInstance(i);
G_ROW_STATUS.rawValue = "DELETE";
In the Webdynpro abap following code I wrote:
row_count = 1.
FIELD-SYMBOLS <wa> TYPE zshr_time_sheet_time.
LOOP AT it_time_sheet ASSIGNING <wa>.
<wa>-srl_no = row_count.
row_count = row_count + 1.
ENDLOOP.
last_row = <wa>-srl_no.
DELETE it_time_sheet WHERE srl_no EQ last_row.
Suppose if two records checkboxes are selected I can loop at the internal table IT_TIME_SHEET in webdynpro and delete where checkbox is selected.
But problem is once user deletes records, adobe is deleting only one record and if i delete two records from webdynpro it looks like something wrong for the user.
Please help me how to solve this problem.
Regards,
Phani. -
Adding Specific columns of dynamic internal table row into another column
Hi Gurus,
I need to add few columns of a dynamic internal table row into another column:
Article description hy01 hy02 total
101 panza 10 12 22
102 masht 12 12 24
dynamic internal table is created and columns hy01 hy02.... can increase
How to add the the values in hy01 hy 02... into total.
Regards,
DepHi,
If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
Here an example how to generate a dynamic table based on another internal table, hope this will help you.
TYPE-POOLS: slis.
PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
* Type ZST_T:
* matnr TYPE matnr
* maktx TYPE maktx
* hy01 TYPE i
* total TYPE i
TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
PERFORM main.
*& Form main
* text
FORM main.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_t TYPE ty_t,
lr_new_t TYPE REF TO data.
FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
"Add some lines to LT_T just to have something to display on screen
DO 10 TIMES.
APPEND INITIAL LINE TO lt_t.
ENDDO.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZST_S'
CHANGING
ct_fieldcat = lt_fieldcat.
"Copy LT_T to LR_NEW_T
PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
CLEAR lt_t. "Not needed anymore...
ASSIGN lr_new_t->* TO <lt_new_t>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_new_t>.
ENDFORM. "main
*& Form extend_and_copy_table
FORM extend_and_copy_table USING ut_t TYPE STANDARD TABLE
uv_nb_hy TYPE i
CHANGING cr_t TYPE REF TO data
ct_fieldcat TYPE slis_t_fieldcat_alv
RAISING cx_sy_struct_creation cx_sy_table_creation.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_tabledescr TYPE REF TO cl_abap_tabledescr,
lt_components TYPE cl_abap_structdescr=>component_table,
ls_component TYPE cl_abap_structdescr=>component,
lv_field_cnt TYPE numc2,
ls_fieldcat TYPE slis_fieldcat_alv,
lr_fieldcat TYPE REF TO slis_fieldcat_alv.
FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
<lt_new_t> TYPE STANDARD TABLE,
<ls_new_s> TYPE ANY.
"Get the list of all components from UT_T line structure
lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lt_components = lo_structdescr->get_components( ).
"The new columns will be from type of column HY01
ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
"The new columns will have the same fieldcat info as column HY01
READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
"HY<lv_field_cnt> = new field name
lv_field_cnt = uv_nb_hy + 1.
"For each new column...
DO uv_nb_hy TIMES.
"Generate the new column field name
CONCATENATE 'HY' lv_field_cnt INTO ls_component-name.
ls_fieldcat-fieldname = ls_component-name.
"Add the new field to the components of the new structure
INSERT ls_component INTO lt_components INDEX 4.
"Add the new field's fieldcat info to the fieldcat
INSERT ls_fieldcat INTO ct_fieldcat INDEX 4.
lv_field_cnt = lv_field_cnt - 1.
ENDDO.
"Adjust the COL_POS from fieldcat
LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
lr_fieldcat->col_pos = sy-tabix.
ENDLOOP.
"Create the new table
lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
lo_new_tabledescr = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
ASSIGN cr_t->* TO <lt_new_t>.
"Copy all data from old to new table
LOOP AT ut_t ASSIGNING <ls_old_s>.
APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
ENDLOOP.
ENDFORM. "main -
Dynamic internal table- column to row conversion
Hello all,
Inside a program i generate a dynamic internal table and
This table has one single column. But I need to convert the rows as columns.
Eg:
dynamic internal table ITAB has content
Forbes
Times
Reuters
Warner
stern
I would like to have a ITAB2 like this
Forbes Times Reuters Warner Stern
Please note this is a Dynamic internal table!!!!
I need some approach for my problem. Thanks a lot in advance.
Karthik.Hi karthik,
1.
For this purpose,
in my program,
<b> there is an INDEPENDENT FORM</b>
whose inputs are
<b> LIST OF FIELDS, (just as u require)</b>
and from those, it consructs dynamic table.
2. Here is the program.
the dynamic table name will be
<DYNTABLE>.
3. U can use this program (FORM in this program)
to generate any kind of internal table
by specifying list of fields.
4.
REPORT abc.
COMPULSORY
FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
FIELD-SYMBOLS: <dynline> TYPE ANY.
DATA: lt TYPE lvc_t_fcat.
DATA: ls TYPE lvc_s_fcat.
FIELD-SYMBOLS: <fld> TYPE ANY.
DATA : fldname(50) TYPE c.
DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
field list
ddfields-fieldname = 'BUKRS'.
APPEND DDFIELDS.
ddfields-fieldname = 'MATNR'.
APPEND DDFIELDS.
PERFORM mydyntable .
see <DYNTABLE> in debug mode.
BREAK-POINT.
INDEPENDENT FORM
FORM mydyntable .
Create Dyn Table From FC
FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
FIELD-SYMBOLS: <fs_1>.
FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
DATA: lt_data TYPE REF TO data.
data : lt TYPE lvc_t_fcat .
CONSTRUCT FIELD LIST
LOOP AT ddfields.
ls-fieldname = ddfields-fieldname.
APPEND ls TO lt.
ENDLOOP.
ASSIGN lt_data TO <fs_data>.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Assign Dyn Table To Field Sumbol
ASSIGN <fs_data>->* TO <fs_1>.
ASSIGN <fs_1> TO <fs_2>.
ASSIGN <fs_1> TO <dyntable>.
ENDFORM. "MYDYNTABLE
regards,
amit m. -
Subtotals in dynamic internal table using alv grid
hi experts i have created one dynamic table. The requirement is to display the subtotals in the output using reuse_alv_grid.
Dynamic itab (field-symbols) and ALV event BEFORE_LINE_OUTPUT
the above is the thread related and could any one please provide the sample code for this task.
can any one post the solution for that.
rewards points will be awarded.
khazi* ASSINING STRUCTURE FOR FILD CATLOGS
DATA: DYN_TABLE TYPE REF TO DATA,
DYN_LINE TYPE REF TO DATA,
LS_FIELDCAT TYPE LVC_S_FCAT,
LT_FIELDCAT TYPE LVC_T_FCAT.
LOOP AT LT_DMTAB INTO LS_DMTAB.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = LS_DMTAB-SDATE .
LS_FIELDCAT-DATATYPE = 'DEC'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '16' .
LS_FIELDCAT-DECIMALS = '03'.
LS_FIELDCAT-JUST = 'C'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
ENDLOOP.
*& For grouping the table rows for Under Line
LS_FIELDCAT-FIELDNAME = 'ULFIELD' .
LS_FIELDCAT-DATATYPE = 'INT'.
LS_FIELDCAT-INTTYPE = 'P'.
LS_FIELDCAT-INTLEN = '2' .
LS_FIELDCAT-DECIMALS = ''.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
"* Create dynamic internal table and assign to Field-Symbol
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_FIELDCAT
IMPORTING
EP_TABLE = DYN_TABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN DYN_TABLE->* TO <LT_AREA_F>.
"* Create dynamic work area and assign to Field Symbol
CREATE DATA DYN_LINE LIKE LINE OF <LT_AREA_F>.
ASSIGN DYN_LINE->* TO <LS_AREA_F>.
You check in Field cat level you will get Check Sub total field will exist
Thanks and regards
Jogu -
Dynamic internal table column issue
Hi
i have ALV report with dynamic internal table.after i build the internal table and fieldcatalog i have problem i.e. when grid is displayed then one of the column value is coming in the next column.i populated col_pos in field catalog also and in the debug mode data is populated correctly for respective columns in fieldcatalog and dynamic internal table. But when it is displayed i have this problem.
any inputs on this?Hi Moorthy,
Did you perform an ALV consistency check?
Check the below given links as well.
The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
SAP ALV Consistency Check
Regards,
Philip. -
How to Organize the columns in the dynamic internal table?
Hello Folks!
How to Organize the columns in the dynamic internal table? i tried passing the parameter COL_POS to the fieldcatalog, Which is not working.Organize in What order ? What is your way to output ?
If you use ALV, you need to create fresh FIELD CATALOG for your dynamic table and then assign the column position.
Regards,
Diwakar -
Dynamic internal table Created from current classic ALV layout?
Hi,
Currently I have a dynamic ALV column output who's number of columns is dependent on t_output.
ALV Sample:
MANTR WK1 WK2 WK3 ...
10001 10 20 30
10002 5 10 15
I see this option, Get the ALV output, so this includes the header column name and its corresponding entries (which is easier.
Question here: How can I create a dynamic internal table for it_fieldcat of my ALV? Is there any FM or method?
If it will be a method, can you provide more details (I'm not that much yet familiar with method concept in ABAP)
*Note: I am not creating a dynamic table out of SELECT statements
Thanks.
Regards,
JaimePERFORM f_0600-init_alv_layout USING t_alv_layout.
PERFORM f_0700-init_field_catalog USING t_alv_fcat[]. "Populates the ALV Field Catalog
PERFORM f_0800-build_alv_comment USING t_alv_list_top_of_page[]. "title header of the report
PERFORM f_0900-fill_alv_sort_fields.
PERFORM f_1000-build_alv_display.
FORM f_0700-init_field_catalog USING us_vit_alv_fcat1 TYPE slis_t_fieldcat_alv.
DATA: w_vit_alv_fcat TYPE slis_fieldcat_alv.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_matnr TO w_vit_alv_fcat-fieldname,
c_material TO w_vit_alv_fcat-seltext_l,
c_x TO w_vit_alv_fcat-fix_column,
c_x TO w_vit_alv_fcat-key.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_maktx TO w_vit_alv_fcat-fieldname,
c_material_dis TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR: w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_meins TO w_vit_alv_fcat-fieldname,
c_uom TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR: w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_lifnr TO w_vit_alv_fcat-fieldname,
c_vendor TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_name1 TO w_vit_alv_fcat-fieldname,
c_vendorname TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_dispo TO w_vit_alv_fcat-fieldname,
c_mrp_cont TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_stprs TO w_vit_alv_fcat-fieldname,
c_std_price TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_st_pck TO w_vit_alv_fcat-fieldname,
c_st_pck_sz TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
CLEAR w_vit_alv_fcat.
MOVE : c_vit_output TO w_vit_alv_fcat-tabname,
c_kanban TO w_vit_alv_fcat-fieldname,
c_kanbanqty TO w_vit_alv_fcat-seltext_l.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
* To display 26 weeks historical consumptions:
CLEAR w_vit_alv_fcat.
UNASSIGN <fs_hwk_date>.
LOOP AT t_hwk_date ASSIGNING <fs_hwk_date>.
MOVE c_vit_output TO w_vit_alv_fcat-tabname.
CONCATENATE c_hwk <fs_hwk_date>-calender_wk
INTO w_vit_alv_fcat-seltext_l.
CONCATENATE c_hwk <fs_hwk_date>-index
INTO w_vit_alv_fcat-fieldname.
APPEND w_vit_alv_fcat TO us_vit_alv_fcat1.
ENDLOOP.
Edited by: Jaime Cabanban Jr on Apr 24, 2009 3:06 PM -
Hide or Delete Empty columns in dynamic internal table
Hi,
I am having an dynamic internal table which contains more than 100 columns.
I need to delete empty column from that table, can any one help this.Hello,
If you are talking about ALV then you can just the the table for empty columns before populating fieldcataloge and hide the columns.
If your query is still not answered please provide a detail requirement.
Maybe you are looking for
-
Hi, i am using HP 15-d006tu Notebook PC with windows 8 os. Recently i started facing a serious problem ie key with numer 2 and at symbol is not working. my model is having numeric keypad so i can type 2 with that but i am not able to type at symbol.
-
Getting files from a hard drive used w/mac = PC
Hey all, I have an external hard drive that was used with a mac. There are a bunch of files that I need off the hard drive, but every time I plug the hard drive into the pc, the computer knows it's there but I can't access any of the info on the driv
-
How do I make a video project file size smaller so that I can burn to a dvd
I have made a 10 minute premiere elements 13 video which includes photos, video, music and narration. When I publish it the size is 14.9GB which is too large to burn onto a DVD. The size of the file seems extrodinarily large - is there a way to ma
-
Enable Drag and Drop from mail to inbox folder
Using Outlook 2007... Somehow my drag and drop function has been disabled. I can no longer select an email and move it into a mail folder by dragging and dropping. I am able to right click and select "move to" but dragging and dropping is much more e
-
Hi guys. After a support package upgrade at our Solution Manager, some SAP products became inactive. However, these products (like SAP Enterprise Portal, for instance), still being used, and I have to set it to a new project, but how it's inactive, I