Add new line in ALV report and Refresh button
How to add a new line in a ALV report?
How to add a refresh button in a report?
Hi,
First of all u have to Create ur own PF-status and Assign Fcode e.g 'INSERTROW'.
So, whenevr you will click Insertrow button it will be triggered in your User Command and then just Append the blank line in your Final Internal Table.
And Refresh Icon will be there by default...
To Trigger it You have to write rs_selfield-refresh = 'X'
You can also follow the below link...
Try it.
Link:[http://wiki.sdn.sap.com/wiki/display/ABAP/ALVeasytutorial].
Regards
Arbind
Similar Messages
-
Add new line in ALV report on click of button...
Dear All,
How to add a new line for input in ALV report at runtime, on click of a button.
Waiting for early and favorable reply.
Regards,
Dharmesh VyasHi,
First of all u have to Create ur own PF-status and Assign Fcode e.g 'INSERTROW'.
So, whenevr you will click Insertrow button it will be triggered in your User Command and then just Append the blank line in your Final Internal Table.
And Refresh Icon will be there by default...
To Trigger it You have to write rs_selfield-refresh = 'X'
You can also follow the below link...
Try it.
Link:[http://wiki.sdn.sap.com/wiki/display/ABAP/ALVeasytutorial].
Regards
Arbind -
Add New Column in ALV Report of Standard SAP ME28.
Hi anybody,
I want add new column in alv report of standard SAP Program ME28 Screen.
Add Last PO Price column inside ALV Report ME28 Screen.
Can u please anybody tell me how to add new column in ME28 Screen.
Thanks
S.Muthu.Try to find any BADI for the same
Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
1) Goto se24 (Display class cl_exithandler)
2) Double click on the method GET_INSTANCE.
3) Put a break point at Line no.25 (CASE sy-subrc).
Now
4) Execute SAP standard transaction
5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
7) This way you will find all the BADIs called on click of any button in any transaction.
OR
Also one more option is to copy ME28 and, make modifications to the copied program. -
Hello ;
My Program is type of report, not a moduler program.
And Im using the alv grid , But there isnt refresh button ,I couldnt see it.
How can I see refresh button?
Thanks.Hai
Check the following Code
REPORT z_alv_grid_ctrl_refresh_2.
ALV Grid Control *
This report reads and displays data from table MARA, using *
the Method set_table_for_first_display of CL_GUI_ALV_GRID *
Button 'NEXT_PAGE' : displays the next N records *
Button 'PREV_PAGE' : displays the previous N records *
Button 'FIRST_PAGE' : displays the first page *
Button 'LAST_PAGE' : displays the last page *
When the buttons Sort up, sort down, Filter, Delete Filter are *
pressed, N record are still displayed *
Steps : *
- Create the report Z_ALV_GRID_CTRL_REFRESH_2 *
- Create the Dynpro 0100 (size 27x120) *
- Add OKCODE (type OK) in the element list *
- Modify the flow logic of dynpro 0100 : *
* PROCESS BEFORE OUTPUT. *
MODULE pbo_0100. *
* PROCESS AFTER INPUT. *
MODULE user_command_0100. *
- Create a status named 'MAIN' *
with the buttons : REFRESH BACK EXIT *
and the buttons : FIRST_PAGE PREV_PAGE NEXT_PAGE LAST_PAGE *
Author : Michel PIOUD *
Email : [email protected] HomePage : http://www.geocities.com/mpioud *
CONSTANTS:
c_first_page TYPE syucomm VALUE 'FIRST_PAGE',
c_next_page TYPE syucomm VALUE 'NEXT_PAGE',
c_prev_page TYPE syucomm VALUE 'PREV_PAGE',
c_last_page TYPE syucomm VALUE 'LAST_PAGE'.
TYPES:
BEGIN OF ty_s_mara,
ernam LIKE mara-ernam,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
brgew LIKE mara-brgew,
END OF ty_s_mara.
CLASS lcl_event_alv DEFINITION DEFERRED.
DATA:
gt_mara TYPE STANDARD TABLE OF ty_s_mara,
go_container TYPE REF TO cl_gui_docking_container,
go_alv_grid TYPE REF TO cl_gui_alv_grid,
go_events TYPE REF TO lcl_event_alv,
gt_mara_ftr TYPE STANDARD TABLE OF ty_s_mara, " Data filtered
gt_mara_all TYPE STANDARD TABLE OF ty_s_mara, " Data readfrom DB
okcode TYPE syucomm,
gv_okcode TYPE syucomm.
CLASS lcl_event_alv DEFINITION
CLASS lcl_event_alv DEFINITION.
PUBLIC SECTION.
METHODS:
h_user_command FOR EVENT after_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm
sender.
ENDCLASS. " LCL_EVENT_ALV DEFINITION
Class (Implementation) lcl_event_alv
CLASS lcl_event_alv IMPLEMENTATION.
METHOD h_user_command.
CASE e_ucomm.
WHEN '&SORT_ASC' OR '&SORT_DSC'. " Sort
PERFORM f_sort_big_table.
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
WHEN '&FILTER'. " Filter
PERFORM f_filter_data.
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
WHEN '&DELETE_FILTER'. " Delete filter
gt_mara_ftr[] = gt_mara_all[].
PERFORM f_read_data USING c_first_page.
PERFORM f_refresh_table.
ENDCASE.
ENDMETHOD. " user_command
ENDCLASS. " LCL_EVENT_ALV
SELECTION-SCREEN :
BEGIN OF LINE,COMMENT 10(20) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Lines per page'.
START-OF-SELECTION.
SELECT matnr ernam ersda brgew
INTO TABLE gt_mara_all
FROM mara.
gt_mara_ftr[] = gt_mara_all[].
PERFORM f_read_data USING c_first_page.
CALL SCREEN 100.
Module pbo_0100 OUTPUT
MODULE pbo_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
PERFORM create_and_init_alv.
ENDMODULE. " PBO_0100 OUTPUT
Module user_command_0100 INPUT
MODULE user_command_0100 INPUT.
gv_okcode = okcode.
CLEAR okcode.
CASE gv_okcode.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN c_first_page OR c_next_page OR c_last_page OR c_prev_page.
PERFORM f_read_data USING gv_okcode. " Update gt_mara
PERFORM f_refresh_table.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Form f_read_data
FORM f_read_data USING u_ucomm TYPE syucomm.
STATICS :
l_1 TYPE sytabix,
l_2 TYPE sytabix.
DATA l_max TYPE sytabix. " Internal table size
DESCRIBE TABLE gt_mara_ftr LINES l_max.
CASE u_ucomm.
WHEN c_first_page. " 1st page
l_1 = 1.
WHEN c_prev_page. " Previous page
SUBTRACT p_max FROM l_1.
IF l_1 < 1.
l_1 = 1.
ENDIF.
WHEN c_next_page. " Next page
IF l_1 IS INITIAL.
l_1 = 1.
ELSE.
ADD p_max TO l_1.
ENDIF.
IF l_1 > l_max.
l_1 = l_max.
ENDIF.
WHEN c_last_page. " Last page
l_1 = l_max - p_max + 1.
IF l_1 < 1.
l_1 = 1.
ENDIF.
ENDCASE.
l_2 = l_1 + p_max - 1.
IF l_2 > l_max.
l_2 = l_max.
ENDIF.
REFRESH gt_mara.
IF l_max > 0.
APPEND LINES OF gt_mara_ftr FROM l_1
TO l_2
TO gt_mara.
ENDIF.
ENDFORM. " F_READ_DATA
Form create_and_init_alv
FORM create_and_init_alv.
Macro definition
DEFINE m_fieldcat.
add 1 to ls_alv_cat-col_pos.
ls_alv_cat-fieldname = &1.
ls_alv_cat-ref_table = 'MARA'.
append ls_alv_cat to lt_alv_cat.
END-OF-DEFINITION.
DATA:
ls_variant TYPE disvariant,
lt_alv_cat TYPE lvc_t_fcat,
ls_alv_cat TYPE lvc_s_fcat,
ls_alv_lay TYPE lvc_s_layo,
l_offline TYPE char1.
CHECK go_container IS INITIAL.
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = l_offline.
IF l_offline EQ 0.
CREATE OBJECT go_container
EXPORTING
extension = 2000
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE e208(00) WITH 'The control could not be created'.
ENDIF.
ENDIF.
Create an instance of alv control
CREATE OBJECT go_alv_grid
EXPORTING i_parent = go_container.
CREATE OBJECT go_events.
SET HANDLER go_events->h_user_command FOR go_alv_grid.
Build field catalog
m_fieldcat 'ERNAM'.
m_fieldcat 'MATNR'.
m_fieldcat 'ERSDA'.
m_fieldcat 'BRGEW'.
Layout
CLEAR ls_alv_lay.
ls_alv_lay-zebra = 'X'.
ls_alv_lay-cwidth_opt = 'X'.
ls_variant-report = sy-cprog.
Display
CALL METHOD go_alv_grid->set_table_for_first_display
EXPORTING
is_variant = ls_variant
is_layout = ls_alv_lay
i_save = 'A'
CHANGING
it_outtab = gt_mara
it_fieldcatalog = lt_alv_cat.
ENDFORM. " CREATE_AND_INIT_ALV
Form F_REFRESH_TABLE
FORM f_refresh_table.
DATA: ls_layout TYPE lvc_s_layo.
CALL METHOD go_alv_grid->get_frontend_layout
IMPORTING es_layout = ls_layout.
ls_layout-cwidth_opt = 'X'.
CALL METHOD go_alv_grid->set_frontend_layout
EXPORTING is_layout = ls_layout.
CALL METHOD go_alv_grid->refresh_table_display.
ENDFORM. " F_REFRESH_TABLE
Form F_SORT_BIG_TABLE
FORM f_sort_big_table.
DATA:
lt_sort_kkblo TYPE kkblo_t_sortinfo,
lt_sort TYPE lvc_t_sort.
CALL METHOD go_alv_grid->get_sort_criteria
IMPORTING et_sort = lt_sort.
CHECK NOT lt_sort[] IS INITIAL.
Format LVC --> KKBLO
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_sort_lvc = lt_sort
IMPORTING
et_sort_kkblo = lt_sort_kkblo.
The big tables must be sorted like the small one
PERFORM fb_outtab_sort(saplkkbl) TABLES gt_mara_ftr
lt_sort_kkblo
USING 'X'
'X'.
PERFORM fb_outtab_sort(saplkkbl) TABLES gt_mara_all
lt_sort_kkblo
USING 'X'
'X'.
ENDFORM. " F_SORT_BIG_TABLE
Form f_filter_data
FORM f_filter_data.
DATA:
lt_filter_lvc TYPE lvc_t_filt,
lt_filter_index TYPE lvc_t_fidx WITH HEADER LINE.
CALL METHOD go_alv_grid->get_filter_criteria
IMPORTING et_filter = lt_filter_lvc.
Find data to filter
CALL FUNCTION 'LVC_FILTER_APPLY'
EXPORTING
it_filter = lt_filter_lvc
IMPORTING
et_filter_index = lt_filter_index[]
TABLES
it_data = gt_mara_all.
gt_mara_ftr[] = gt_mara_all[].
SORT lt_filter_index DESCENDING.
LOOP AT lt_filter_index.
DELETE gt_mara_ftr INDEX lt_filter_index.
ENDLOOP.
ENDFORM. " F_FILTER_DATA
END OF PROGRAM Z_ALV_GRID_CTRL_REFRESH_2 ********************
Thanks & regards
Sreenivasulu P -
BAPI_SALESORDER_CHANGE add new line and conditions with a condition value
Hi,
I am using BAPI_SALESORDER_CHANGE to add new lines to a credit memo. All works fine except that I can not seem to put a condition value on the new lines. The condition is created but with a value of 0. I can popluate the condition amount field, KBETR but not KWERT. BAPICONDX seems to only have the COND_VALUE field in it and not CONDVALUE as in BAPICOND. Does anyone have any idea how to do this? In the code below I just want to change the material on the first line of the credit memo and not add the condition. Then add new lines with the the condition.
lw_order_header_inx-updateflag = 'U'.
LOOP AT i_accru INTO wa_accru.
lv_count = lv_count + 1.
lv_posnr = lv_count * 10.
* Order Items
lw_order_item_inx-itm_number = lv_posnr.
lw_order_item_inx-material = 'X'.
IF lv_count = 1.
lw_order_item_inx-updateflag = 'U'.
ELSE.
lw_order_item_inx-updateflag = 'I'.
ENDIF.
APPEND lw_order_item_inx TO lt_order_item_inx.
lw_order_item_in-itm_number = lv_posnr.
lw_order_item_in-material = wa_accru-vakey.
APPEND lw_order_item_in TO lt_order_item_in.
* Conditions
IF lv_count <> 1.
lw_conditions_inx-itm_number = lv_posnr.
lw_conditions_inx-cond_st_no = '905'.
lw_conditions_inx-cond_count = '01'.
lw_conditions_inx-cond_type = 'ZHIE'.
lw_conditions_inx-currency = 'X'.
lw_conditions_inx-updateflag = 'I'.
APPEND lw_conditions_inx TO lt_conditions_inx.
lw_conditions_in-itm_number = lv_posnr.
lw_conditions_in-cond_st_no = '905' .
lw_conditions_in-cond_count = '01'.
lw_conditions_in-cond_type = 'ZHIE'.
lw_conditions_in-condvalue = wa_accru-accru.
lw_conditions_in-currency = 'GBP'.
APPEND lw_conditions_in TO lt_conditions_in.
ENDIF.
ENDLOOP.
* Change the credit memo
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln
order_header_in = lw_order_header_in
order_header_inx = lw_order_header_inx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
* LOGIC_SWITCH =
* NO_STATUS_BUF_INIT = ' '
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* SCHEDULE_LINES =
* SCHEDULE_LINESX =
* ORDER_TEXT =
* ORDER_KEYS =
conditions_in = lt_conditions_in
conditions_inx = lt_conditions_inx
* EXTENSIONIN =
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
ENDIF.Hi Rob,
Have you managed to solve this issue. If so, could you please share the solution.
I am also facing similar problem.
Thanks for your help.
Anoop -
Hi Experts,
When clicking the button 'append row', I want to add a line filled with some values in selection screen.
I work with OO.
need help please.
MohamedHello Mohamed
The logic is the same as before. Search for $MODFIED to detect the changes in the sample report.
However, I do not think that these requirements make any sense because if you re-implement the Copy function you obviously have to re-implement the Paste function (and perhaps Undo function as well), too.
So basically you reinvent the wheel again.
*& Report ZUS_SDN_ALV_GRID_EDITABLE
*& Thread: ADD A line in alv with values
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="974654"></a>
REPORT zus_sdn_alv_grid_editable_1x.
TYPE-POOLS: abap.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
gif_adapter TYPE REF TO if_salv_adapter,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.
DATA:
gt_outtab TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_function TYPE ui_func READ-ONLY,
ms_row TYPE lvc_s_row READ-ONLY,
ms_outtab LIKE LINE OF gt_outtab. "$MODIFIED
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender,
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
sender,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender,
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
e_ucomm
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
ENDMETHOD. "handle_double_click
METHOD handle_toolbar.
" define local data
DATA: ls_button TYPE stb_button.
" Redefine toolbar button functions in order to be able to
" handle them in event USER_COMMAND (standard toolbar functions
" do NOT raise event USER_COMMAND !!!)
LOOP AT e_object->mt_toolbar INTO ls_button.
CASE ls_button-function.
WHEN cl_gui_alv_grid=>mc_fc_loc_append_row.
ls_button-function = 'APPEND_ROW'.
WHEN cl_gui_alv_grid=>mc_fc_loc_insert_row.
ls_button-function = 'INSERT_ROW'.
WHEN cl_gui_alv_grid=>mc_fc_loc_copy. "$MODIFIED
ls_button-function = 'COPY'.
WHEN OTHERS.
CONTINUE.
ENDCASE.
MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
ENDLOOP.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
" Get current row for function 'Insert Row'
CALL METHOD sender->get_current_cell
IMPORTING
* e_row =
* e_value =
* e_col =
es_row_id = ms_row
* es_col_id =
* es_row_no =
" Store redefined function code
md_function = e_ucomm.
CASE e_ucomm.
WHEN 'APPEND_ROW' OR
'INSERT_ROW'.
" Just trigger PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'NEW_ROW'
* IMPORTING
* rc =
WHEN 'COPY'. "$MODIFIED
READ TABLE gt_outtab INTO ms_outtab INDEX ms_row-index.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_user_command
METHOD handle_data_changed.
* define local data
DATA: ls_outtab LIKE LINE OF gt_outtab,
ls_good TYPE lvc_s_modi.
BREAK-POINT.
LOOP AT er_data_changed->mt_good_cells INTO ls_good
WHERE ( fieldname = 'ERDAT' ).
** CALL METHOD er_data_changed->get_cell_value
** EXPORTING
** i_row_id = ls_good-row_id
** i_fieldname = ls_good-fieldname
** IMPORTING
** e_value = ls_outtab-erdat.
ls_outtab-erdat = ls_good-value.
IF ( ls_outtab-erdat < '20070101' ).
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = '00'
i_msgty = 'E'
i_msgno = '398'
i_msgv1 = 'Date must be >= 01.01.2007'
* i_msgv2 =
* i_msgv3 =
* i_msgv4 =
i_fieldname = ls_good-fieldname
i_row_id = ls_good-row_id
i_tabix = ls_good-tabix.
ENDIF.
ENDLOOP.
er_data_changed->display_protocol( ).
" Not really required (only for validations)
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_outtab UP TO 10 ROWS.
PERFORM init_controls.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'NEW_ROW'.
PERFORM add_new_row.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ADD_NEW_ROW
* text
* --> p1 text
* <-- p2 text
FORM add_new_row .
* define local data
DATA: ls_outtab LIKE LINE OF gt_outtab,
ls_stable TYPE lvc_s_stbl,
ld_idx TYPE i.
ls_outtab-bukrs = '1000'.
ls_outtab-ernam = syst-uname.
CASE lcl_eventhandler=>md_function.
WHEN 'APPEND_ROW'.
APPEND ls_outtab TO gt_outtab.
WHEN 'INSERT_ROW'.
ld_idx = lcl_eventhandler=>ms_row-index + 1.
INSERT ls_outtab INTO gt_outtab INDEX ld_idx.
WHEN OTHERS.
ENDCASE.
" Refresh ALV list display
ls_stable-row = abap_true.
ls_stable-col = abap_true.
CALL METHOD go_grid1->refresh_table_display
EXPORTING
is_stable = ls_stable
* i_soft_refresh =
EXCEPTIONS
finished = 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. " ADD_NEW_ROW
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking " go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
" ENTER trigger event DATA_CHANGED
CALL METHOD go_grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
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.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1,
lcl_eventhandler=>handle_toolbar FOR go_grid1,
lcl_eventhandler=>handle_user_command FOR go_grid1,
lcl_eventhandler=>handle_data_changed FOR go_grid1.
PERFORM build_fieldcatalog.
* Display data
gs_layout-grid_title = 'Customers'.
gs_layout-smalltitle = abap_true.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
** i_structure_name = 'KNB1'
is_layout = gs_layout
ir_salv_adapter = gif_adapter
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA: ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'KNB1'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ls_fcat-edit = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING edit
WHERE ( key NE abap_true ).
ENDFORM. " BUILD_FIELDCATALOG
Regards
Uwe -
How to add new line item to SO using BAPI_SALESORDER_CREATEFROMDAT2
Hi,
I have sales order A with 1 line item, now i want to add new line item with material x and quantity y to the existing sales order A
using BAPI_SALESORDER_CREATEFROMDAT2.
Line item no for new line item should be generated by SAP internally.Please let me know the mandatory parameters to be passed to the BAPI to fulfill the requirement.
DATA: order_header TYPE bapisdhd1,
order_inx TYPE bapisdhd1x,
partners TYPE TABLE OF bapiparnr,
wa_partners TYPE bapiparnr.
CLEAR: salesdocument,order_header_inx,wa_in, wa_inx.
REFRESH: item_in, item_inx.
salesdocument = wa_vbup-vbeln.
order_header_inx-updateflag = 'X'.
wa_in-itm_number = ' '.
wa_in-material = p_nmatnr.
wa_in-target_qty = gv_menge - gv_wemng.
APPEND wa_in TO item_in.
wa_inx-itm_number = ' '.
wa_inx-updateflag = 'U'.
wa_inx-target_qty = 'X'.
APPEND wa_inx TO item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
salesdocumentin = salesdocument
order_header_in = order_header
order_header_inx = order_inx
IMPORTING
salesdocument = salesdocument
TABLES
return = return
order_items_in = item_in
order_items_inx = item_inx
order_partners = partners.
Thanks
BhuvanaHello,
You can use FM: BAPI_SALESORDER_CHANGE with update indicator I (insert)
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = l_vbeln
order_header_inx = l_wa_order_header_inx
simulation = l_simulation
tables
return = l_i_return
order_item_in = l_i_order_item
order_item_inx = l_i_order_item_inx
partners = l_i_partners
schedule_lines = l_i_schedule_lines
schedule_linesx = l_i_schedule_linesx
extensionin = l_i_extensionin.
Thanks
Subhankar -
Unwanted field validation when adding new line to ALV (ABAP OO)
Hi,
We are using OO Controls to create an editable ALV grid, whose structure contains debit/credit indicator.
When we click on the standard add new line button, a new line is added but an error message appears telling the user to enter a valid credit/ debit indicator (of course it is blank in the new line).
This is annoying for users - is there any way to suppress this when....but just when a new line is being created?
Thanks,
TristanDebug and find out what is the sy-ucomm when you add a new line in the ALV. And then In the validation of "enter a valid credit/ debit indicator " put a IF condition to check the if the SY-ucomm is not for inseting new line.
Hope this helps.
Fran -
Please help to add new line at Header layout FBL3N
Dear Expert,
I need a requirement to custom the program from tcode FBL3N. So i copied the program become my custom program.
At the custom program, I need to add a new line for display total balance GL account for the previous month at header layout, under text company code.
For the Information, FBL3N used ALV List to display layout.
Is it possible to add new line??
If it's possible, how is the way to add that new line to display the total GL account?
I really appreciate your suggestion and solution.
Thank you,Thanks for all your help. My problem was that I was using 2 lists to update the table. The problem solve!!!!
int modelIndex = listWhenScrollStop.size () - 1 - aRow;
if (modelIndex >= 0) {
return listWhenScrollStop.get (listWhenScrollStop.size () - 1 - aRow); -
How to add new line in transact move order line
Hi,
i am able to update locaotr in Transact move order.
But i want to add two locators for the same line.
I tried to insert one more record in data base, but getting error unique index error.
so how can we add new line in transact move order line .
please help to slove this isse.
Thanks In Advance
Venu.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
How to add new line in message on my S890
My stock keyboard in Lenovo S890 doesn't have enter key, is this normal ? How to add new line ?
However this happened only in messages, while using whatsapp the enter key present.Hi,
the fact that your question is posted in Order Management section, does the move order automatically generated by OM?
nevertheless, i don't think you should (or allowed, in this case) to add a new line in transact move order. Transact move order only queries (not create records) the move order lines eligible to allocate and transact.
So, I don't see why you need to add a new line in transact move order.
You can, however, add a new line in the allocation of the lines, where for instance, you need to have half of the line allocated to one locator, and the other half to another locator
Thanks -
Add new line item in VA02 by copying same Order line details
Hi All,
I've a requirement where i need to add new line items in the Sales Order (T Code VA02) with reference to the same Order lines . For e.g an Order 80000100 which has 2 line items and the requirement is to create a new line i.e. line item 0030 by copying the details from the existing line item 0010 of the same order .
I've checked the BAPI - BAPI_SALESDOCUMENT_COPY which is for Order Creation T Code VA01 . I'm looking out for Sales Order Change BAPI where i can give the reference as Order no and Order line item which will create a new line item in the same Order with the same details of the reference Order line item .
Do let me know your thoughts !!!!
Thanks,
BintuHi -
Please check these two FM's BAPI_SALESORDER_GETDETAILBOS & BAPI_SALESORDER_CHANGE.
Regards,
Atul Mohanty -
Add new line in the Flat file based on the field value
Hi,
Following is my Flat File -
Customer X Y
1001 1 2
1002 0 1
Based on the X and Y value I need to add new lines in the Flat file. If X>0 then add a new line with repeating row and Y>0 add again a new line with repeating row. If X or Y=0 then no need to add any repeating new line.
So, here for the above example I need output as-
Customer X Y
1001 1 2
1001 1 2
1001 1 2
1002 0 1
1002 0 1
Suggest how we can achieve this?
Regards,
Tridib KonwarHi Tridib,
I tried your scenario and You will have to use the custom xslt to get the expected result.
Please find bellow the xslt code which you can use in your map.
<?xml version="1.0" encoding="utf-16" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://PracticeAtul.XYFlatFileSchema">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/ns0:XYComp" />
</xsl:template>
<xsl:template match="/ns0:XYComp">
<ns0:XYComp>
<XYComp_Child1>
<XYComp_Child1_Child1>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child1/text()" />
</XYComp_Child1_Child1>
<XYComp_Child1_Child2>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child2/text()" />
</XYComp_Child1_Child2>
<XYComp_Child1_Child3>
<xsl:value-of select="XYComp_Child1/XYComp_Child1_Child3/text()" />
</XYComp_Child1_Child3>
<xsl:value-of select="XYComp_Child1/text()" />
</XYComp_Child1>
<xsl:for-each select="XYComp_Child2">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
<xsl:if test="XYComp_Child2_Child2/text()!=0">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
</xsl:if>
<xsl:if test="XYComp_Child2_Child3/text()!=0">
<XYComp_Child2>
<XYComp_Child2_Child1>
<xsl:value-of select="XYComp_Child2_Child1/text()" />
</XYComp_Child2_Child1>
<XYComp_Child2_Child2>
<xsl:value-of select="XYComp_Child2_Child2/text()" />
</XYComp_Child2_Child2>
<XYComp_Child2_Child3>
<xsl:value-of select="XYComp_Child2_Child3/text()" />
</XYComp_Child2_Child3>
</XYComp_Child2>
</xsl:if>
</xsl:for-each>
</ns0:XYComp>
</xsl:template>
</xsl:stylesheet>
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.
Atul Toke -
Reg:HOw to add new charactersitics in standard report
hi all
HOw to add new charactersitics in standard report
regards
JK RaoYou need to copy the std report and make necessary changes in the copied report. SAP does not allow changes to std report. The technical details of the report can be seen by selecting from the menu Extras - technical information. Select the library and Report name. Copy the same using t code GRR1. Carry out necessary changes and SAVE. Before execution, you will have to specify the report group in which report needs to be attached. You can choose and existing group or specify a new one.
Regards
Rakesh Pawaskar -
How to call ALV Report and SMARTFORMS through Pushbutton
hi,
i have created a report.My task is to create two buttons:
1)ALV Report.
2)SMARTFROMS.
Through these button i have to call ALV Report and SMARTFORMS. i have created both button and when i execute the program,
it shows me the button but not working when i click on it.
this is the coding i have used in my report for calling ALV Report.
''Tables sscrfields,
DATA flag(1) Type c.
selection-screen: begin of screen 500 AS WINDOW TITLE tit,
BEGIN OF LINE,
PUSHBUTTON 2(18) but1 USER-COMMAND cli1,
end of line,
BEGIN OF LINE,
PUSHBUTTON 2(18) but2 USER-COMMAND cli2,
end of line,
end of screen 500.
SET PF-STATUS 'STATUS_0100'.
at selection-screen.
case sscrfields.
WHEN 'cli1'.
flag = '1'.
WHEN 'cli2'.
flag = '2'.
endcase.
at USER-COMMAND.
CASE SY-UCOMM.
WHEN 'Detail'.
select vbakkunnr VBakernam VBAkaudat vbakaufnr vbapKWMENG vbapmatnr vbap~ARKTX
into but1
from vbak inner join vbap
on vbakvbeln = vbapvbeln.
ENDSELECT.
ENDCASE.
START-OF-SELECTION.
tit = 'Format'.
but1 = 'ALV Report'.
but2 = 'SMARTFORMS'.
CALL SELECTION-SCREEN 500.
and i also use in my report
''case sscrfields-ucomm'' and ''submit my_report'' but the still button doesn't show the result.
Thanks & Regards,Hi,
I understood your requirement. What i found is, you are creating screen 500 and call it after START-OF-SELECTION,
at that time your AT USER-COMMAND doesn't work.
So what i would suggest , u should create GUI STATUS named ' PFSTAT'
having one functional key 'EXIT' that is standard u can just name it
and
other two u can assign in Freely assigned Function keys as 'BUT1' & 'BUT2'. and than in Application Toolbar u jst have it in ITEM LIST by typing BUT1 and BUT2.
For 'BUT1' text would be 'ALV' and 'BUT2' text would be 'SMARTFORMS'.
Now in Program you can code,,,
START-OF-SELECTION.
SET PF-STATUS 'PFSTAT'.
WRITE:/ 'TEST'.
at user-command.
case SY-UCOMM.
WHEN 'BUT1'.
WHEN 'BUT2'.
WHEN 'EXIT'.
LEAVE PROGRAM.
endcase.
In Program u set PF STATUS and use at user-command event, whcih gets triggered when u click on button . When u execute program you get two button in application tooldbar.
Please do needful.
Thanks,
Saurin SHah
Maybe you are looking for
-
How can I move a Pages file from a folder to another one?
I Have done the upgrade to mac os Yosemite but now i'm Not able to move a file from a folder to another one Inside iCloud now it's impossible to organize MY archive
-
Why can't I boot from the OS X DVD on my Intel iMac?
I'm trying to boot from the Mac OS X Tiger CPU Drop in DVD that came from the Apple Refurb Store with my Intel iMac. I have tried holding down the C key on start up and it doesn't work. It boots like normal to the hard drive I have tried using the St
-
Copy text from sharepoint site
Hi Is there any way to copy text on a sharepoint site like the health analyser overview to a text file or to a powershell variable? So just basically the text you see on the site. I want to use the copied (text) content afterwards. brgs Bjorn
-
Hello, I'm writing to ask for a question regarding Active Directory Topology Configuration. I have Site A, Site B and Site C: Site A is directly connected to Site B; Site B is directly connected to Site C; Site A can reach Site C passing through Site
-
Events show up twice on my calendar, why?
events show up twice on my calendar, why?