Skip to Content
avatar image
Former Member

URGENT : GETTING ERROR ON PRSSING CHKBOX ON GRID

Hi ABAPers,

i m printing values on the grid in alv with check box for every record. but when i m pressing this check box its giving an error as : GETWA_NOT_ASSIGNED.

please help me to sort out this problem.

my code is:

TABLES: plaf,

mara,

makt,

zcdr_d.

************************************************************************

*DATA DECLARATION.

************************************************************************

DATA :FLAG TYPE I, MAINTAIN TYPE I,

FLAG1 TYPE I,

FLAG2 TYPE I,

FLAG3 TYPE I,

FLAG4 TYPE I.

DATA :BEGIN OF ITAB_PLAF OCCURS 0,

PERTR LIKE PLAF-PERTR,

PLNUM LIKE PLAF-PLNUM,

MATNR LIKE PLAF-MATNR,

PLWRK LIKE PLAF-PLWRK,

KDAUF LIKE PLAF-KDAUF,

END OF itab_plaf.

DATA :BEGIN OF ITAB_MARA OCCURS 0,

MAKTL LIKE mara-matkl,

END OF ITAB_MARA.

DATA :BEGIN OF ITAB_MAKT OCCURS 0,

MATNR LIKE ITAB_PLAF-MATNR,

MAKTX LIKE MAKT-MAKTX,

END OF ITAB_MAKT.

DATA : BEGIN OF ITAB_PLAF_MAKT OCCURS 0,

cbno(16) TYPE N,

plnum LIKE plaf-plnum,

sel TYPE C,

matnr LIKE plaf-matnr,

maktx LIKE makt-maktx,

END OF ITAB_PLAF_MAKT.

DATA I_SAVE LIKE TABLE OF zcdr_d WITH HEADER LINE.

**********************************************************************

  • Type Pools for ALV *************************************

**********************************************************************

TYPE-POOLS: SLIS,

ABAP,

KKBLO.

DATA:

GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

CT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

  • IT_SORT TYPE SLIS_T_SORTINFO_ALV,

  • WA_SORT TYPE SLIS_SORTINFO_ALV,

  • WA_SUBT LIKE SLIS_EV_SUBTOTAL_TEXT,

it_events TYPE TABLE OF slis_alv_event WITH NON-UNIQUE DEFAULT KEY

WITH HEADER LINE INITIAL SIZE 0,

FIELD_CAT TYPE SLIS_FIELDCAT_ALV.

**********************************************************************

  • TYPES DECLARATION ************************************

**********************************************************************

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS : CBOOKNO(16) TYPE n OBLIGATORY. "Customs Book number

SELECTION-SCREEN END OF BLOCK b1.

**********************************************************************

  • SELECT OPTION ****************************************

**********************************************************************

SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP 1.

SELECT-OPTIONS:

*----


Date

so_pertr for plaf-pertr,

*----


Material

so_matnr for plaf-matnr,

*----


Material Group

so_matkl for mara-matkl,

*----


Plant

so_plwrk for plaf-plwrk OBLIGATORY,

*----


Sales Order

so_kdauf for plaf-kdauf.

SELECTION-SCREEN : END OF BLOCK blk.

************************************************************************

  • SELECTION SCREEN VALIDATION. *

************************************************************************

*AT SELECTION-SCREEN ON SO_PERTR.

  • SELECT SINGLE * FROM PLAF

  • WHERE PERTR IN so_pertr.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ENDIF.

*

*AT SELECTION-SCREEN ON SO_MATNR.

  • IF SO_MATNR IS NOT INITIAL.

  • SELECT SINGLE * FROM PLAF

  • WHERE matnr IN SO_MATNR.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ELSE.

  • LOOP AT SCREEN.

  • IF SCREEN-GROUP1 = 'M02' .

  • SCREEN-REQUIRED = '1'.

*

  • MODIFY SCREEN .

  • ENDIF.

  • ENDLOOP.

  • ENDIF.

  • ENDIF.

*

*AT SELECTION-SCREEN ON SO_PLWRK.

  • IF SO_PLWRK IS NOT INITIAL.

  • SELECT SINGLE * FROM PLAF

  • WHERE PLWRK IN SO_PLWRK.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ELSE.

  • LOOP AT SCREEN.

  • IF SCREEN-GROUP1 = 'M02' .

  • SCREEN-REQUIRED = '1'.

*

  • MODIFY SCREEN .

  • ENDIF.

  • ENDLOOP.

  • ENDIF.

  • ENDIF.

*

*AT SELECTION-SCREEN ON so_kdauf.

  • IF so_kdauf IS NOT INITIAL.

  • SELECT SINGLE * FROM plaf

  • WHERE kdauf = so_kdauf.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ELSE.

  • LOOP AT SCREEN.

  • IF SCREEN-GROUP1 = 'M01'.

  • SCREEN-REQUIRED = '1'.

  • EXIT.

  • ENDIF.

  • ENDLOOP.

  • MODIFY SCREEN .

  • ENDIF.

  • ENDIF.

*

**AT SELECTION-SCREEN ON so_plwrk.

  • IF so_plwrk IS NOT INITIAL.

  • SELECT SINGLE * FROM PLAF

  • WHERE plwrk = so_plwrk.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ELSE.

  • LOOP AT SCREEN.

  • IF SCREEN-GROUP1 = 'M01'.

  • SCREEN-REQUIRED = '1'.

  • EXIT.

  • ENDIF.

  • ENDLOOP.

  • MODIFY SCREEN .

  • ENDIF.

  • ENDIF.

*

*

*AT SELECTION-SCREEN ON so_matkl.

  • IF so_matkl IS NOT INITIAL.

  • SELECT SINGLE * FROM MARA

  • WHERE MATKL = so_matkl.

  • IF sy-subrc NE 0.

  • MESSAGE w002(zproj).

  • ELSE.

  • LOOP AT SCREEN.

  • IF SCREEN-GROUP1 = 'M01'.

  • SCREEN-REQUIRED = '1'.

  • EXIT.

  • ENDIF.

  • ENDLOOP.

  • MODIFY SCREEN .

  • ENDIF.

  • ENDIF.

***********************************************************************

START-OF-SELECTION.

***********************************************************************

START-OF-SELECTION.

IF so_pertr IS NOT INITIAL.

FLAG = 1.

ENDIF.

IF SO_MATNR IS NOT INITIAL.

FLAG1 = 1.

ENDIF.

IF so_matkl IS NOT INITIAL.

FLAG2 = 1.

ENDIF.

IF so_plwrk IS NOT INITIAL.

FLAG3 = 1.

ENDIF.

IF so_kdauf IS NOT INITIAL.

FLAG4 = 1.

ENDIF.

SELECT

PERTR

PLNUM

MATNR

PLWRK

KDAUF

INTO CORRESPONDING FIELDS OF TABLE ITAB_PLAF

FROM PLAF.

  • WHERE pertr IN so_pertr.

SELECT

MATNR

MAKTX

FROM MAKT

INTO TABLE ITAB_MAKT.

  • FOR ALL ENTRIES IN ITAB_PLAF

  • WHERE MATNR = ITAB_PLAF-MATNR.

  • WHERE

  • MATNR EQ P_BUKRS AND

  • BELNR EQ ITAB_BKPF-BELNR AND

  • GJAHR EQ ITAB_BKPF-GJAHR

IF SY-SUBRC NE 0.

MESSAGE E000(ZPROJ).

ENDIF.

IF FLAG NE 0.

DELETE ITAB_PLAF WHERE

NOT ( pertr IN so_pertr )

.

ENDIF.

IF FLAG1 NE 0.

DELETE ITAB_PLAF WHERE

NOT ( MATNR IN so_matnr )

.

ENDIF.

IF FLAG3 NE 0.

DELETE ITAB_PLAF WHERE

NOT ( PLWRK IN SO_PLWRK )

.

ENDIF.

IF FLAG4 NE 0.

DELETE ITAB_PLAF WHERE

NOT ( KDAUF IN SO_KDAUF )

.

ENDIF.

IF FLAG2 NE 0.

DELETE ITAB_MAKT WHERE

NOT ( maktx IN so_matkl )

.

ENDIF.

LOOP AT ITAB_PLAF.

LOOP AT ITAB_MAKT

WHERE MATNR EQ ITAB_PLAF-MATNR.

MOVE-CORRESPONDING ITAB_MAKT TO ITAB_PLAF_MAKT.

  • MOVE-CORRESPONDING ITAB_BKPF TO ITAB_BKPF_BSEG.

APPEND ITAB_PLAF_MAKT.

ENDLOOP.

ENDLOOP.

LOOP AT ITAB_PLAF_MAKT.

ITAB_PLAF_MAKT-cbno = CBOOKNO.

MODIFY ITAB_PLAF_MAKT TRANSPORTING cbno.

ENDLOOP.

PERFORM CHANGE_CATALOG.

PERFORM ALV_DISPLAY.

FORM CHANGE_CATALOG.

DATA: L_POS TYPE I.

FIELD_CAT-COL_POS = L_POS.

L_POS = L_POS + 1.

CLEAR FIELD_CAT.

field_cat-SELTEXT_M = 'Planned Order Nos.'.

field_cat-tabname = ITAB_PLAF_MAKT.

field_cat-fieldname = 'PLNUM'.

append field_cat TO CT_FIELDCAT.

FIELD_CAT-COL_POS = L_POS.

L_POS = L_POS + 1.

CLEAR FIELD_CAT.

*field_cat-checkbox = 'X'.

field_cat-SELTEXT_M = 'Check Box'.

Field_Cat-outputlen = '1'.

field_cat-tabname = ITAB_PLAF_MAKT.

field_cat-checkbox = abap_true.

field_cat-edit = abap_true.

field_cat-fieldname = 'CHK'.

append field_cat TO CT_FIELDCAT.

FIELD_CAT-COL_POS = L_POS.

L_POS = L_POS + 1.

CLEAR FIELD_CAT.

field_cat-SELTEXT_M = 'Material'.

field_cat-tabname = ITAB_PLAF_MAKT.

field_cat-fieldname = 'MATNR'.

append field_cat TO CT_FIELDCAT.

FIELD_CAT-COL_POS = L_POS.

L_POS = L_POS + 1.

CLEAR FIELD_CAT.

field_cat-SELTEXT_M = 'Material Description'.

field_cat-tabname = ITAB_PLAF_MAKT.

field_cat-fieldname = 'MAKTX'.

append field_cat TO CT_FIELDCAT.

GS_LAYOUT-ZEBRA = 'X'.

*GS_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.

*data : text like slis_ev_subtotal_text value 'total'.

*gs_layout-subtotals_text = text.

*gs_layout-totals_only = 'X'.

  • gs_layout-subtotals_text = 'total'.

endform. " CHANGE_CATALOG

*********************event*************************************

&----


*& Form ALV_DISPLAY

&----


  • text

----


FORM ALV_DISPLAY.

data: LC_GLAY TYPE LVC_S_GLAY.

LC_GLAY-EDT_CLL_CB = 'X'.

gs_layout-colwidth_optimize = 'X'.

gs_layout-zebra = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = 'PLANNED ORDERS'

I_GRID_SETTINGS = LC_GLAY

IS_LAYOUT = GS_LAYOUT

IT_FIELDCAT = CT_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

I_SAVE = 'X'

  • IS_VARIANT =

IT_EVENTS = it_events[]

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ITAB_PLAF_MAKT

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "ALV_DISPLAY

FORM USER_COMMAND

USING UCOMM LIKE SY-UCOMM

SELFIELD TYPE SLIS_SELFIELD.

DATA wa LIKE LINE OF ITAB_PLAF_MAKT.

DATA itab LIKE TABLE OF ITAB_PLAF_MAKT WITH HEADER LINE.

CASE ucomm.

when 'BACK'

or 'CANC'

or 'EXIT'.

leave to screen 0.

WHEN '&SAVE'.

MODIFY zcdr_d FROM TABLE I_SAVE.

IF I_SAVE is initial.

MESSAGE 'Select Atleast one Check Box' TYPE 'E' .

ELSE.

*CONCATENATE 'Number ' V_PIFNO ' Genrated'

  • IF SY-SUBRC EQ 0.

MESSAGE S001(zcdr_d) WITH 'Number ' CBOOKNO ' Genrated'.

ENDIF.

ENDCASE.

ENDFORM.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'Z_PFSTAT'.

ENDFORM. "set_pf_status

FORM set_events USING it1_events TYPE slis_t_event.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IT_EVENTS

EXCEPTIONS

LIST_TYPE_WRONG = 1

OTHERS = 2.

CLEAR it1_events.

it_events-name = SLIS_EV_DATA_CHANGED.

it_events-form = 'DATA_CHANGED'.

APPEND it_events TO it_events.

ENDFORM.

*LVC_S_GLAY-EDT_CLL_CB = 'X'.

FORM DATA_CHANGED USING RR_DATA_CHANGED

TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.

*LOOP AT ITAB_PLAF_MAKT.

  • MODIFY ITAB_PLAF_MAKT TRANSPORTING cbno.

IF ITAB_PLAF_MAKT-sel EQ 'X'.

APPEND ITAB_PLAF_MAKT TO I_SAVE[].

ENDIF.

  • ENDLOOP.

ENDFORM.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 22, 2007 at 12:50 PM

    Hi,

    This error mainly occurs while populating the fieldcatalog i.e fields are wrongly populated. PLease chack your column Position no assignment.

    Another reason could be if you are using field symbols to assign data in the field catalog

    Add comment
    10|10000 characters needed characters exceeded