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: 

Internal Table Error

Former Member
0 Kudos

Dear all

I need the first column of the internal table as a checkbox. Please give me the syntax to do that.

Itried like

types:begin of is_ty,

a type c as checkbox,

matnr type matnr,

end of is_ty.

But its throw an error in the first row...Please give me the correct syntax....i am not writing my internal table in the output.I am just passing it to a Container alv and i am not using any table controls...So please tell me how can we make a Checkbox in Container ALV......plz help

thanks

8 REPLIES 8

Former Member
0 Kudos

HI,

Refer to the demo program BCALV_EDIT_05 .. you can find the code init.

Former Member
0 Kudos

Hi,

declare your structure as,

types:begin of is_ty,
a type c, "Check box field
matnr type matnr,
end of is_ty.

for the check box logic, when you build the field catalog write like this:

wa_fieldcat-col_pos = 1.

wa_fieldcat-fieldname = 'A'. "Check box field name
  wa_fieldcat-seltext_m = 'Select'.
  wa_fieldcat-checkbox = 'X'. "It's a checkbox!
  wa_fieldcat-edit = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.

Regards,

Manoj Kumar P

sarbajitm
Contributor
0 Kudos

BEGIN OF T_final ,

chk(1) TYPE c, " for checkbox

ebeln LIKE ekko-ebeln,

ebelp LIKE ekpo-ebelp,

bstyp LIKE ekko-bstyp,

bsart LIKE ekko-bsart,

lifnr LIKE ekko-lifnr,

ekorg LIKE ekko-ekorg,

ekgrp LIKE ekko-ekgrp,

matnr LIKE ekpo-matnr,

werks LIKE ekpo-werks,

lgort LIKE ekpo-lgort,

menge LIKE ekpo-menge,

meins LIKE ekpo-meins,

eindt LIKE eket-eindt,

END OF T_final.

IT_final TYPE STANDARD TABLE OF T_final,

at the time of building field catalog

WA_fieldcat-fieldname = 'CHK'.

WA_fieldcat-seltext_m = 'CheckBox'.

WA_fieldcat-checkbox = 'X'. "This declaration create the checkbox

WA_fieldcat-edit = 'X' .

WA_fieldcat-input = 'X'.

WA_fieldcat-tabname = 'IT_FINAL'.

WA_fieldcat-col_pos = 1.

APPEND WA_fieldcat TO IT_fieldcat.

CLEAR WA_fieldcat.

Thanks and Regards.

Sarbajit

Edited by: Sarbajit Majumdar on Mar 18, 2009 11:23 AM

I355602
Advisor
Advisor
0 Kudos

Hi,

There is no need to declare the first field as checkbox in your internal table, inseat declare your internal table as:


types : begin of t_final,
          chk(1) type c, " <-- check box field
          "other fields,
        end of t_final.

data : it_final TYPE TABLE OF t_final,
       wa_final TYPE t_final.

Now to include check box in alv, build the field catalog as:-


  wa_fieldcat-fieldname = 'CHK'. "<--check box field in internal table
  wa_field-tabname = 'IT_FINAL'. "<--internal table
  wa_fieldcat-seltext_m = ' '.
  wa_fieldcat-checkbox = 'X'. "<--display as checbox
  wa_fieldcat-edit = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.

When checkbox is selected the field chk in internal table is X else it is blank.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

dont use type use like if u have to use this structure for ALV.

Former Member
0 Kudos

Hi,

instead of taking a variable in intrenla table as checkbox just declare as C type only

types:begin of is_ty,
a type c ," as checkbox,
matnr type matnr,
end of is_ty.

Then at the time of setting the field catalog set the value of Checkbox foe 'a' as X. this will set the 'a' as a checkbox.

Pooja

Former Member
0 Kudos

Hi Biju,

As also said by other's create your internal table with first field as type c length 1 and just pass the value as 'X' in your fieldcat-checkbox. cause a type c as checkbox will help when you are using classical report there youe can use write a as checkbox.,

With luck,

Pritam.

Former Member
0 Kudos

thnks