Skip to Content
0
Former Member
Apr 06, 2011 at 10:34 AM

Why is initial value of a 'checkbox' field coming as 0 (zero) ?

23 Views

Hi,

I am creating an Interactive report where we have to display further details

from the basic list in which checkbox has been checked (checkbox is displayed in

the basic list).But upon Debugging i'm seein that the initial value for the

checkbox field is 0, hence i'm not able to check if it is checked or not.The sample

code is as follows:

TABLES : lfa1.

TYPES : BEGIN OF ty_lfa1,

chk TYPE checkbox,

mrk,

lifnr TYPE lifnr,

anred TYPE anred,

name1 TYPE name1_gp,

stras TYPE stras_gp,

pstlz TYPE pstlz,

ort01 TYPE ort01_gp,

land1 TYPE land1_gp,

END OF ty_lfa1.

DATA : it_lfa1 TYPE STANDARD TABLE OF ty_lfa1,

wa_lfa1 TYPE ty_lfa1.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.

SELECTION-SCREEN END OF BLOCK b1.

TOP-OF-PAGE.

WRITE : 'Vendor Listing'.

WRITE : / 'CB', 15 'Vendor No.', 35 'Vendor Name', 50 'City', 65

'Country Code'.

START-OF-SELECTION.

SELECT lifnr anred name1 stras pstlz ort01 land1

FROM lfa1

INTO TABLE it_lfa1

WHERE lifnr IN s_lifnr.

SET PF-STATUS 'BASE'.

LOOP AT it_lfa1 INTO wa_lfa1.

WRITE : / wa_lfa1-chk AS CHECKBOX, 15 wa_lfa1-lifnr, 35

wa_lfa1-name1, 50 wa_lfa1-ort01, 65 wa_lfa1-land1.

HIDE wa_lfa1-chk.

ENDLOOP.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'ADDR'.

LOOP AT it_lfa1 INTO wa_lfa1.

READ LINE sy-index FIELD VALUE wa_lfa1-chk .

IF wa_lfa1-chk = 'X'.

WRITE : / wa_lfa1-lifnr, wa_lfa1-anred,

/ wa_lfa1-stras, wa_lfa1-pstlz,

/ wa_lfa1-ort01, wa_lfa1-name1.

MODIFY CURRENT LINE FIELD VALUE wa_lfa1-chk FROM space

wa_lfa1-mrk FROM '*'.

ENDIF.

ENDLOOP.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

Kindly inform me the resolution for this issue.