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: 

How to read the input FORMAT of a Checkbox in list.

Former Member
0 Kudos
346

hi,

suppose i have,

WRITE CHK1 AS CHECKBOX INPUT OFF.

Now i have, grayed check box,

Problem. how to read from program, whether the checkbox is input off or on.

pls reply

7 REPLIES 7

Former Member
0 Kudos
113

Hi,

Check this example of how to use the Checkbox in a list..

REPORT ztest NO STANDARD PAGE HEADING.

DATA: BEGIN OF itab OCCURS 0,

check,

value(20),

END OF itab.

SET PF-STATUS 'TEST1'.

itab-value = 'ETSAT'.

APPEND itab.

itab-value = 'ETSATADSF'.

APPEND itab.

itab-value = 'ETSAT'.

APPEND itab.

LOOP AT itab.

WRITE: / itab-check AS CHECKBOX,

itab-value.

ENDLOOP.

AT USER-COMMAND.

DATA: wa LIKE itab.

DATA: itab_download LIKE itab OCCURS 0 WITH HEADER LINE.

IF sy-ucomm = 'DOWNLOAD'.

DESCRIBE TABLE itab.

DO sy-tfill TIMES.

READ LINE sy-index FIELD VALUE itab-check.

IF sy-subrc <> 0.

EXIT.

ENDIF.

CHECK itab-check = 'X'.

itab_download-value = itab-value.

APPEND itab_download.

ENDDO.

  • download

call function 'WS_DOWNLOAD'

exporting

filename = 'C:\TEST.XLS '

tables

data_tab = itab_download.

ENDIF.

Thanks,

Naren

LucianoBentiveg
Active Contributor
0 Kudos
113

When you put it off:

WRITE CHK1 AS CHECKBOX INPUT OFF.

WC_OFF_ON = 'OF'.

When you put it on:

WRITE CHK1 AS CHECKBOX INPUT ON.

WC_OFF_ON = 'ON'.

Later just check value on WC_OFF_ON.

Regards.

Former Member
0 Kudos
113

Hi

I don't know if there's a statament to get the chararcteristics of a line in a list, but you should know how a field was written, because you wrote it, didn't you?

U can use READ LINE statament to get the value of that field, so u can know if its value is X or SPACE.

Max

Former Member
0 Kudos
113

I don't think you can do this directly. But when you write the checkbox, you can hide a variable whose value depends on whether input is on or off. Then when you read in the report, you can check that variable.

Rob

0 Kudos
113

thank u all,

But i want to check it at runtime.

ie i have a 5 lines with each line starting with check box.

in htis, based on some condition, i have INPUT OFFed some check boxes using MODIFY LINE.

But now i need to read which check boxes are INPUT enabled and which are disbaled.

thanks

0 Kudos
113

My suggestion does what you want. Try:


REPORT ztest LINE-SIZE 80 LINE-COUNT 64 MESSAGE-ID 00.

DATA: on_off(3),
      chk1 VALUE 'X',
      test.

WRITE: /001 chk1 AS CHECKBOX INPUT OFF.
on_off = 'OFF'.
HIDE on_off.

WRITE: /001 chk1 AS CHECKBOX INPUT ON.
on_off = 'ON'.
HIDE on_off.

READ LINE 1.

DO 5 TIMES.
  CLEAR on_off.
  READ LINE sy-index FIELD VALUE chk1 INTO test.
  IF NOT on_off IS INITIAL.
    MESSAGE i001 WITH on_off.
  ENDIF.
ENDDO.

Rob

Added message to display what's going on.

Message was edited by:

Rob Burbank

0 Kudos
113

Hi

U can also store the characteristics of the line in an internal table and so read this table to know if the checkbox is input or output only field:

PARAMETERS: P_TIME TYPE I.

DATA: BEGIN OF ITAB OCCURS 0,
        MARK,
        FIELD1,
        FIELD2,
      END   OF ITAB.


DATA: BEGIN OF T_LINE OCCURS 0,
        LINE TYPE I,
        INPUT,
      END   OF T_LINE.

DATA: INPUT.

START-OF-SELECTION.

  DO P_TIME TIMES.
    ITAB-FIELD1 = 'A'.
    ITAB-FIELD2 = 'B'.
    APPEND ITAB.
  ENDDO.

  LOOP AT ITAB.

    T_LINE-INPUT = INPUT.

    IF INPUT = SPACE.
      INPUT = 'X'.
      WRITE: / ITAB-MARK AS CHECKBOX INPUT OFF.
    ELSE.
      INPUT = SPACE.
      WRITE: / ITAB-MARK AS CHECKBOX INPUT ON.
    ENDIF.
    WRITE: ITAB-FIELD1, ITAB-FIELD2.

    T_LINE-LINE = SY-LINNO.
    APPEND T_LINE.
  ENDLOOP.

AT LINE-SELECTION.

  READ TABLE T_LINE WITH KEY LINE = SY-CUROW.
  IF T_LINE-INPUT = 'X'.
    WRITE: 'Input'.
  ELSE.
    WRITE: 'Output only'.
  ENDIF.

Max