2021 Aug 31 2:35 PM
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.
2021 Aug 31 4:12 PM
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?
2021 Aug 31 2:37 PM
Stop with this old way of doing ALV.
Use CL_GUI_ALV_GRID or better SALV
2021 Aug 31 2:49 PM
I am learning new abap. I will take into account what you have said. Thanks.
2021 Aug 31 3:21 PM
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.
2021 Aug 31 3:21 PM
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.
2021 Aug 31 4:12 PM
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?
2021 Aug 31 4:14 PM
2021 Sep 01 8:15 AM
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)
2021 Sep 01 8:33 AM
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 🙂
2021 Sep 01 10:31 AM
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.