Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Abstract:

To make serial number field editable and non -editable dynamically based on the material  in ALV display, if a material is serialized(editable) and gray out if not.

Executive Summary:

This program is used to make the ALV field editable if a material is serialized and disable if a material is not serialized for the users. User can provide the serial numbers and can post the Material document on click of save.

Processing Logic:

  1. To check whether a material is serialized or not,  we can use function module “material_read”. Pass values to table MTCOM (material master communication).
  2. The importing parameter will be table MARC. The field SERNP in MARC, if it is not initial then material is serialized. Use SERIAL_PROFILE_READ to read the serial number read profile parameters.
  3. To create an Editable ALV, We can use OOPS concept(Call Screen 100).Inside PBO do the following.
  4. Create custom container and Grid for the screen you are going to display the ALV output.
  5. Move the final internal table, which is used to display the ALV to a temporary internal table. Add one field call celltab of type lvc_t_styl.
  6. Give the layout style name as ‘CELLTAB’.
  7. Check if marc-sernp not initial. If so, use class cl_gui_alv_grid=>mc_style_enabled to make the field editable.
  8. Sample code:

  PERFORM fill_celltab USING gt_outtab-sernp
       
CHANGING lt_celltab.  

FORM fill_celltab USING wt_outtab-sernp TYPE marc-sernpCHANGING pt_celltab TYPE lvc_t_styl.
 
DATA: ls_celltab TYPE lvc_s_styl,
  l_mode
TYPE raw4.

IF wt_outtab-sernp <> ''.

l_mode = cl_gui_alv_grid=>mc_style_enabled.
 
ELSE.

l_mode = cl_gui_alv_grid=>mc_style_disabled.
 
ENDIF.

  ls_celltab-fieldname =
'FIELD'.”field= the field name you want to make editable”

ls_celltab-style = l_mode.
 
INSERT ls_celltab INTO TABLE pt_celltab.

  1. Insert this cell tab into the temporary table and modify the temporary table used for ALV display.
  2. Display the ALV using set_ready_for_input  and  set_table_for_first_display