Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling standart toolbar

nsserkan
Explorer
0 Kudos
713

Hİ All,

The standard toolbar disappears when I compile with f8 in the 'ZTEST_PROJE' I created. I can't copy the standard by doing SE80>Function Module>SALV. I get the error 'The STANDARD state of the SAPLSALV program already exists'. Can you help me please?

I leave my code below.

*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_proje.

START-OF-SELECTION.

TABLES: ekko, ekpo, mara, lfa1.

DATA: gt_fcat TYPE slis_t_fieldcat_alv,
gs_layout TYPE slis_layout_alv.

DATA: BEGIN OF ls_stnalm OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE mara-MATNR,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
END OF ls_stnalm.

SELECT ekpo~ebeln, ekpo~ebelp, mara~matnr, lfa1~lifnr, lfa1~name1
FROM ekko
INNER JOIN ekpo ON ekko~ebeln EQ ekpo~ebeln
INNER JOIN lfa1 ON ekko~lifnr EQ lfa1~lifnr
INNER JOIN mara ON mara~matnr EQ ekpo~matnr
INTO TABLE @ls_stnalm.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'LS_STNALM'

i_inclname = sy-repid
CHANGING
ct_fieldcat = gt_fcat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gs_layout
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS'
it_fieldcat = gt_fcat
TABLES
t_outtab = ls_stnalm.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
627
  1. Don't use Answer option, use comment, read 'Before answering' at lower right corner
  2. Don't copy the status to SAPLSALV but from SAPLSALV / STANDARD to your Z report / ZSERK
  3. Don't use old obsolete REUSE FM, look at class such as CL_SALV_TABLE to display data or CL_GUI_ALV_GRID in case of update

NB: You added an excluded function code in your code, but as you don't use the rt_extab internal table in the SET PF-STATUS, can you guess what should have be done?

9 REPLIES 9

FredericGirod
Active Contributor
627

Stop with this old way of doing ALV.

Use CL_GUI_ALV_GRID or better SALV

nsserkan
Explorer
0 Kudos
627

I am learning new abap. I will take into account what you have said. Thanks.

Sandra_Rossi
Active Contributor
0 Kudos
627

I guess your question is only about copying manually the standard GUI Status you mention, to your custom program. There shouldn't be any issue, could you give more details how you are exactly trying to copy it?

NB: I agree with what Frederic says.

Sandra_Rossi
Active Contributor
0 Kudos
627

Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.

raymond_giuseppi
Active Contributor
0 Kudos
628
  1. Don't use Answer option, use comment, read 'Before answering' at lower right corner
  2. Don't copy the status to SAPLSALV but from SAPLSALV / STANDARD to your Z report / ZSERK
  3. Don't use old obsolete REUSE FM, look at class such as CL_SALV_TABLE to display data or CL_GUI_ALV_GRID in case of update

NB: You added an excluded function code in your code, but as you don't use the rt_extab internal table in the SET PF-STATUS, can you guess what should have be done?

0 Kudos
627

Thank you so much 🙂

VXLozano
Active Contributor
0 Kudos
627

Grats, mate.

Now you can make your path to the next level, and refactor your program by re-doing it.

If I see any TABLES sentence in my system, I personally ask my manager to grant me permission to cut the code's perpetrator's keyboard cable.

And if you use REUSE_ALV functions been younger than seventy, something's been wrong with your training.

The best way to improve your developer skills is to commit (fully, if you are not as lazy as I am) yourself into use the newest options of your programming language.
But as your problem has been solved and the answer is here, you can mark the question as answered to help future people to find it.
(in this case, the future people will be living in the past, but)

nsserkan
Explorer
0 Kudos
627

I am much younger than 70 years old and I have been trying to learn the abap language for 1 month. I am trying to direct myself to work more ambitious and smoother. I am at the very beginning of the road, I am very happy to receive both ideas and good wishes from my brothers like you 🙂

Sandra_Rossi
Active Contributor
627

Now you achieved your requirement, but it doesn't answer the original question which was: "I can't copy the standard by doing SE80>Function Module>SALV. I get the error 'The STANDARD state of the SAPLSALV program already exists'." Future visitors will be disappointed to not find the solution how to copy/how to solve the error.