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: 

Change/Display in ALV Grid

Former Member
0 Kudos

Hello All,

I am using FM 'REUSE_ALV_GRID_DISPLAY'. It is required that when the user presses a button on the screen, that a few fields toggle from display mode to changed mode. I know that setting the input and edit fields to X for the field catalog table will allow a user to change the table but only on the initial display of the grid. Does anyone know how I toggle between the change and display mode of the ALV grid? Thanks for your help in advance.

John

1 ACCEPTED SOLUTION

former_member188685
Active Contributor

hi

Can you check this Program once.

BCALV_GRID_EDIT

regards

vijay

26 REPLIES 26

Former Member
0 Kudos

Does that mean that user will be able to change mode only once like once the output is displayed then he can click on a button which will make some fields input enabled. you can try using flags if it is one time. Set flag first time it changes mode and later check for the flag.

0 Kudos

Hello Ashish,

Thanks for your reply. I am currently using flags to capture when the user selects the button, however I am unable to have those fields in the ALV toggle to change mode. I am not sure what I am missing at this point. Any further suggestions? Thanks.

John

0 Kudos

John,

I think you will need to adjust the field catalog in the user_command form. i.e. when user hits pfx you adjust the input attribute of the fields you require to be open for input.

0 Kudos

While handling user command event you will have to call these funciton modules to prepare field catalog and to display data again. Make sure that if user clicks on BACK, it will not go to the initial output screen. This you will have to handle in program. Also check with the menubar, are you using standard menubar?

0 Kudos

Hello Neil,

Thanks for your help. Currently at the user command, I am changing the input and edit fields of the field catalog to X when this button is clicked, however that does not seem to allow for the input on the screen alone. Any further suggestions?

John

0 Kudos

After assigning X to input field when you modify fieldcatalog internal table, can you check once the contents of internal table.

Suggestion - before calling fieldcatalog function module, refresh internal table once.

0 Kudos

Hi John,

could you please supply a code fragment of how you are trying to change the field catalog in the user_command form? This should be helpful.

0 Kudos

Hello Neil,

Here is some code:

CASE v_ucomm.

WHEN '&CHANGE'.

LOOP AT int_fcat.

IF v_change EQ 'X'.

IF int_fcat-fieldname EQ 'ZRECERTDT' OR

int_fcat-fieldname EQ 'ZRECERTMT'.

int_fcat-input = 'X'.

int_fcat-edit = 'X'.

int_fcat-edit_mask = ' '.

ENDIF.

MODIFY int_fcat.

ENDIF.

ENDLOOP.

0 Kudos

Have you checked once in debug by placing a break point if the code specified works fine - int_fcat gets updated correctly for fields ZRECERTDT / ZRECERTMT.

0 Kudos

Hello Ashish,

Yes I have debugged it and the int_fcat table is updated correctly. I must be missing a step that causes the changes to the int_fcat to take affect. Thanks for your help.

John

0 Kudos

Can you mail the current process / code after modifying the fieldcatalog.

0 Kudos

John,

where does v_change get set? Shouldn't you have something immediately before the loop to toggle it on and off?

0 Kudos

Hello Ashish,

I found the following FM. I am using this after I make my changes to the int_fcat, however it does not seem to work. From the documentation given by SAP, I think that once this is used, the grid will appear with the changes made to the the layout. Unfortunately something is not working correctly.

CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_SET'

EXPORTING

IT_FIELDCAT = int_fcat[] .

v_SELFIELD-REFRESH = 'X'.

John

0 Kudos

Hello Neil,

Currently before hitting the loop this is how I am handling the v_change. Sorry I should have posted this before.

IF v_change IS INITIAL.

v_change = 'X'.

ELSE.

CLEAR v_change.

ENDIF.

John

0 Kudos

As per SAP help, it says to first use fm 'REUSE_ALV_LIST_LAYOUT_INFO_GET' and then make changes. Are you doing the same?

0 Kudos

Hello Ashish,

I added this, however I am now recieving an error "IN BACKGROUND TASK expected after REUSE_ALV_LIST_LAYOUT_INFO_GET". Do you know what this is referring to? Thanks.

John

0 Kudos

If you see where used list for this fm in SE37 and refer to any standard program, this may help you. Can you pls check this and get back.

0 Kudos

Standard SAP program BCALV_VERIFY_DTYPES_F01 uses these functions. Check once if this helps.

0 Kudos

Hello Ashish,

Thanks with your help. So far no luck. I believe I am following the documentation correctly and following the examples in SAP. Do you have any further suggestions? Thanks.

John

0 Kudos

Last try - check if you are setting RS_SELFIELD-REFRESH = 'X'. Just check this once and remove your flag for the time being to see if this is working (t osee if modified field catalog is displayed).

Other suggestion - time consuming.

Handle user command event, create / generate new field catalog table where you modify properties for these 2 fields. Call new ALV Grid function module. This is something like treating as 2 independent lists.

0 Kudos

Hello Ashish,

I am setting V_SELFIELD-REFRESH = 'X' in my program. I debugged it and found that the sy-subrc is 1 after it passes the FM REUSE_ALV_LIST_LAYOUT_INFO_GET. Do you have any idea as to why this would be 1 and not 0? This is my code so far:

CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'

IMPORTING

ET_FIELDCAT = int_fcat[]

  • TABLES

  • ET_OUTTAB = itab[]

EXCEPTIONS

NO_INFOS = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

I have seen code of this fm and inside there is a check for internal tables -

IF GT_STACK-IS_LAYOUT IS INITIAL AND

GT_STACK-IT_FIELDCAT IS INITIAL AND

GT_STACK-IT_SORT IS INITIAL.

RAISE NO_INFOS.

EXIT.

ENDIF.

Have you defined IS_LAYOUT, IT_FIELDCATALOG & IT_SORT in ur program. check once for IT_SORT and IS_LAYOUT.

0 Kudos

Hello Ashish,

I have defined only the int_fcat. This is how it is defined: int_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE. Would the header line be causing the Raise No_info error? All other programs I have viewed do not have a header line. Thanks.

John

0 Kudos

Try that oo and also you need to pass IT_SORT and IS_LAYOUT to your grid display function module. You will have to populate and execute this again. Then this should work.

0 Kudos

Hello Ashish,

Thanks for your help so far. I am still having some problems with FM REUSE_ALV_LIST_LAYOUT_INFO_GET. My problem is that the structure GT_STACK is initial (this is used in FM K_KKB_LIST_LAYOUT_INFO_GET within the REUSE). Do you know how this structure is will be populated? I think if this works then my program will work as desired. Thanks.

John

former_member188685
Active Contributor

hi

Can you check this Program once.

BCALV_GRID_EDIT

regards

vijay