Editable Tree ALV
Hi friends,
How can I edit ALV tree .please give me inputs
correct Inputs are rewarded
Regards
Rasheed
You can implement it as below:
FORM frm_assign_budget.
DATA: lt_selected_nodes TYPE lvc_t_nkey,
ls_selected_node LIKE LINE OF lt_selected_nodes.
DATA: ls_tree LIKE LINE OF gt_tree.
======================================================================
*先取得选中的预算行
======================================================================
CALL METHOD g_tree->get_selected_nodes
CHANGING
ct_selected_nodes = lt_selected_nodes
EXCEPTIONS
cntl_system_error = 1
dp_error = 2
failed = 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.
READ TABLE lt_selected_nodes INTO ls_selected_node INDEX 1.
IF sy-subrc NE 0.
MESSAGE 'You have not select any row'(011) TYPE 'I'.
RETURN.
ENDIF.
CALL METHOD g_tree->get_outtab_line
EXPORTING
i_node_key = ls_selected_node
IMPORTING
e_outtab_line = ls_tree
EXCEPTIONS
node_not_found = 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.
======================================================================
*检测选择的数据是否可进行预算分配
======================================================================
IF ls_tree IS INITIAL.
MESSAGE 'You have not select any row'(011) TYPE 'I'.
RETURN.
ENDIF.
IF ls_tree-asset_class EQ ''.
MESSAGE 'You have not select any row'(011) TYPE 'I'.
RETURN.
ENDIF.
IF ls_tree-aufnr NE ''.
MESSAGE 'The budget had been assigned cannot be edited'(012) TYPE 'I'.
RETURN.
ENDIF.
======================================================================
*弹出输入框让用户输入预算
======================================================================
DATA: lt_sval TYPE STANDARD TABLE OF sval INITIAL SIZE 0,
ls_sval TYPE sval,
l_returncode TYPE c,
l_budget TYPE z01fis4111-budget.
MOVE 'Z01FIS4111' TO ls_sval-tabname.
MOVE 'WAERS' TO ls_sval-fieldname.
MOVE g_waers TO ls_sval-value.
MOVE '02' TO ls_sval-field_attr.
APPEND ls_sval TO lt_sval.
CLEAR ls_sval.
MOVE 'Z01FIS4111' TO ls_sval-tabname.
MOVE 'BUDGET' TO ls_sval-fieldname.
APPEND ls_sval TO lt_sval.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
popup_title = 'Asset Budget Assignment'(008)
IMPORTING
returncode = l_returncode
TABLES
fields = lt_sval
EXCEPTIONS
error_in_fields = 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.
CHECK l_returncode EQ ''.
READ TABLE lt_sval INTO ls_sval INDEX 2.
CHECK sy-subrc EQ 0.
MOVE ls_sval-value TO l_budget.
CHECK l_budget GT 0.
CALL METHOD g_tree->change_item
EXPORTING
i_node_key = ls_selected_node
i_fieldname = 'BUDGET'
i_data = l_budget
EXCEPTIONS
node_not_found = 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.
CALL METHOD g_tree->update_calculations.
CALL METHOD g_tree->frontend_update .
ENDFORM.
Similar Messages
-
How to make field editable in ALV tree in OOPs?
Hi Gems,
Again I need help from you all.
I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
I am doing it using layout but the program is giving error during
CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
This method is returning sy-subrc = 2 and I am unable to get the output.
I am using below code to make the field editable:
DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'. "ACPCKTWRT is the field name in the Internal table
LS_LAYOUT_ITEM-EDITABLE = 'X'.
APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
CALL METHOD G_ALV_TREE->ADD_NODE
EXPORTING
I_RELAT_NODE_KEY = FP_RELAT_KEY
I_RELATIONSHIP = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
IS_OUTTAB_LINE = LS_TMP_FINFCNO "structure of the internal table
IS_NODE_LAYOUT =
IT_ITEM_LAYOUT = LT_LAYOUT_ITEM "Added layout to make the field editable
I_NODE_TEXT = LV_NODE_TEXT "Node text
IMPORTING
E_NEW_NODE_KEY = FP_NODE_KEY
EXCEPTIONS
RELAT_NODE_NOT_FOUND = 1
NODE_NOT_FOUND = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please help me and let me know how to get the solution.Hello
The ALV tree control is not intended for making values editable (e.g. see
[How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
Regards
Uwe -
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 -
ME57 - Convert Purchase Requisitions - New fields to Tree ALV in Overview?
Hello,
From ME57, one can get a list of purchase requisitions, click "Assignments," and then "Process Assignment."
What next appears is a list of requisitions in a Tree ALV grid. The title of the grid is: "Convert Purchase Requisitions."
I would like to add a new field from EBAN to this ALV grid. The field is not currently available in change layout. The structure that I think is displayed is MMPUR_S_DBL_ASSIGNEDREQS.
Is there a BADI or some other way to get additional fields on this Tree report (which, of course, is used to drag requisitions to the right side of the screen in ME21N)????????
Thank you,
-KenHello,
From ME57, one can get a list of purchase requisitions, click "Assignments," and then "Process Assignment."
What next appears is a list of requisitions in a Tree ALV grid. The title of the grid is: "Convert Purchase Requisitions."
I would like to add a new field from EBAN to this ALV grid. The field is not currently available in change layout. The structure that I think is displayed is MMPUR_S_DBL_ASSIGNEDREQS.
Is there a BADI or some other way to get additional fields on this Tree report (which, of course, is used to drag requisitions to the right side of the screen in ME21N)????????
Thank you,
-Ken -
How to do subtotal and grand total as per currency in a tree ALV
Hi Experts,
I am doing a tree ALV for SD output. I met an urgent problem that is how to do subtotal and grand total on the field (netwr) as per currency (waerk) in the tree ALV. I am using below codes to create the tree ALV.
l_tree_container_name = 'CCONTAINER1'.
CREATE OBJECT objCustomContainer
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create tree control
CREATE OBJECT objTree1
EXPORTING
parent = objCustomContainer
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = ' '
no_html_header = 'X'
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
DATA l_hierarchy_header TYPE treev_hhdr.
call method buildHierarchyHeader
IMPORTING
p_hierarchy_header = l_hierarchy_header.
Build fieldcatalog
call method buildFieldcatalog.
CALL METHOD objTree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
CHANGING
it_fieldcatalog = l_fieldcatalog
it_outtab = lt_order.
CALL METHOD objTree1->update_calculations.
CALL METHOD objTree1->frontend_update.
filling fieldcatalog,
LS_FIELDCATALOG-FIELDNAME = 'NETWR'.
LS_FIELDCATALOG-SCRTEXT_S = 'Net Value'.
LS_FIELDCATALOG-COL_POS = l_pos.
LS_FIELDCATALOG-OUTPUTLEN = 15.
LS_fieldcatalog-do_dum= 'X'.
LS_FIELDCATALOG-DATATYPE = 'CURR'.
APPEND LS_FIELDCATALOG TO l_FIELDCATALOG.
CLEAR LS_FIELDCATALOG.
l_pos = l_pos + 1.
I could see the subtotal and grandtotal in tree ALV but they are simply sumed up regardless different currency.
Thank you very much for your kindly helps.
Yuhi
good
go through this report and work accordingly.
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
thanks
mrutyun^ -
How to make a particular row and column field editable in ALV
Hi Experts,
I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
Kindly help me out to solve this.
Any help would be appreciated.
Thanks,
AshutoshHi Ashutosh,
please check below, explained by some experts.
In the below link editing two columns MOD_RANK and TECH_RANK.
These two columns will be in edit mode once after selecting the required record
Editing single cell in a row of ALV table
And also look for more info
http://scn.sap.com/thread/884976 -
Show my criteria ( selection options ) in the commentary of the tree ALV
Hello Guys ,
I want to show in the header of my tree alv the criteria that he/she choosed , right nowi´m moving to slis_listheader basic data like date, user , etc my I want to show tomy user which company code, etc . was choosen for the result is ther a easy way to achive that ? or should i read all the tables of my selection screen and built the comment by my own .
thank you guys.
thank you for your ideias guys.
Regards .Hi José,
should i read all the tables of my selection screen and built the comment by my own .
That's exactly what you should do. Perhaps you can do it even better by creating a class to retrieve the Selection Screen and its values from any running report and give it a nice printable format for the report header. This shouldn't be hard to pull.
Check Function Module DYNPRO_FIELD_GET for a start. It will retrieve the selection screen values the user has filled for a particular report at runtime.
Regards,
Andres. -
Editable WD ALV - Cell Read Only
Hi,
Is there any way for making an individual cell read only for a column-row combination.
My scenario is :
I have an editable WD ALV with data. Now , in row(e.g Index 4) entry of the table, I want to make column2 and Column3 read only for that particular entry(row no.- Index) !! Please guide me through if there is any way to do the same.
Best Regards
SidYou will have to create an extra attribute for each of your column, of type boolean under the same node. Now bind these attributes to the read only property of your column's cell editors.
Then pass abap_true/abap_false to make the field editable/reaonly.
Check this wiki for your reference,
check this Wiki [https://wiki.sdn.sap.com/wiki/display/WDABAP/How%20to%20edit%20conditionally%20row%20of%20a%20ALV%20table%20in%20Web%20Dynpro%20for%20ABAP]
Regards,
Radhika. -
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 make field is editable in ALV CL_SALV_TABLE only)
Hi,
How to make field is editable in ALV CL_SALV_TABLE only)
Any one has tried to make field si editable by using CL_SALV_TABLE class.
*I know how to do it in REUSEALV function module and CL_GUI_ALV class.*_
Please reply only if you riedin CL_SALV_TABLE class method.
Regards
Rajesh V
Moderator message: not supported, please read class documentation and search for previous discussions.
Edited by: Thomas Zloch on Mar 17, 2011 2:07 PMHi Chad,
Please refer the link,
Edit field in alv
Regards,
Hema.
Reward points if it is useful. -
How to make fields/columns un-editable in ALV
Hi,
How can I make a field/column un-editable in ALV.
I tried writing: ls_fc_po-edit = ' '. (inside loop for the selected column/field), but it doesnot work for me.
Any suggestions please.
Thanks,
RavishThe code for the field catalogue is below:
LOOP AT lt_fc_po INTO ls_fc_po.
IF ls_fc_po-fieldname EQ 'PO_ID'.
ls_fc_po-no_out = 'X'.
ELSEIF ls_fc_po-fieldname EQ 'UNIT_OF_MEASURE'.
ls_fc_po-outputlen = '10'.
ls_fc_po-tooltip = 'Unit of Measure'.
ELSEIF ls_fc_po-fieldname EQ 'ITEM_ID'.
ls_fc_po-outputlen = '10'.
ls_fc_po-tooltip = 'Purchase Order Items'.
ELSEIF ls_fc_po-fieldname EQ 'QUANTITY'.
ls_fc_po-outputlen = '10'.
ELSEIF ls_fc_po-fieldname EQ 'CURRENCY'.
ls_fc_po-edit = ' '.
ls_fc_po-outputlen = '10'.
ls_fc_po-tooltip = 'Currency'.
ELSEIF ls_fc_po-fieldname EQ 'DATE_OF_DELIVERY'.
ls_fc_po-outputlen = '18'.
ls_fc_po-coltext = 'Delivery Date'.
ls_fc_po-tooltip = 'Requested Delivery date'.
ELSEIF ls_fc_po-fieldname EQ 'PLANT_ID'.
ls_fc_po-outputlen = '15'.
ls_fc_po-coltext = 'Plant'.
ls_fc_po-tooltip = 'Plant Identifier'.
ELSEIF ls_fc_po-fieldname EQ 'MATERIAL_DESC'.
ls_fc_po-outputlen = '18'.
ELSEIF ls_fc_po-fieldname EQ 'MATERIAL_ID'.
ls_fc_po-outputlen = '15'.
ls_fc_po-coltext = 'Material'.
ls_fc_po-tooltip = 'Material Identifier'.
IF GL_PO_EVENT_ALV = 0.
GL_PO_EVENT_ALV = 1.
data: l_field type lvc_fname.
data: lt_f4 type lvc_t_f4.
data: ls_f4 type lvc_s_f4.
l_field = ls_fc_po-fieldname.
ls_f4-fieldname = l_field.
ls_f4-register = 'X'.
ls_f4-getbefore = 'X'.
ls_f4-chngeafter = 'X'.
append ls_f4 to lt_f4.
CALL METHOD po_itm_trn_alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4.
ENDIF.
ENDIF.
MODIFY lt_fc_po FROM ls_fc_po.
ENDLOOP. -
Hi,
I have a docking container in which I need to add a button along with the other buttons in the Tree ALV.
When the button is created I need to give the button name Dynamically according to particular data.
Can someone tell how we can do that?
What class,methods and the events that can be used for this purpose?
How are events handled in OOABAP?
Can someone send some documents on OOABAP?
Thanks,
Supriya Manik.hi,
May be this piece of code may help u to add a button in alv tree........
Add_Button
data: lr_functions type ref to cl_salv_functions_tree.
lr_functions = mr_tree->get_functions( ).
lr_functions->add_function(
name = '&OPEN_ALL'
icon = l_icon
text = l_text1
tooltip = l_text1
position = if_salv_c_function_position=>right_of_salv_functions ).
<b>here r all the links for OO abap...</b>
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
I am having a good document on OO abap whcih is containing good information regarding the events handling but how can i send it to you....? -
Hi,
I have created a ALV tree using CL_GUI_ALV_TREE. Here how can i make a single column as editable field
Pls help
ThanskTher are many fields in teh ALV tree. Just part of the code in the fieldcatalog , I'm putting here:
clear ls_fcat.
ls_fcat-fieldname = 'ZCDAT'.
ls_fcat-coltext = 'Min Due Date'.
ls_fcat-seltext = 'Min Due Date'.
optional: set column width
ls_fcat-outputlen = 10.
append ls_fcat to gt_fieldcatalog.
clear ls_fcat.
ls_fcat-fieldname = 'ZFCDAT'.
ls_fcat-coltext = 'Forc.Min Due Date'.
ls_fcat-seltext = 'Forc.Min Due Date'.
optional: set column width
ls_fcat-outputlen = 10.
ls_fcat-edit = 'X'.
append ls_fcat to gt_fieldcatalog. -
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.
Maybe you are looking for
-
Most mpd.class.php's are old and produce a lot of errors which caused me much frustration in this thread. I was wrapping my head around why phpmpreloaded worked and the others never and it's because it uses an updated mpd.class.php. To save others th
-
Problems when attaching a photo from Iphoto 6 to my .mac mail
When I click on attach I don't get to the Iphoto library but either to a certain photo or just somewhere on the computer and I have to find a way to get to the library and to originals or modified. It never used to be this way! Also when I click atta
-
Possible to change vendor in invoice level
Is it possible to change vendor in invoice level if yes how
-
Dot1x, .1X and Cisco IP Phones
Hi, We are busy performing dot1x tests on IP Phones. We chose the LSC approach and have generated CAPF CSRs which we have signed by our PKI infrastructure. Once all certificates and trust have been uploaded and when we update the CUCM CTL with the Ci
-
404 Forbidden erros with Safari only!
I've been having very strange problems with Safari when attempting to access two of my domains (both Wordpress sites hosted by Hostgator). With one domain, I can log in to the Wordpress admin panel but problems happen once I do. For example, I just