Current Position:Home > O/p of alv grid

O/p of alv grid

Update:11-30Source: network consolidation
Advertisement
hi all,
i want the o/p of one alv report as the o/p of tcode MBLB.
how can i assign the fields like that.
PLZ explain me with simple coding.
regards
Nilabichi

The Best Answer

Advertisement
Hi...
Try to under stand this program.. here zmodel1, zmodel2 are databse tables....
And find the program name of that transaction through system -> status and capture the field which you needs to be display and also the table names....
types: begin of ty_model1,
       za(10),
       zb type netwr,
       zc(10),
       zd(10),
       ze(10),
       zf(10),
       end of ty_model1,
       begin of ty_model2,
       za1(10),
       zb1(10),
       zc1(10),
       zd1(10),
       za(10),
       end of ty_model2,
       begin of ty_output,
       za(10),
       zb type netwr,
       zc(10),
       zd(10),
       ze(10),
       zf(10),
       za1(10),
       zb1(10),
       zc1(10),
       zd1(10),
       f1(4) type n,
       end of ty_output.
data: t_model1 type standard table of ty_model1 initial size 0,
      t_model2 type standard table of ty_model2 initial size 0,
      t_output type standard table of ty_output initial size 0,
      w_model1 type ty_model1,
      w_model2 type ty_model2,
      w_output type ty_output.
data: w_fieldcat type slis_fieldcat_alv,
      t_fieldcat type slis_t_fieldcat_alv,
data: g_comp type char10.
selection-screen begin of block b1 with frame title text-t01.
select-options: s_comp for g_comp.
selection-screen end of block b1.
Initialization event
initialization.
clear: w_model1, w_model2, w_output,
       t_model1[], t_model2[], t_output[].
Start-of-selection event
start-of-selection.
perform sub_select_data.
perform sub_fill_output_table.
perform sub_get_alv.
*&      Form  sub_select_data
FORM sub_select_data .
select * from zmodel1 into corresponding fields of table t_model1 where za in s_comp.
if sy-subrc = 0.
select * from zmodel2 into corresponding fields of table t_model2 for all entries in t_model1 where za = t_model1-za.
endif.
ENDFORM.                    " sub_select_data
*&      Form  sub_fill_output_table
FORM sub_fill_output_table .
loop at t_model2 into w_model2.
  w_output-za1 = w_model2-za1.
  w_output-zb1 = w_model2-zb1.
  w_output-zc1 = w_model2-zc1.
  w_output-zd1 = w_model2-zd1.
read table t_model1 into w_model1 with key za = w_model2-za.
if sy-subrc = 0.
  w_output-za = w_model1-za.
  w_output-zb = w_model1-zb.
  w_output-zc = w_model1-zc.
  w_output-zd = w_model1-zd.
  w_output-ze = w_model1-ze.
  w_output-zf = w_model1-zf.
endif.
append w_output to t_output.
clear: w_output, w_model1, w_model2.
endloop.
ENDFORM.                    " sub_fill_output_table
*&      Form  sub_get_alv
FORM sub_get_alv .
  w_fieldcat-col_pos = 1.
  w_fieldcat-fieldname = 'ZA'.
  w_fieldcat-seltext_m = 'Company Name'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 2.
  w_fieldcat-fieldname = 'ZA1'.
  w_fieldcat-seltext_m = 'City'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 3.
  w_fieldcat-fieldname = 'ZC'.
  w_fieldcat-seltext_m = 'Phone Number'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 4.
  w_fieldcat-fieldname = 'ZD'.
  w_fieldcat-seltext_m = 'Field ZD'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 5.
  w_fieldcat-fieldname = 'ZE'.
  w_fieldcat-seltext_m = 'Field ZE'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 6.
  w_fieldcat-fieldname = 'ZF'.
  w_fieldcat-seltext_m = 'Field ZF'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 7.
  w_fieldcat-fieldname = 'ZB1'.
  w_fieldcat-seltext_m = 'Field ZB1'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 8.
  w_fieldcat-fieldname = 'ZC1'.
  w_fieldcat-seltext_m = 'Field ZC1'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 9.
  w_fieldcat-fieldname = 'ZD1'.
  w_fieldcat-seltext_m = 'Field ZD1'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  w_fieldcat-col_pos = 10.
  w_fieldcat-fieldname = 'ZB'.
  w_fieldcat-seltext_m = 'Field ZB'.
  append w_fieldcat to t_fieldcat.
  clear w_fieldcat.
  call function 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM                = sy-repid
     I_GRID_TITLE                      = 'Custom Tables Display'
     IT_FIELDCAT                       = t_fieldcat
    tables
      T_OUTTAB                          = t_output.
ENDFORM.                    " sub_get_alv
Like this you can try...
Thanks,
Naveen.i
  • Vendor open items wise ALV Grid Display (FBL1N) report to Excel Sheet Update:10-11

    Hi All, I need vendor wise open items and cleared items in ALV Grid format in excel sheet. I'm Trying that in T Code FBL1N, After the execution. I had select ALV Grid format like this From the menu bar->Settings-> Switch list. After that i get ALV 

  • First try with ALV Grid and Abap Objects Update:10-11

    Hi, this is my first try to write a simple report which just reads a textfile and display it in an ALV Grid. As a basis, I used some examples from SDN, but it did not work as expected I would like just to use a docking container. I do not need a sepa

  • Help needed for editable alv grid program Update:10-11

    hi, Can you please tell me how to set a ‘update’ button in application toolbar of alv griv without suppressing it and how to write the code for that update button so that if I change my editable column data and press the update button my updated data

  • How can we find out data in an editable ALV grid has been changed or not? Update:10-11

    Hi Experts, How can we find out whether a data in an editable ALV grid has been changed or not. I am using the FM -> REUSE_ALV_GRID_DISPLAY_LVC for ALV display. I have to chekc whther data has been changed or not befor saving. if changed then only i

  • ALV Grid: how to save changes made in an editable Grid Update:10-11

    Hi, How to save changes made bu the user in any of the editable cells in a ALV Grid? Regards, deb.Hi, If you are using the FM look at the following example code... data: LC_GLAY TYPE LVC_S_GLAY. LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------ gt_layou

  • How to update data in the database through ALV grid Update:10-11

    Hi All, I diplayed an ALV grid with five fields in a classical report. I have already set the fieldcat for one field as wa_fcat_edit = 'X'. I am able to edit(modify) the data in that field. But I want to update the data into the database which is mod

  • Regarding column editing in alv grid Update:10-11

    hi experts, i m using alv grid display for my report layout what i want that after the output dispaly when the user will select my customized button "change the amount column" then after pressing this my amount column will become editable and us

  • Popup instead of list when using WD4A ALV Grid Drop Down By Key Update:10-11

    I am develop a WD4A application and I am using an ALV grid.  I have set the cell editor for one column wiht the following code: CREATE OBJECT lr_ddbk     EXPORTING       SELECTED_KEY_FIELDNAME = 'ZCURRENCY'.   Data: lv_key_visable TYPE abap_bool,    

  • Need to add Header  and footer in an alv grid display output. Update:10-11

    How can I add header and footer in an alv grid dispay output. For the grid display, I am using the function module "REUSE_ALV_GRID_DISPLAY".HI, call function 'REUSE_ALV_GRID_DISPLAY'        exporting             i_callback_program      = gd_repi

  • Not gettting quantity displayed in the alv grid Update:10-11

    hi experts iam displaying vbeln, matnr, quantity, sellingprice etc for an customer using fieldcat. in alv grid. iam able to get all the fields other than quantity in the output. i have taken vbap-kwmeng, actually in the va03 it is displaying from kom