on 09-27-2012 11:15 AM
Hello Experts,
Here I am facing problem in simple ALV grid. First time I am experiencing this kind of problem in ALV grid output out of my 5 years in Exp in ABAP. I have created normal ALV report using Fieldcatalog and REUSE_ALV_GRID_DISPLAY FM. I am getting the output in ALV List instead of Grid for multiple records. If I have single reord in output then it is ALV Grid. Not able to understand why its displaying ALV list instead of ALV Grid. here is my code..Please help me to solve this.
FORM display_alv .
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM execute_alv.
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM build_fieldcatalog .
DATA: lv_count TYPE i.
lv_count = lv_count + 1.
gs_fieldcat-fieldname = 'VBELN'.
gs_fieldcat-tabname = 'GT_OUTPUT'.
gs_fieldcat-seltext_l = text-002.
gs_fieldcat-hotspot = 'X'.
gs_fieldcat-col_pos = lv_count.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
lv_count = lv_count + 1.
gs_fieldcat-fieldname = 'PLNUM'.
gs_fieldcat-tabname = 'GT_OUTPUT'.
gs_fieldcat-seltext_l = text-003.
gs_fieldcat-col_pos = lv_count.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
lv_count = lv_count + 1.
gs_fieldcat-fieldname = 'AUFNR'.
gs_fieldcat-tabname = 'GT_OUTPUT'.
gs_fieldcat-seltext_l = text-004.
gs_fieldcat-col_pos = lv_count.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
lv_count = lv_count + 1.
gs_fieldcat-fieldname = 'MESSAGE'.
gs_fieldcat-tabname = 'GT_OUTPUT'.
gs_fieldcat-seltext_l = text-005.
gs_fieldcat-col_pos = lv_count.
APPEND gs_fieldcat TO gt_fieldcat.
CLEAR gs_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
*& Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM build_layout .
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
ENDFORM. " BUILD_LAYOUT
*&---------------------------------------------------------------------*
*& Form EXECUTE_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM execute_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BUFFER_ACTIVE = 'X'
i_callback_program = gv_repid
i_callback_user_command = 'USER_COMMAND' "To call the VA03 tcode on click of delivery number
i_callback_pf_status_set = 'PFSTATUS' "To display standard PF Status
is_layout = gs_layout
it_fieldcat = gt_fieldcat
TABLES
t_outtab = gt_output.
ENDFORM. " EXECUTE_ALV
*---------------------------------------------------------------------*
* FORM PFSTATUS *
*---------------------------------------------------------------------*
FORM pfstatus USING ut_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
ENDFORM. " PF_STATUS_SET
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
IF rs_selfield-fieldname EQ 'VBELN'.
SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM. "user_command
Hello Shreyansh,
Good day!
Were you able to resolve your issue?
I am also encountering the same issue right now. I tried everything suggested but still it does not work.
Can you please tell me how you solved the issue?
Thank you.
Regards,
Onyx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear all,
While using call transaction sy-binpt will be set, so after the below mentioned statement in RESUSE_ALV_GRID_DISPLAY function module it will display list instead of grid.
if ( is_layout-allow_switch_to_list ne space
and boolean eq if_salv_c_bool_sap=>true )
or ( sy-binpt eq abap_true ).
To display grid while using call transaction you have to use CTU_PARAMS with
NOBIEND = 'X'
Regards,
Nijin Shah.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nijin,
I am new to ABAP. I have one scenario. please give me the code. It is ALV grid report.Please help me, it is very urgent.
My email id: mahesh.sapkumar@gmail.com
Selection Parameters
Date Range: From
date – To date (F4)
Validation:
Should be valid date range
Scope: Radio buttons
Successful
Error
---------------------------------------------------------------------------------------------------------------------------------------------
Successful: Display following options
Date
range above should be validated with PO Creation date
EKKO - AEDAT
Vendor (mandatory) Check if it is VMI and BMI relevant (LFM1 – EIKTO should
not be blank)
Radio
buttons with input box and F4 functionality (Only if successful option is
selected)
Document Type:
Purchase order -
EKKO – EBELN
Sales order - EKES – XBLNR
if EKES -EBTYP = AB
Inbound delivery - EKES – VBELN if EKES -EBTYP = LA
Invoice number - EKBE– BELNR if EKBE -BEWTP = Q
(None?? – to
be checked with ABAPer)
Validations
Documents
should belong to the vendor mentioned above
Get
the PO number from respective tables EKES, EKBE and field EBELN and check with EKKO – LIFNR
Report in
ALV grid
VMI BMI Dashboard | ||||||||||||||
Sr . No | Vendor | Pur Order No | Item no | Article No | Qty | Sales order | SO Item | Vendor article No | SO Qty | Inbound Delivery | Item No | Del Qty | GR doc no | IR doc no |
EKKO - LIFNR | EKKO - EBELN | EKPO - EBELP | EKPO - MATNR | EKPO - MENGE | Table- EKES | EKES - VBELP | EINA -IDNLF | EKES - MENGE | Table- EKES | EKES - VBELP | EKES - MENGE | EKBE - BELNR | EKBE - BELNR | |
Field - XBLNR | If conf cat | If conf cat | Field - VBELN | If conf cat | if BEWTP - E | if BEWTP - Q | ||||||||
If conf cat | EKES -EBTYP = AB | EKES -EBTYP = AB | If conf cat | If conf cat | If conf cat | |||||||||
EKES -EBTYP = AB | EKES -EBTYP = LA | EKES -EBTYP = LA |
Dear all,
I like to display the alv list view in end the alv grid view or end of the page.
Kindly help me to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello sir,
Kindly delete the itab when production order tab is nill .
i used tis logic for doing plannedorder sir,
pass saleorder item to tis functionmodule 'MD_SALES_ORDER_STATUS_REPORT'
from tis output check the functionmodule-rsnum = vbap-vbeln
rspos = vbap-posnr
matnr = vbap-matnr
rsdat = vbap-kdmat.
if sy-subrc = 0.
SELECT * FROM plaf WHERE plnum = functionmodule-delnr.
from plaf you can get the rsum field.
linking rsnum field with resb table you can get the production order .
Regards,
Venkatramesh.V
Coimbatore
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
instead of ut_extab try rt_extab
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue may be the sap is not getting enough memory for grid display so it is displaying list which occupies less memory . I guess.
Did you try just the REUSE_ALV_GRID_DISPLAY without BAPI in a simple report and see u are able to get grid display in your system ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maverick,
Yes. It works fine without BAPI(simple report). But we have to capture the BAPI results and display in ALV. Even for single record which is captured from BAPI, which is not displaying in GRID. I even suspect there might be memory issue. Any ways of clearing memory other than BAPI_TRANSACTION_COMMIT/ROLLBACK?.
Hi ,
try to use FM 'STATUS_BUFFER_REFRESH' after the commit. I havent checked it properly as i dont have sap system right now. One more thing i guess you can do is export your internal table to sap memory and create a new program which imports this internal table and displays it as ALV grid. After your BAPI commit you can then call this new display program by SUBMIT. hope this helps.
Hi Shreyansh,
can u please comment the I_BUFFER_ACTIVE = 'X' in the function module 'REUSE_ALV_GRID_DISPLAY' and check it.
hope it helps u...
Thanks & Regards
Vasantha D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
FYI:
we are also having issue with the ALV list in our portal environment since we upgraded SPS10 to SPS11 on the erp6 and netweaver 7.01. When i try to test the connection in SM59, it just hang until i re-start the service in the visual admin. I did not find a resolution to the issue yet, when i do i will let you know.
Thanks
Jean
Hi Shreyansh,
Try to use this code and change accordingly to ur requirement.
if conditions are not falling then it should work properly and can u send me your whole code
*&---------------------------------------------------------------------*
*& Report ZMALV14
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZMALV14 .
TYPE-POOLS: SLIS.
DATA: BEGIN OF GT_OUTTAB OCCURS 0.
INCLUDE STRUCTURE SFLIGHT.
DATA: END OF GT_OUTTAB,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
G_EXIT_CAUSED_BY_CALLER,
GS_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,
G_REPID LIKE SY-REPID.
*"Callback
DATA:
GT_EVENTS TYPE SLIS_T_EVENT,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
G_STATUS_SET TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
G_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
G_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST'.
*"Variants
DATA: GS_VARIANT LIKE DISVARIANT,
G_SAVE.
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM LAYOUT_INIT USING GS_LAYOUT.
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
GS_VARIANT-REPORT = G_REPID.
G_SAVE = 'A'.
START-OF-SELECTION.
*"Data Selection
PERFORM SELECT_DATA TABLES GT_OUTTAB.
END-OF-SELECTION.
*"List Header for Top-Of-Page
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*"Display List
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
i_buffer_active = 'X'
I_CALLBACK_PROGRAM = G_REPID
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
I_SAVE = G_SAVE
IS_VARIANT = GS_VARIANT
IT_EVENTS = GT_EVENTS[]
* I_SCREEN_START_COLUMN = 0 "Use coordinates for
* I_SCREEN_START_LINE = 0 "display as dialog box
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = GT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC = 0.
IF G_EXIT_CAUSED_BY_CALLER = 'X'.
*" Forced Exit by calling program
*" <do_something>.
ELSE.
*" User left list via F3, F12 or F15
IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3
*" <do_something>.
ELSE.
IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15
*" <do_something>.
ELSE.
IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
*" <do_something>.
ELSE.
*" should not occur!
*" <do_Abnormal_End>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
*"Fatal error callin ALV
* MESSAGE AXXX(XY) WITH ...
ENDIF.
*"Form routines
"
FORM SELECT_DATA TABLES RT_OUTTAB LIKE GT_OUTTAB[].
*"- Selection of data to be displayed
SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS
OF TABLE RT_OUTTAB
.
ENDFORM.
FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
*"Build layout for list display
RS_LAYOUT-DETAIL_POPUP = 'X'.
ENDFORM.
FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
*"Registration of events to happen during list display
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
*
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = RT_EVENTS.
READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO RT_EVENTS.
ENDIF.
ENDFORM.
"
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'ENJOYSAP_LOGO'
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM.
"
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
*
* LIST HEADING LINE: TYPE H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
LS_LINE-INFO = TEXT-100.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
* STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-101.
LS_LINE-INFO = TEXT-102.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
LS_LINE-KEY = TEXT-103.
LS_LINE-INFO = TEXT-104.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
* ACTION LINE: TYPE A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: NOT USED FOR THIS TYPE
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
ENDFORM.
Thanks
Madhukiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am new to ABAP. I have one scenario. please give me the code. It is ALV grid report.Please help me, it is very urgent.
Selection Parameters
Date Range: From
date – To date (F4)
Validation:
Should be valid date range
Scope: Radio buttons
Successful
Error
---------------------------------------------------------------------------------------------------------------------------------------------
Successful: Display following options
Date
range above should be validated with PO Creation date
EKKO - AEDAT
Vendor (mandatory) Check if it is VMI and BMI relevant (LFM1 – EIKTO should
not be blank)
Radio
buttons with input box and F4 functionality (Only if successful option is
selected)
Document Type:
Purchase order -
EKKO – EBELN
Sales order - EKES – XBLNR
if EKES -EBTYP = AB
Inbound delivery - EKES – VBELN if EKES -EBTYP = LA
Invoice number - EKBE– BELNR if EKBE -BEWTP = Q
(None?? – to
be checked with ABAPer)
Validations
Documents
should belong to the vendor mentioned above
Get
the PO number from respective tables EKES, EKBE and field EBELN and check with EKKO – LIFNR
Report in
ALV grid
VMI BMI DASHBOARD
Sr . No | Vendor | Pur Order No | Item no | Article No | Qty | Sales order | SO Item | Vendor article No | SO Qty | Inbound Delivery | Item No | Del Qty | GR doc no | IR doc no |
EKKO - LIFNR | EKKO - EBELN | EKPO - EBELP | EKPO - MATNR | EKPO - MENGE | Table- EKES | EKES - VBELP | EINA -IDNLF | EKES - MENGE | Table- EKES | EKES - VBELP | EKES - MENGE | EKBE - BELNR | EKBE - BELNR | |
Field - XBLNR | If conf cat | If conf cat | Field - VBELN | If conf cat | if BEWTP - E | if BEWTP - Q | ||||||||
If conf cat | EKES -EBTYP = AB | EKES -EBTYP = AB | If conf cat | If conf cat | If conf cat | |||||||||
EKES -EBTYP = AB | EKES -EBTYP = LA | EKES -EBTYP = LA |
Hi Shreyansh,
In FUNCTION MODULE 'REUSE_ALV_GRID_DISPLAY' see the source code in that
FUNCTION MODULE REUSE_ALV_LIST_DISPLAY is used in this way
if ( is_layout-allow_switch_to_list ne space
and boolean eq if_salv_c_bool_sap=>true )
or ( sy-binpt eq abap_true ).
perform globals_push.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_interface_check = i_interface_check
i_bypassing_buffer = i_bypassing_buffer
i_buffer_active = i_buffer_active
i_callback_program = i_callback_program
i_callback_pf_status_set = i_callback_pf_status_set
i_callback_user_command = i_callback_user_command
i_structure_name = i_structure_name
is_layout = is_layout
it_fieldcat = it_fieldcat
it_excluding = it_excluding
it_special_groups = it_special_groups
it_sort = it_sort
it_filter = it_filter
is_sel_hide = is_sel_hide
i_default = i_default
i_save = i_save
is_variant = is_variant
it_events = it_events
it_event_exit = it_event_exit
is_print = is_print
is_reprep_id = is_reprep_id
i_screen_start_column = i_screen_start_column
i_screen_start_line = i_screen_start_line
i_screen_end_column = i_screen_end_column
i_screen_end_line = i_screen_end_line
it_except_qinfo = it_except_qinfo
importing
e_exit_caused_by_caller = e_exit_caused_by_caller
es_exit_caused_by_user = es_exit_caused_by_user
tables
t_outtab = t_outtab
exceptions
program_error = 1
others = 2.
if ( is_layout-allow_switch_to_list ne space
and boolean eq if_salv_c_bool_sap=>true )
or ( sy-binpt eq abap_true ).
if these condition are satisfied then it wiil display LIST ALV so keep a break-point and check GRID DISPLAY FM.
Hope this will help you
Thanks
Madhukiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi shreyansh,
I have tried ur code to check the issue when i run this code it is working fine can u say me the table name which ur using i have tried with VBAK.
Thanks
Madhukiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank madhu..
CALL FUNCTION 'BAPI_PRODORD_CREATE_FROM_PLORD'
EXPORTING
planned_order = gs_plaf-plnum "Planned Order
order_type = lv_order_type "Production Order Type
* ORDER_NUMBER =
IMPORTING
production_order = lv_prod_order "Production order Number
prod_order_type = lv_prod_order_type "Production Order Type
return = ls_return.
IF sy-subrc EQ 0.
*Prepare output table
gs_output-vbeln = gs_plaf-kdauf.
gs_output-plnum = gs_plaf-plnum.
gs_output-aufnr = lv_prod_order.
gs_output-message = ls_return-message.
APPEND gs_output TO gt_output.
----------
I am passing the planned order number of sales order to BAPI and returned with production order.
For one sales order, there are 3 planned orders and it can create production orders.
1. If 3 production created successfully there will be 3 rows in GT_OUTPUT and output is displayed in ALV Grid.
2. If out of 3 planned orders, 1 production order created and 2 failed to create, then 3 rows in GT_OUTPUT with relevent data but output displayed in ALV List.
I tried lot to find the issue. There is no issue in data declaration,fieldcatalog or also in calling the FM and paraments. I commented BAPI and executed with passed some dummy data to GT_OUTPUT. works fine.
I suspected, issue might be because of in memory usage and locking. But still Not working even after calling BAPI_TRANSACTION_COMMIT & BAPI_TRANSACTION_ROLLBACK and FLUSH.
I dont understand why this BAPI is crashing the ALV grid Output.
Need help badly....
Shreyansh,
What you are getting list display is right.
Actually that is not a list display, it is grid display only but all fields all locked that's why it's looks like list display. here the bapi locking the fields.
* Assignment of lock parameters to lock fields:
IF NOT MANDT IS INITIAL.
MOVE MANDT TO:
%a_PLAF-MANDT.
ENDIF.
IF NOT PLNUM IS INITIAL OR
NOT x_PLNUM IS INITIAL.
MOVE PLNUM TO:
%a_PLAF-PLNUM.
ENDIF.
* Fill the lock table:
__seqta_tab-gname = 'PLAF'.
__seqta_tab-gmode = MODE_PLAF.
__seqta_tab-garg = %a_PLAF.
APPEND __seqta_tab.
* Lock assigned:
PERFORM send_enqueue(saplsena)
TABLES __seqta_tab
USING '2' __scope ' ' __synchron 'EMPLAFE' _collect.
this code having inside the BAPI.
CALL FUNCTION 'DEQUEUE_EMPLAFE'
EXPORTING
plnum = planned_order.
->go inside the FM DEQUEUE_EMPLAFE and check once.
Hope you understand the issue.
Regards,
BALAJI.
Hi Balaji,
If it is locking the fields then why it displays ALV Grid if the planned order converts to Production Order. It displays ALV List only when BAPI fails to convert Planned to production. Even there is no lock entry created after BAPI, in SM12 for PLAF.
As you said, I have tried explicitly calling the DEQUEUE_EXPLAFE but still not working.
Help me..
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.