Editable & Dynamic ALV
Hi,
I have the situation where I want to create an editable ALV whose column fields will be known during run time. So, here I'm using Dynamic Internal table concept.
Let me give a picture how my present program works,
Inside the fieldcatalog, ifc I have passed the deep structure of type lvc_s_styl, by pointing to the reference table and reference field.
Then I'm using the below code,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
i_length_in_byte = 'X'
IMPORTING
ep_table = dy_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN dy_table->* TO <dyn_table>.
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
And I got the dynamic Internal table having one field (let it be the first column of that internal table) corresponding to the deep structure where we need to pass the fieldname and style = cl_gui_alv_grid=>mc_style_enabled.
Suppose, I have an internal table containing all the fieldnames (consider there are 5 fields) to be in editable mode, lets say, itab.
FIELD-SYMBOLS <t_celltab> TYPE ANY.
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
LOOP AT itab INTO wa.
ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <t_celltab>.
CLEAR ls_stylerow.
ls_stylerow-fieldname = wa-fildname.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_stylerow INTO TABLE lt_styletab.
INSERT LINES OF lt_styletab INTO TABLE <t_celltab>.
ENDLOOP.
And the last bit of code is not working.
My question is simple, How can i assign an internal table (type lvc_s_styl) containing values, to that deep structure field of that dynamic internal table?
Thanks in advance!
Edited by: kishan P on Oct 5, 2010 9:22 PM
I had a similar requirement and was able to get this to work. This may help.
create a local field symbol.
field-symbols: <l_celltab> type lvc_t_styl,
data: li_celltab type line of lvc_t_styl.
Then assign the contents (assuming you already declared this celltab of type lvc_t_styl in your fieldcatalog and therefore into your <dyn_wa> table.
assign ('<dyn_wa>-celltab') to <l_celltab>.
loop at <dyn_wa>-celltab into li_celltab.
insert li_celltab into table <l_celltab>.
endloop.
I hope you find this helpful. I have this working for me in a complex ALV I wrote a few years back.
Similar Messages
-
Unable to capture data in an editable dynamic ALV.
Hi ,
I have created a dynamic editable ALV whose displayed structure can be changed at runtime based on the selection in a drop down list value selector.
Im trying to capture the values entered in the ALV into an internal table before the user changes the structure of the ALV to a different structure.
In the ON_SELECT event handler of the drop down list box , im rasing a data_check event to capture the ALV data.
The problem is that the control is not entering the event handler for the data_check event.
If i raise the data_check event in my save event handler or any other event handler , it works fine.
Can someone please suggest a solution.
Regards,
Newton.Hi ,
I have figured out that the problem is local to my machine , because the code works fine on other machines.
I guess my internet explorer has some bug.
Regards,
Newton. -
Create structure in Dynamic ALV for color and editing cells
Hi experts,
I created dynamic ALV . in this i want coloring and editing of cells.
this can be done by strucutture lvc_t_scol, lvc_t_styl.
My problem is how to create structure in field catalogue of Dynamic ALV.
ThanksHello
I am not sure if you have missed the following part of the coding:
" Add table type (LVC_T_STYL) as field to structure ==> complex structure
CLEAR: gs_comp.
gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
gs_comp-name = 'CELLTAB'.
APPEND gs_comp TO gt_components.
go_sdescr = cl_abap_structdescr=>create( gt_components ).
go_tdescr = cl_abap_tabledescr=>create( go_sdescr ).
CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
ASSIGN gdo_handle->* TO <gt_itab>.
This is exactly your requirement.
Regards
Uwe -
Edit and save dynamic alv.
Hi Experts
I have created a dynamic table then filled this dynamic table with the help of field symbols and then passed this dynamic table to grid1->set_table_for_first_display and hence the dynamic alv is shown on the screen. Now, can I do something to make this alv editable and store these values in z table. I have tried the method get_changed_cell method, but no help.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVC_CAT
IMPORTING
EP_TABLE = LP_TABLE.
ASSIGN LP_TABLE->* TO <LT_DATA>.
*Create structure = structure of the internal table
CREATE DATA LP_STRUCT LIKE LINE OF <LT_DATA>.
ASSIGN LP_STRUCT->* TO <HEADER>.
* SORT gt_data BY erdat.
*sort IT_VEWAO by MATNR.
LOOP AT IT_VEWZO INTO WA_VEWZO.
AT NEW VKBUR.
CLEAR <HEADER>.
ASSIGN COMPONENT 'VKBUR' OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-VKBUR.
ENDAT.
MOVE WA_VEWZO-PD_HIER TO L_COL.
ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-PLAN_QTY.
CONCATENATE WA_VEWZO-PD_HIER '_AP' INTO WA_VEWZO-PD_HIER .
MOVE WA_VEWZO-PD_HIER TO L_COL.
ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
<FIELD> = WA_VEWZO-APROV_QTY.
AT END OF VKBUR.
APPEND <HEADER> TO <LT_DATA>.
ENDAT .
ENDLOOP.
CREATE OBJECT CUSTOM_CONTAINER1
EXPORTING
CONTAINER_NAME = 'CUST_CONT'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = CUSTOM_CONTAINER1.
CALL METHOD grid1->REGISTER_EDIT_EVENT
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_STRUCTURE_NAME = lv_lp_struct
IS_LAYOUT = LS_LAYOUT
CHANGING
* IT_SORT = LT_SORT1
IT_FIELDCATALOG = LT_FIELDCAT
IT_OUTTAB = <LT_DATA>.Hi,
What help u need?
to activate the editable field u need to pass the field catalog parameter
EDIT = 'X'
Then Edit values in your alv
and press enter or define any icons in ur alv list useing user command
check the changed values using the method
CALL METHOD g_alvgrid1->check_changed_data( ).
It will help you i think.
Regards,
Nandha -
Editing values within Dynamic ALV
Hello All,
I am currently working on dynamic ALV and want the columns to be editible.
I have gone through the tutorial
Link : [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783]
and have created a dynamic Context and a corresponding ALV LIST display. Everything is fine except that i want to be able to edit values within the list and i want this to get populated back into the context.
I have gone through the tutorial.
Link : [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]
But i couldn't relate that with the tutorial for dynamic ALV.
Please help.
Best Regards,
MzHello Lekha,
I am sorry to say that the code which you have provided is not working.
Maybe i am doing something wrong.
This is the entire code below.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
data lo_cmp_usage type ref to if_wd_component_usage.
data : L_VIEW_CONTROLLER_API type ref to IF_WD_VIEW_CONTROLLER.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lo_interfacecontroller->set_data(
* only_if_new_descr = " wdy_boolean
"r_node_data =
dyn_node " ref to if_wd_context_node
DATA:
lo_value type ref to cl_salv_wd_config_table,
lr_column TYPE REF TO cl_salv_wd_column, " Table fo rcolumn ref
ls_columns TYPE salv_wd_s_column_ref, " Structure for column ref
lt_columns TYPE salv_wd_t_column_ref, " Structure for column ref
lr_input TYPE REF TO cl_salv_wd_uie_input_field.
lo_value = lo_interfacecontroller->get_model( ).
* Get the column ref
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
LOOP AT lt_columns INTO ls_columns.
lr_column = ls_columns-r_column.
case ls_columns-id.
when 'JAN2007'.
CREATE OBJECT lr_input
EXPORTING
value_fieldname = ls_columns-id.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_input.
* Set the read only attribute
lr_input->set_read_only_fieldname( value = 'FALSE' ).
endcase.
endloop.
L_VIEW_CONTROLLER_API = WD_THIS->WD_GET_API( ).
L_VIEW_CONTROLLER_API->PREPARE_DYNAMIC_NAVIGATION(
source_window_name = 'WINDOW1'
source_vusage_name = 'MAIN_USAGE_0'
source_plug_name = 'TO_V1'
target_component_name = 'SALV_WD_TABLE'
target_component_usage = 'ALV'
target_view_name = 'TABLE'
target_plug_name = 'DEFAULT'
target_embedding_position = 'MAIN/VIEW_CONTAINER'
WD_THIS->FIRE_TO_V1_PLG( ).
The part which is entered as per your instructions are given between the asterisk lines.
Sorry if there are any silly mistakes on my part.
I have one small doubt regarding the value to be passed for the method lr_input->set_read_only_fieldname. This is a string value. I think that this could be the cause of the error. When i checked the class interface, CL_SALV_WD_UIE_INPUT_FIELD i found that the method set_read_only_fieldname is calling another attribute if_salv_wd_c_table_evt_editor=>set_read_only_fieldname.
Hope this was useful
Best Regards,
Mz -
Dynamic ALV and cl_abap_structdescr Create method
Hi
In the process of creation of Dynamic ALV, as I have char_name and char_descr fields, I have to use char_descr as column header of ALV because char_name which has entries something like DVS_******(that do not make any sense to user). I am facing 2 problems here using the scenario above.
1. char_descr contains characters like '[', ']', ' /', '.', space which are invalid characters for method cl_abap_structdescr=>create(). How to handle scenario like this?
2. assign (lv_value) to <value>.
if sy-subrc = 0.
<value> = ls_bapi_char_value-charvalue.
if <value> is assigned.
move ls_bapi_char_value-charvalue to <value>.
where-> concatenate '<table_dyn_wa>-' ls_bapi_char-char_descr into lv_value
<value> type any
<table_dyn_wa>- is dynamic table with structure created with cl_abap_tabledescr=>create( p_line_type = stru_type )
with above code for few fields data is being assigned and for few sy-subrc = 4. The table from where I am reading the field contains char_name associated with it and not char_descr. For the fields whose char_name and char_descr matches exactly, ALV displays data for it.
How to resolve the issue so that I could get all the data?
Let me know if further details are needed.
Thanks, in advance
Trupti
Edited by: TRUPTI KALLURWAR on Jul 9, 2010 7:08 PMHello Srikanth,
CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE( ) uses the GENERATE SUBROUTINE POOL technique to create the dynamic internal tables.
And as per the SAP documentation,
In an internal mode, a maximum of 36 temporary subroutine pools may be created.
Source: [http://help.sap.com/abapdocu_702/en/abapgenerate_subroutine_pool.htm]
Btw why are you crating 36 dynamic internal table? That's way too far-fetched even for the RTTC classes
BR,
Suhas -
Problem in Dynamic ALV - inserting values in proper field of a table.
Hi gurus,
As per the user requirement I need to create a dynamic alv report. The fields will be display according to the period entered.
I have already build the alv and it is working fine. But My questio is how can I append data into internal table in its proper field.
suppose I have enter period 1 to 3 in selection screen. Then my table structure will be
JAN | FEB | MAR
Upto this is is working fine, fields are generated dynamically , but how can I insert data only in perticular field.
like
itab-JAN = 001.
itab-FEB = 002.
itab-MAR = 003.
append itab
JAN | FEB | MAR
001 002 003
Please give me a solution of that. waiting for reply.hI,
loop at <dyn_table> assigning <wa>.
lv_count = 001.
*perform get_short_tet of month in a varibale say lv_var
assign component LV_VAR of structure <wa> to <dyn_field1>.
<dyn_field1> = lv_count.
lv_count = lv_count + 1.
endloop.
Regards,
mrunal
Edited by: Mrunal Shyamkant Patki on Nov 5, 2009 10:53 AM
Edited by: Mrunal Shyamkant Patki on Nov 5, 2009 10:54 AM -
Dynamic ALV as per the periods on the selection screen
Hello Experts
I am new to dynamic ALV , Please help me to sought out my confusion.
I want to create a dynamic ALV , based on the period mentioned at selection screen.
for example I want to display the movement type ( sum of the quantity ) for materials for the full month.
I want the ALV output as below.
Material .........qty 01.04.2011..... qty 02.04.2011... qty 03.04.2011 ........ qty 30.04.2011
AB1........................... 30.................... 20............................. 50......................... 200
AB2.................................................... 50 ............................. 80 ..........................10
I create an internal table itab with there fields to selact the data
MATNR
date
qty
select MATNR
date
qty
into itab
from mseg
where based on the selection screen.
then collect the data to other table date wise , now i have summrise data of material quantity
now the results after collection data into table itab2 is as follows
Material ................... date ................................ qty
AB1 .................... 01.04.2011....................... 30
AB1 ................... 02.04.2011 ....................... 20
AB1 ................... 03.04.2011....................... 50
AB1 ................... .30.04.2011....................... 200
AB2 .................... 02.04.2011....................... 50
AB2 ....................... 03.04.2011....................... 80
AB2 ....................... 30.04.2011 ....................... 10
How can I display these fields horizontally instead of vertically ,
and to the exact column as per the field catalog column header belongs to date.
it would be so helpful if somebody explain with code by taking the above example.
Thanks in AdvanceHello Both Experts ,
I write the below code and it is working for the requirement.
Can you please check
REPORT z_test_dynamic .
TABLES : mkpf , mseg .
TYPES : BEGIN OF t_mseg ,
mblnr TYPE mblnr ,
bwart TYPE bwart ,
matnr TYPE matnr ,
werks TYPE werks_d ,
menge TYPE menge_d ,
budat TYPE budat ,
END OF t_mseg.
TYPES : BEGIN OF t_mseg_1 ,
matnr TYPE matnr ,
menge TYPE menge_d ,
budat TYPE budat ,
END OF t_mseg_1.
DATA : gt_mseg TYPE STANDARD TABLE OF t_mseg ,
gs_mseg TYPE t_mseg,
gt_mseg_1 TYPE STANDARD TABLE OF t_mseg_1 ,
gs_mseg_1 TYPE t_mseg_1,
gt_mseg_2 TYPE STANDARD TABLE OF t_mseg_1 ,
gs_mseg_2 TYPE t_mseg_1..
DATA : gt_date TYPE STANDARD TABLE OF sy-datum ,
gs_date TYPE sy-datum..
DATA: ok_code LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'CONTAINER_01',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: gt_fieldcat TYPE lvc_t_fcat.
DATA: gp_table TYPE REF TO data.
FIELD-SYMBOLS: <gt_table> TYPE table.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mseg-matnr ,
s_bwart FOR mseg-bwart NO INTERVALS,
s_werks FOR mseg-werks ,
s_budat FOR mkpf-budat .
PARAMETERS : p_mjahr TYPE mjahr OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
PERFORM field_catalog.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcat
IMPORTING
ep_table = gp_table.
ASSIGN gp_table->* TO <gt_table>.
PERFORM select_main_data.
PERFORM move_data.
*& Form select_main_data
* text
* --> p1 text
* <-- p2 text
FORM select_main_data .
SELECT mseg~mblnr
mseg~bwart
mseg~matnr
mseg~werks
mseg~menge
mkpf~budat
INTO TABLE gt_mseg
FROM mseg AS mseg INNER JOIN mkpf AS mkpf
ON mseg~mblnr = mkpf~mblnr AND
mseg~mjahr = mkpf~mjahr
WHERE matnr IN s_matnr AND
budat IN s_budat AND
werks IN s_werks AND
bwart IN s_bwart AND
mseg~mjahr EQ p_mjahr .
IF gt_mseg IS NOT INITIAL.
LOOP AT gt_mseg INTO gs_mseg.
gs_mseg_1-matnr = gs_mseg-matnr.
gs_mseg_1-budat = gs_mseg-budat.
gs_mseg_1-menge = gs_mseg-menge.
COLLECT gs_mseg_1 INTO gt_mseg_1.
ENDLOOP.
ENDIF.
gt_mseg_2 = gt_mseg_1.
DELETE ADJACENT DUPLICATES FROM gt_mseg_2 COMPARING matnr.
ENDFORM. " select_main_data
*& Form field_catalog
* text
* --> p1 text
* <-- p2 text
FORM field_catalog .
DATA : lt_day_attributes TYPE STANDARD TABLE OF casdayattr ,
ls_day_attributes TYPE casdayattr .
DATA: ls_fieldcat TYPE lvc_s_fcat ,
lv_fieldname TYPE lvc_fname.
IF s_budat-high IS INITIAL.
s_budat-high = s_budat-low.
ENDIF.
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
EXPORTING
* FACTORY_CALENDAR = ' '
* HOLIDAY_CALENDAR = ' '
date_from = s_budat-low
date_to = s_budat-high
language = sy-langu
* IMPORTING
* YEAR_OF_VALID_FROM =
* YEAR_OF_VALID_TO =
* RETURNCODE =
TABLES
day_attributes = lt_day_attributes
* EXCEPTIONS
* FACTORY_CALENDAR_NOT_FOUND = 1
* HOLIDAY_CALENDAR_NOT_FOUND = 2
* DATE_HAS_INVALID_FORMAT = 3
* DATE_INCONSISTENCY = 4
* OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT lt_day_attributes INTO ls_day_attributes.
gs_date = ls_day_attributes-date.
APPEND gs_date TO gt_date.
ENDLOOP.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-inttype = 'CHAR18'.
ls_fieldcat-coltext = 'MATERIAL'.
* ls_fieldcat-decimals_o = '2'.
ls_fieldcat-outputlen = 18.
APPEND ls_fieldcat TO gt_fieldcat.
LOOP AT gt_date INTO gs_date.
CONCATENATE 'QTY_' gs_date INTO lv_fieldname.
ls_fieldcat-fieldname = lv_fieldname.
ls_fieldcat-inttype = 'QUAN'.
ls_fieldcat-coltext = gs_date.
ls_fieldcat-decimals_o = '2'.
* ls_fieldcat-outputlen = 18.
APPEND ls_fieldcat TO gt_fieldcat.
ENDLOOP.
ENDFORM. " field_catalog
*& Form move_data
* text
* --> p1 text
* <-- p2 text
FORM move_data .
DATA: l_row TYPE sy-index.
FIELD-SYMBOLS: <ls_table>.
FIELD-SYMBOLS: <l_field> ,
<l_mseg_1> TYPE t_mseg_1.
DATA: ls_fieldcat TYPE lvc_s_fcat .
ASSIGN LOCAL COPY OF INITIAL LINE OF <gt_table> TO <ls_table>.
SORT gt_mseg_1 BY matnr.
LOOP AT gt_mseg_1 ASSIGNING <l_mseg_1> .
IF <l_field> IS ASSIGNED.
UNASSIGN <l_field>.
ENDIF.
MOVE-CORRESPONDING <l_mseg_1> TO <ls_table>.
READ TABLE gt_fieldcat INTO ls_fieldcat WITH KEY coltext = <l_mseg_1>-budat.
IF sy-subrc EQ 0.
ASSIGN COMPONENT ls_fieldcat-fieldname OF STRUCTURE <ls_table> TO <l_field>.
<l_field> = <l_mseg_1>-menge.
ELSE.
<l_field> = 0.
ENDIF.
AT end of matnr.
APPEND <ls_table> TO <gt_table>.
clear <ls_table>.
ENDAT.
ENDLOOP.
ENDFORM. " move_data
your answers help me lot . I am awarding the points.
Very Very Thanks
Edited by: Dilraj Singh on Apr 13, 2011 3:58 PM
Edited by: Dilraj Singh on Apr 13, 2011 4:09 PM
Edited by: Dilraj Singh on Apr 13, 2011 4:23 PM -
Dynamic ALV Grid is not displaying !!
Hi all,
I am trying to create dynamic alv grids and upto five levels(five grids) out put is displaying fine without any problem. But when I try to display the 6th grid, the program is going into infinite loop and getting timed out. Even I tried to increse the height of the grid even though it is not displaying.
Please correct me if any thing is wrong in below code.
*1st Level grid
IF <table1> IS ASSIGNED AND <table1> IS NOT INITIAL.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '20'.
CREATE OBJECT ob_grid1
EXPORTING
i_parent = ob_split1->top_left_container.
ELSE.
CREATE OBJECT ob_split1
EXPORTING
parent = ob_custom
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split1 '0'.
ENDIF.
*2nd Level grid
IF <table2> IS ASSIGNED AND <table2> IS NOT INITIAL.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '20'.
CREATE OBJECT ob_grid2
EXPORTING
i_parent = ob_split2->top_left_container.
ELSE.
CREATE OBJECT ob_split2
EXPORTING
parent = ob_split1->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split2 '0'.
ENDIF.
(Created 3rd,4th,5th same like above).
*6th Level grid
IF <table6> IS ASSIGNED AND <table6> IS NOT INITIAL.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '20'.
CREATE OBJECT ob_grid6
EXPORTING
i_parent = ob_split6->top_left_container.
ELSE.
CREATE OBJECT ob_split6
EXPORTING
parent = ob_split5->bottom_right_container
orientation = cl_gui_easy_splitter_container=>orientation_vertical.
PERFORM set_split_height USING ob_split6 '0'.
ENDIF.
Appreciated your reply. Please let me know for additional info.
Thanks,
Ranjith.
Edited by: Thomas Zloch on Dec 8, 2010 5:44 PM - please use code tagsHi romanch,
defining the field catalog you must reference all currency fields to the respective currency key field (type CUKY).
<alv_fieldcat>-cfieldname = 'HWAER'.
This is sample for alv output of a currency field. The alv structure has a field HWAER which carries the currency key, e.g. USD or so.
Obviously you do not provide a cutrrency key for your values. If they are initial (zero), ALV will not display them as 0,00 but leave the field empty if the reference too currency key is not established.
If you define a DDIC structure for the ALV output this refernce is enforced. You can pass the DDIC structure name to the ALV and don not have to create the field catalog manually.
Regards,
Clemens -
Hi Experts,
I am working on a BAPI for creating Requsition where i am taking one ref PR and then modifying required details and then creating a new PR.
Everything is working fine but before creating the new PR i want to display that data in the form of alv grid and where i can edit the values and save then a new PR will be created as per modification on alv.
check the sample code wht i hv done....
SELECT * FROM EBAN INTO CORRESPONDING FIELDS OF TABLE IT_EBAN WHERE
BANFN EQ S_BANFN.
LOOP AT IT_EBAN.
ENDLOOP.
LOOP AT IT_EBAN.
T_REQUISITION_ITEMS-DOC_TYPE = 'ZSD'.
MOVE IT_EBAN-BNFPO TO T_REQUISITION_ITEMS-PREQ_ITEM.
MOVE IT_EBAN-ERNAM TO T_REQUISITION_ITEMS-CREATED_BY.
MOVE IT_EBAN-AFNAM TO T_REQUISITION_ITEMS-PREQ_NAME.
MOVE IT_EBAN-BADAT TO T_REQUISITION_ITEMS-PREQ_DATE.
MOVE IT_EBAN-TXZ01 TO T_REQUISITION_ITEMS-SHORT_TEXT.
MOVE IT_EBAN-MATNR TO T_REQUISITION_ITEMS-MATERIAL.
MOVE IT_EBAN-EMATN TO T_REQUISITION_ITEMS-PUR_MAT.
T_REQUISITION_ITEMS-PLANT = '4000'.
T_REQUISITION_ITEMS-STORE_LOC = 'YRD1'.
T_REQUISITION_ITEMS-PUR_GROUP = 'JSD'.
MOVE IT_EBAN-MATKL TO T_REQUISITION_ITEMS-MAT_GRP.
MOVE IT_EBAN-MENGE TO T_REQUISITION_ITEMS-QUANTITY.
MOVE IT_EBAN-MEINS TO T_REQUISITION_ITEMS-UNIT.
T_REQUISITION_ITEMS-DELIV_DATE = '20080618'.
APPEND T_REQUISITION_ITEMS.
CALL FUNCTION 'BAPI_REQUISITION_CREATE'
EXPORTING
SKIP_ITEMS_WITH_ERROR =
IMPORTING
NUMBER = E_NUMBER
TABLES
REQUISITION_ITEMS = T_REQUISITION_ITEMS
*REQUISITION_ACCOUNT_ASSIGNMENT = T_REQ_ACCOUNT_ASSIGNMENT
REQUISITION_ITEM_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SRV_ACCASS_VALUES =
RETURN = T_RETURN
REQUISITION_SERVICES_TEXT =
EXTENSIONIN =
REQUISITION_ADDRDELIVERY =
ENDLOOP.
IF NOT E_NUMBER IS INITIAL .
WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
ELSE.
LOOP AT T_RETURN.
WRITE T_RETURN-MESSAGE.
ENDLOOP.
ENDIF.
what i want is before calling BAPI_REQUISITION_CREATE i need to display it_eban as alv and then where i can edit the values and save and that values will move to T_REQUISITION_ITEMS table. no need of hard cording Plant and purch. grop and storage location details. I know how to display the ALV grid just tell me how to edit in ALV and when i cllick save it shold move to BAPI_REQUISITION_CREATE.
its an urgent...
<b>points will be rewarded for useful answers</b>
Regards,
sunil kairam.Check this editable alv report...
REPORT zjay_edit_alv.
* TYPE-POOLS *
TYPE-POOLS: slis.
* INTERNAL TABLES/WORK AREAS/VARIABLES
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
* FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
* SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
lines(5) TYPE n DEFAULT 7.
* START-OF-SELECTION *
START-OF-SELECTION.
* Storing table name
p_table = tabname.
* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>.
SORT i_fieldcat BY col_pos.
* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS.
REFRESH <dyn_tab_temp>.
* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form SET_PF_STATUS
* Setting custom PF-Status
* -->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard
ENDFORM. "SET_PF_STATUS
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>.
CASE r_ucomm.
* When a record is selected
WHEN '&IC1'.
* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
* Make all the fields input enabled except key fields
w_field-input = 'X'.
MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
ENDIF.
* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
* If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
ENDIF.
* When save button is pressed
WHEN 'SAVE'.
* Sort the index table
SORT i_index.
* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
LOOP AT i_index.
* Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF.
ENDLOOP.
* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command -
How to save data in ztable after editing in alv report
how to save data in ztable after editing in alv report?
Hi,
Please find the attachment below.This may be usefull to you.
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
Regards,
Ramakrishna Yella. -
Make rows as non editable in ALV
Hi Experts,
I have a standard ALV table where records are fetched from backend table. Here I have a field Approved as check box.
My requirement is I need to make all the rows as non editable, if the Approved checkbox is checked. How can I achieve this.
I went through the below discussion, but still am not clear of how to achieve it.
How to set some rows in ALV to be editable or some non editable.
I know to set a field as non editable in WD, but don't know how to set some specific rows as non editable in alv.
Please help me.
With Regards,
Ramakrishnan MHi,
Create an Attribute in the Context say READ_ONLY of type wdy_boolean and bind the read only of cell editor to that attribute using set_read_only_fieldname( ) method. Then set the value of attribute READ_ONLY to abap_true/abap_false based on check box value.
check this wiki for reference: How to edit conditionally row of a ALV table in Web Dynpro for ABAP - Web Dynpro ABAP - SCN Wiki
Hope this helps u,
Regards,
Kiran -
Problem in Data Display in Dynamic ALV Report
Hi all,
I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
REPORT zdynamic_test .
*REPORT ztest_notepad.
*& Declarations
*Type-pools
TYPE-POOLS: slis.
*TABLES
TABLES: zjpack_base.
*Types
TYPES:
ty_fcat TYPE lvc_s_fcat,
ty_fcatalog TYPE slis_fieldcat_alv.
*Work areas
DATA:
wa_fcat TYPE ty_fcat,
wa_fcatalog TYPE ty_fcatalog.
*Internal tables
DATA:
it_fcat TYPE STANDARD TABLE OF ty_fcat,
it_fcatalog TYPE STANDARD TABLE OF ty_fcatalog.
*Type reference
DATA:
it_dyn_tab TYPE REF TO data,
wa_newline TYPE REF TO data.
*INTERNAL TABLE
DATA: BEGIN OF it_itab OCCURS 0.
INCLUDE STRUCTURE zjpack_base.
DATA: END OF it_itab.
*Filed symbols
FIELD-SYMBOLS:
<gt_table> TYPE STANDARD TABLE,
<fs_dyntable>,
<fs_fldval> TYPE ANY,
<l_field> TYPE ANY.
*Variables
DATA:
l_fieldname TYPE lvc_s_fcat-fieldname,
l_tabname TYPE lvc_s_fcat-tabname,
l_fieldtext TYPE lvc_s_fcat-seltext,
l_index TYPE char2.
"Selection-screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
SELECTION-SCREEN END OF BLOCK b1.
PARAMETERS:
p_colms TYPE i.
*& start-of-selection.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_fieldcat.
PERFORM create_dynamic_table.
DO 20 TIMES.
DO p_colms TIMES.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
<l_field> = sy-index.
ENDDO.
INSERT <fs_dyntable> INTO TABLE <gt_table>.
ENDDO.
LOOP AT it_itab.
l_index = sy-tabix.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
<l_field> = it_itab-matnr.
INSERT <fs_dyntable> INTO TABLE <gt_table>.
ENDLOOP.
LOOP AT it_fcat INTO wa_fcat.
PERFORM fieldcatalog1 USING: wa_fcat-fieldname
wa_fcat-tabname
wa_fcat-seltext.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST_NOTEPAD'
it_fieldcat = it_fcatalog
TABLES
t_outtab = <gt_table>.
*& Form BUILD_FIELDCAT
FORM build_fieldcat .
CLEAR: l_fieldname,
l_tabname,
l_fieldtext,
l_index.
DO p_colms TIMES.
CLEAR l_index.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
CONCATENATE 'Field' l_index INTO l_fieldtext.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
ENDDO.
ENDFORM. " BUILD_FIELDCAT
*& Form CREATE_DYNAMIC_TABLE
FORM create_dynamic_table .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_dyn_tab.
ASSIGN it_dyn_tab->* TO <gt_table>.
Create dynamic work area and assign to FS
CREATE DATA wa_newline LIKE LINE OF <gt_table>.
ASSIGN wa_newline->* TO <fs_dyntable>.
ENDFORM. " CREATE_DYNAMIC_TABLE
*& Form FIELDCATALOG
FORM fieldcatalog USING field table f_txt.
wa_fcat-fieldname = field.
wa_fcat-tabname = table.
wa_fcat-seltext = f_txt.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " FIELDCATALOG
*& Form FIELDCATALOG1
FORM fieldcatalog1 USING field table f_txt.
wa_fcatalog-fieldname = field.
wa_fcatalog-tabname = table.
wa_fcatalog-seltext_m = f_txt.
APPEND wa_fcatalog TO it_fcatalog.
CLEAR wa_fcatalog.
ENDFORM. " FIELDCATALOG1
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
DATA: v_srlno TYPE i.
SELECT matnr charg blqty
INTO CORRESPONDING FIELDS OF it_itab
FROM zjpack_base
WHERE matnr IN s_matnr
AND charg IN s_charg
AND fdate IN s_fdate.
COLLECT it_itab.
ENDSELECT.
v_srlno.
LOOP AT it_itab.
v_srlno = v_srlno + 1.
ENDLOOP.
CLEAR: l_fieldname,
l_tabname,
l_fieldtext,
l_index.
1st Field
l_index = sy-tabix.
CONCATENATE 'FIELD' '1' INTO l_fieldname.
l_fieldtext = 'MATNR'.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
Other fields
LOOP AT it_itab.
CLEAR l_index.
l_index = sy-tabix + 1.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
ENDLOOP.
Please guide me how my problem will solve.
Thanks & Regards
NirmalHi all, I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
*& Report ZDYNAMIC_TEST *
REPORT zdynamic_test .
*REPORT ztest_notepad.
*& Declarations
*Type-pools
TYPE-POOLS: slis.
*TABLES
TABLES: zjpack_base.
*Types
TYPES:
ty_fcat TYPE lvc_s_fcat,
ty_fcatalog TYPE slis_fieldcat_alv.
*Work areas
DATA:
wa_fcat TYPE ty_fcat,
wa_fcatalog TYPE ty_fcatalog.
*Internal tables
DATA:
it_fcat TYPE STANDARD TABLE OF ty_fcat,
it_fcatalog TYPE STANDARD TABLE OF ty_fcatalog.
*Type reference
DATA:
it_dyn_tab TYPE REF TO data,
wa_newline TYPE REF TO data.
*INTERNAL TABLE
DATA: BEGIN OF it_itab OCCURS 0.
INCLUDE STRUCTURE zjpack_base.
DATA: END OF it_itab.
*Filed symbols
FIELD-SYMBOLS:
<gt_table> TYPE STANDARD TABLE,
<fs_dyntable>,
<fs_fldval> TYPE ANY,
<l_field> TYPE ANY.
*Variables
DATA:
l_fieldname TYPE lvc_s_fcat-fieldname,
l_tabname TYPE lvc_s_fcat-tabname,
l_fieldtext TYPE lvc_s_fcat-seltext,
l_index TYPE char2.
"Selection-screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
SELECTION-SCREEN END OF BLOCK b1.
PARAMETERS:
p_colms TYPE i.
*& start-of-selection.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_fieldcat.
PERFORM create_dynamic_table.
* DO 20 TIMES.
* DO p_colms TIMES.
* l_index = sy-index.
* CONCATENATE 'FIELD' l_index INTO l_fieldname.
* ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
* <l_field> = sy-index.
* ENDDO.
* INSERT <fs_dyntable> INTO TABLE <gt_table>.
* ENDDO.
LOOP AT it_itab.
l_index = sy-tabix.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
<l_field> = it_itab-matnr.
INSERT <fs_dyntable> INTO TABLE <gt_table>.
ENDLOOP.
LOOP AT it_fcat INTO wa_fcat.
PERFORM fieldcatalog1 USING: wa_fcat-fieldname
wa_fcat-tabname
wa_fcat-seltext.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST_NOTEPAD'
it_fieldcat = it_fcatalog
TABLES
t_outtab = <gt_table>.
*& Form BUILD_FIELDCAT
FORM build_fieldcat .
* CLEAR: l_fieldname,
* l_tabname,
* l_fieldtext,
* l_index.
* DO p_colms TIMES.
* CLEAR l_index.
* l_index = sy-index.
* CONCATENATE 'FIELD' l_index INTO l_fieldname.
* CONCATENATE 'Field' l_index INTO l_fieldtext.
* l_tabname = '<GT_TABLE>'.
* PERFORM fieldcatalog USING: l_fieldname
* l_tabname
* l_fieldtext.
* ENDDO.
ENDFORM. " BUILD_FIELDCAT
*& Form CREATE_DYNAMIC_TABLE
FORM create_dynamic_table .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_dyn_tab.
ASSIGN it_dyn_tab->* TO <gt_table>.
* Create dynamic work area and assign to FS
CREATE DATA wa_newline LIKE LINE OF <gt_table>.
ASSIGN wa_newline->* TO <fs_dyntable>.
ENDFORM. " CREATE_DYNAMIC_TABLE
*& Form FIELDCATALOG
FORM fieldcatalog USING field table f_txt.
wa_fcat-fieldname = field.
wa_fcat-tabname = table.
wa_fcat-seltext = f_txt.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " FIELDCATALOG
*& Form FIELDCATALOG1
FORM fieldcatalog1 USING field table f_txt.
wa_fcatalog-fieldname = field.
wa_fcatalog-tabname = table.
wa_fcatalog-seltext_m = f_txt.
APPEND wa_fcatalog TO it_fcatalog.
CLEAR wa_fcatalog.
ENDFORM. " FIELDCATALOG1
*& Form SELECT_DATA
* text
* --> p1 text
* <-- p2 text
FORM select_data .
* DATA: v_srlno TYPE i.
SELECT matnr charg blqty
INTO CORRESPONDING FIELDS OF it_itab
FROM zjpack_base
WHERE matnr IN s_matnr
AND charg IN s_charg
AND fdate IN s_fdate.
COLLECT it_itab.
ENDSELECT.
* v_srlno.
* LOOP AT it_itab.
* v_srlno = v_srlno + 1.
* ENDLOOP.
CLEAR: l_fieldname,
l_tabname,
l_fieldtext,
l_index.
* 1st Field
* l_index = sy-tabix.
CONCATENATE 'FIELD' '1' INTO l_fieldname.
l_fieldtext = 'MATNR'.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
* Other fields
LOOP AT it_itab.
CLEAR l_index.
l_index = sy-tabix + 1.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
ENDLOOP.
ENDFORM. " SELECT_DATA -
Problem in print out of Dynamic ALV
Hi ,
I am using dynamic ALV to address a requirement. The ALV is working fine and the output is also coming corretly, even in spool.
But if the width of dynamic table exceeds a limit, then nothing is coming in the print out.
If anyone has faced similar problem or knows how to tackle this problem, please advise what can be done here.
Thanks,
SonalHi,
Can you try to increase field with to maximun as per your requirement.
Regards,
Sai -
Hi all
i try to put color in the dynamic alv, but i become a dump message
Runtime Errors OBJECTS_MOVE_NOT_SUPPORTED
Date and Time 28.10.2010 08:46:49
Short text
Conversion of type "h" to type "g" not supported.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to move one data object to another.
This is not possible here because the conversion of a data object
of type "h" to type "g" is not supported.
my code implementation looks like
method validate_order_deli.
data ls_scol type lvc_s_scol.
data ls_colo type lvc_s_colo.
data ls_aoc_percent type zsd_aoc_percent.
data lf_deliv type lifmg.
data lf_db_percent type f.
data lf_calc_perc type f.
refresh et_color.
select single *
from zsd_aoc_percent
into corresponding fields of ls_aoc_percent
where acin = 'X'.
if sy-subrc <> 0.
exit.
endif.
lf_db_percent = ls_aoc_percent-percent.
* ls_scol-fname = if_fieldname.
ls_scol-fname = 'MATNR'.
if if_deliv <> 0.
me->calc_amour_unit(
exporting
if_matnr = if_matnr
if_amount = if_deliv
if_input = if_deliv_unit
if_output = if_order_unit
importing
ef_amount = lf_deliv
lf_calc_perc = ( lf_deliv * 100 ) / if_order.
if lf_calc_perc < lf_db_percent.
ls_colo-col = cl_gui_resources=>list_col_positive.
else.
ls_colo-col = cl_gui_resources=>list_col_negative.
endif.
ls_scol-color = ls_colo.
append ls_scol to et_color.
else.
exit.
endif.
endmethod. "validate_order_deli
method add_color_field.
data ls_fcat type lvc_s_fcat.
ls_fcat-fieldname = 'COLOR'.
ls_fcat-ref_field = 'COLTAB'.
ls_fcat-ref_table = 'CALENDAR_TYPE'.
append ls_fcat to ct_fcat.
endmethod. "add_color_field
ls_lvc_s_layo-cwidth_opt = 'X'.
ls_lvc_s_layo-ctab_fname = 'COLOR'.
i don't no, what's wrong...
thx for help*& Form generate_alv
* text
form generate_alv.
field-symbols <lt_any_table> type any table.
if lrf_gui_custom_container is initial.
create object lrf_gui_custom_container
exporting
container_name = lf_container.
create object lrf_gui_alvgrid
exporting
i_parent = lrf_gui_custom_container.
ls_lvc_s_layo-cwidth_opt = 'X'.
ls_lvc_s_layo-ctab_fname = 'COLOR'.
check sy-subrc = 0.
call method lrf_gui_alvgrid->set_table_for_first_display
exporting
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name = 'ZAM_CELL_COLOR'
* is_variant = ls_disvariant
* i_save = 'A'
* i_default = 'X'
is_layout = ls_lvc_s_layo
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
changing
it_outtab = <gt_table>
it_fieldcatalog = gt_dyn_fcat
* it_filter =
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
endform. "generate_alv
*& Module STATUS_0100 OUTPUT
* text
module status_0100 output.
set pf-status 'ZAM_CELL_STATUS'.
set titlebar 'ZAM_CELL_TIT'.
perform generate_alv.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
module user_command_0100 input.
data lf_okcode type syucomm.
call method cl_gui_cfw=>dispatch.
lf_okcode = ok_code.
case lf_okcode.
when 'EXIT'.
set screen 0.
leave screen.
when 'CANCEL'.
leave program.
when 'BACK'.
set screen 0.
leave screen..
endcase.
endmodule. " USER_COMMAND_0100 INPUT
Maybe you are looking for
-
Authorization Issue to display BI Report
Dear Expert We upgraded CRM (from 4.0 to 2007) and BI (to 7.0). I'd like to display a standard BI report from CRM WebClient. But I click on the link, I get the following error: User does not have the proper authorizations. But I have SAP_ALL in both
-
My blue tooth will not pair with windows 8.1
hp envy m6 notebook pc having problems with my bluetooth will not pair with speaker after up graded to 8.1 ,and my simplepass dosent work eather.
-
I was doing some minor editing in Logic Pro 9.1.8, like adding some plug-ins to audio and midi tracks on numerous songs. Most of the songs I had no problem bouncing. For some reason 2 of the songs I tried to bounce kept showing me this error message:
-
Error in creating delivery document from stock transport order
hi sd gurus plz help i m nt able to create delivery in vl10b from stock transport order me21n after giving shipping point and po number also. can u help me out and can u tell me how to maintain copy control from stock tarnsport to delivery docu.
-
EvermindBodyContent.setCharacter() throws exception when a tag is executed
Hello! I have a servlet working as a dispatcher for JSP-presentations. An exception is thrown by the OC4J when a JSP-tag is executed. The exception is not thrown by the tag, it's thrown by the method EvermindBodyContent.setCharacterEncoding() after t