2016 Sep 24 6:32 AM
Hi experts,
I add a additional tab in me22n to display alv but whenever i am giving multiple order in same session its overlapped.Find the attachement below.
SELECT ebeln
belnr
menge
dmbtr FROM ekbe INTO TABLE it_ekbe WHERE ebeln EQ i_ekpo-ebeln.
SORT it_ekbe DESCENDING BY belnr.
CLEAR sy-dynnr.
*IF sy-subrc EQ 0.
LOOP AT it_ekbe INTO wa_ekbe .
wa_alv-belnr = wa_ekbe-belnr.
wa_alv-menge = wa_ekbe-menge.
wa_alv-dmbtr = wa_ekbe-dmbtr.
lv_u_price = wa_ekbe-dmbtr / wa_ekbe-menge.
wa_alv-u_price = lv_u_price.
APPEND wa_alv TO it_alv.
SORT it_alv DESCENDING BY belnr.
ENDLOOP.
*IF it_alv IS NOT INITIAL.
CLEAR wa_fcat.
wa_fcat-col_pos = 1.
wa_fcat-fieldname = 'BELNR'.
wa_fcat-tabname = 'IT_ALV'.
wa_fcat-coltext = 'MAT. DOC no.'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 2.
wa_fcat-fieldname = 'MENGE'.
wa_fcat-tabname = 'IT_ALV'.
wa_fcat-coltext = 'QUANTITY'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 3.
wa_fcat-fieldname = 'DMBTR'.
wa_fcat-tabname = 'IT_ALV'.
wa_fcat-coltext = 'AMOUNT'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 4.
wa_fcat-fieldname = 'U_PRICE'.
wa_fcat-tabname = 'IT_ALV'.
wa_fcat-coltext = 'UNIT PRICE'..
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
*ENDIF.
IF it_alv IS NOT INITIAL.
IF o_cust IS NOT BOUND.
CREATE OBJECT o_cust
EXPORTING
container_name = 'CONTAINER'.
ENDIF.
IF o_alv IS INITIAL.
CREATE OBJECT o_alv
EXPORTING
i_parent = o_cust.
CALL METHOD o_alv->set_table_for_first_display
CHANGING
it_outtab = it_alv
it_fieldcatalog = it_fcat.
CALL METHOD o_alv->refresh_table_display.
2016 Sep 24 8:35 AM
I don't understand what you mean: "multiple order in same session it's overlapped" ?
Could you explain step by step?
HI rossi,
In ME22N transaction ALV display against PO Its display good for first time but whenever changing the po the new alv gets overlapped with previous one though i used Refresh_table_display.
the written code is given above and the ALV in the attachment.
2016 Sep 24 8:35 AM
I don't understand what you mean: "multiple order in same session it's overlapped" ?
Could you explain step by step?
2016 Sep 24 9:48 AM
HI rossi,
In ME22N transaction ALV display against PO Its display good for first time but whenever changing the po the new alv gets overlapped with previous one though i used Refresh_table_display.
the written code is given above and the ALV in the attachment.
2016 Sep 24 9:57 AM
oh okay. It's a very frequent error. It's because you create a new instance of the container/ALV every time, without freeing the previous one, so the first non-freed control is always displayed. Use the FREE method (that's not the FREE statement) to free a control.
2016 Sep 24 10:00 AM
hi rossy,
I Used that but not working
CALL METHOD o_alv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD o_cust->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
* flag = 'X'.
FREE o_cust.
FREE o_alv.
* LEAVE TO TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
CLEAR : o_cust , o_alv .
REFRESH : it_fcat.
2016 Sep 24 12:29 PM
I can't say anything else than you have to make sure by debug what happens exactly: if a control is created, it must be followed by a free. A control must not be created sucessively twice without having been freed between.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |