Application Development and Automation 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: 
Read only

Modify keyword Error

Former Member
0 Likes
2,213

I have created a Table Control and from the table control I have moved the data to an internal table and by using Modify keyword I am trying to update a Custom table.. But I don't know why it is throwing Syntax error for the following syntax.

MODIFY zsd_epermit FROM TABLE gt_upd.

Field "TABLE" is unknown. It is neither in one of the specified tables

nor defined by a "DATA" statement. .

Please guide me why it is throwing this error

14 REPLIES 14
Read only

Former Member
0 Likes
2,179

All code, please!!

Read only

0 Likes
2,179

This is example:

PROCESS BEFORE OUTPUT.

  LOOP AT gt_itab1 WITH CONTROL tabcontrol.

    MODULE display_data.

  ENDLOOP.

PROCESS AFTER INPUT.

  MODULE clear_internal_table.

  LOOP AT gt_itab1.

    MODULE read_data.

  ENDLOOP.

MODULEclear_internal_table INPUT.

   clear gt_itab1[].

   clear gt_itab1.

ENDMODULE.

MODULE read_data INPUT.

if sy-ucomm eq 'ENTER'.  "Set the function code for ENTER as I mentioned in my previous post

   "Populate your internal table

endif.

ENDMODULE.

MODULE display_data OUTPUT.

   if sy-ucomm eq 'ENTER'.

     "Populate the table control with data in the internal table

  endif.

ENDMODULE.

Read only

0 Likes
2,179

Dear Bozhuk,

Here is the entire code.

I have tried many things but nothing helped I guess there's something with the screen, when ever I try to check the checkbox "From Dictionary" I am not able to modify the Local internal table in the Prog hence I unchecked it as shown below. Is this a problem.

And BTW here is the entire code as you requested..(Tried many things nothing helped)

DATA : ysd_epermit TYPE STANDARD TABLE OF ysd_epermit WITH HEADER LINE.

DATA : tc_epermit TYPE ysd_epermit." OCCURS 0 WITH HEADER LINE.

DATA : gs_upd TYPE ysd_epermit,

       gt_upd TYPE STANDARD TABLE OF ysd_epermit.

CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.

DATA : ln TYPE i, "No. of records

       fetch.

DATA : lv_pdate TYPE vbrk-erdat.

TYPES : BEGIN OF ty_erdat,

        erdat TYPE vbrk-erdat,

        END OF ty_erdat.

DATA : gt_vbeln TYPE STANDARD TABLE OF ysd_epermit.

DATA : gs_erdat TYPE ty_erdat.

DATA : itemp TYPE STANDARD TABLE OF ysd_epermit.

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

PARAMETERS : pr_dlr TYPE ysd_epermit-kunag.

SELECTION-SCREEN END OF BLOCK b1.

CALL SCREEN '9000'.

*&---------------------------------------------------------------------*

*&      Module  STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE status_9000 OUTPUT.

  SET PF-STATUS 'STAT'.

*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  GET_T_CTRL_LINES  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE get_t_ctrl_lines OUTPUT.

  IF fetch NE 'X'.

    SELECT SINGLE MAX( erdat )

           FROM vbrk INTO gs_erdat WHERE kunag = pr_dlr.

    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

      EXPORTING

        date      = gs_erdat-erdat

        days      = '4'

        months    = '00'

        signum    = '-'

        years     = '00'

      IMPORTING

        calc_date = lv_pdate.

    SELECT vbeln FROM vbrk INTO CORRESPONDING FIELDS OF TABLE gt_vbeln WHERE kunag = pr_dlr

      AND erdat BETWEEN lv_pdate AND gs_erdat-erdat.

    SELECT * FROM ysd_epermit INTO TABLE itemp.

    FIELD-SYMBOLS : <gs_vbeln> TYPE ysd_epermit,

                    <itemp>    TYPE ysd_epermit.

    LOOP AT gt_vbeln ASSIGNING <gs_vbeln>.

      READ TABLE itemp ASSIGNING <itemp> WITH KEY kunag = pr_dlr vbeln = <gs_vbeln>-vbeln.

      IF sy-subrc = 0.

        CLEAR <gs_vbeln>.

        MODIFY ysd_epermit FROM <gs_vbeln>.

      ELSE.

        IF <itemp> IS ASSIGNED.

          <itemp>-vbeln = <gs_vbeln>-vbeln.

          INSERT into ysd_epermit  values <itemp>.

        ENDIF.

      ENDIF.

    ENDLOOP.

    SELECT * FROM ysd_epermit INTO TABLE ysd_epermit." WHERE kunag = pr_dlr.

  ENDIF.

  DESCRIBE TABLE ysd_epermit LINES ln.

*   To make the vertical scroll bar to come on runtime

  t_ctrl-lines = ln + 1.

ENDMODULE.                 " GET_T_CTRL_LINES  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  SCREEN_FIELDS  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE screen_fields OUTPUT.

  LOOP AT SCREEN.

    IF  ( ( screen-name = 'YSD_EPERMIT-WEIGHT'

         OR screen-name = 'YSD_EPERMIT-FLAG' ) AND  t_ctrl-current_line GT ln ).

      screen-input = 0.

      MODIFY SCREEN.

    ENDIF.

  ENDLOOP.

ENDMODULE.                 " SCREEN_FIELDS  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  AFTER_INPUT_9000  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE after_input_9000 INPUT.

  CASE sy-ucomm.

    WHEN '&F03'.

      LEAVE TO SCREEN 0.

    WHEN 'SAVE'.

      fetch = 'X'.

      BREAK-POINT.

      LOOP AT ysd_epermit INTO tc_epermit.

*        MODIFY ysd_epermit FROM tc_epermit." TRANSPORTING

*        trns_consignment

*        transporter_name

*        vehicle_no

*        e1_field_val

*        e2_field_val

*        e3_field_val

*        e1_field_name

*        e2_field_name

*        e3_field_name.

        gs_upd-kunag                 =     tc_epermit-kunag.

        gs_upd-trns_consignment      =     tc_epermit-trns_consignment.

        gs_upd-vbeln                 =     tc_epermit-vbeln.

        gs_upd-transporter_name      =     tc_epermit-transporter_name.

        gs_upd-vehicle_no            =     tc_epermit-vehicle_no.

        gs_upd-weight                =     tc_epermit-weight.

        gs_upd-e1_field_name         =     tc_epermit-e1_field_name.

        gs_upd-e1_field_val          =     tc_epermit-e1_field_val.

        gs_upd-e2_field_name         =     tc_epermit-e2_field_name.

        gs_upd-e2_field_val          =     tc_epermit-e2_field_val.

        gs_upd-e3_field_name         =     tc_epermit-e3_field_name.

        gs_upd-e3_field_val          =     tc_epermit-e3_field_val.

        gs_upd-pick                  =     tc_epermit-pick.

        gs_upd-flag                  =     tc_epermit-flag.

        APPEND gs_upd TO gt_upd.

        CLEAR gs_upd.

*        IF sy-subrc = 0.

*          MESSAGE s899(v1) WITH 'Successfully Updated'.

*        ENDIF.

        CLEAR tc_epermit.

      ENDLOOP.

MODIFY ysd_epermit FROM TABLE gt_upd.

  ENDCASE.

ENDMODULE.                 " AFTER_INPUT_9000  INPUT

*&---------------------------------------------------------------------*

*&      Module  AT_EXIT  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE at_exit INPUT.

  CASE sy-ucomm.

    WHEN '&F15' OR '&F12'.

      LEAVE PROGRAM.

  ENDCASE.

ENDMODULE.                 " AT_EXIT  INPUT

*&---------------------------------------------------------------------*

*&      Module  CHECK1  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE check1 INPUT.

  MODIFY ysd_epermit INDEX t_ctrl-current_line.

ENDMODULE.                 " CHECK1  INPUT

*&---------------------------------------------------------------------*

*&      Module  CHECK2  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE check2 INPUT.

  MODIFY ysd_epermit INDEX t_ctrl-current_line TRANSPORTING

  trns_consignment

  transporter_name

  vehicle_no

  e1_field_val

  e2_field_val

  e3_field_val

  e1_field_name

  e2_field_name

  e3_field_name.

ENDMODULE.                 " CHECK2  INPUT

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

*** Screen Flow Logic ************************************************************************************************************************************************

PROCESS BEFORE OUTPUT.

  MODULE status_9000.

  MODULE get_t_ctrl_lines.

  LOOP AT ysd_epermit WITH CONTROL t_ctrl CURSOR

  t_ctrl-current_line.

*     Dynamic screen modifications

    MODULE screen_fields.

  ENDLOOP.

PROCESS AFTER INPUT.

  CHAIN.

    FIELD ysd_epermit-trns_consignment.

    FIELD ysd_epermit-transporter_name.

    FIELD ysd_epermit-vehicle_no .

    FIELD ysd_epermit-e1_field_val.

    FIELD ysd_epermit-e2_field_val.

    FIELD ysd_epermit-e3_field_val.

    FIELD ysd_epermit-e1_field_name.

    FIELD ysd_epermit-e2_field_name.

    FIELD ysd_epermit-e3_field_name.

    FIELD ysd_epermit-kunag.

    MODULE check2.

  ENDCHAIN.

  LOOP AT ysd_epermit.

    CHAIN.

      FIELD ysd_epermit-vbeln.

      FIELD ysd_epermit-weight.

      FIELD ysd_epermit-flag.

      MODULE check1 ON CHAIN-REQUEST.

    ENDCHAIN.

  ENDLOOP.

  MODULE after_input_9000.

  MODULE at_exit AT EXIT-COMMAND.

Read only

0 Likes
2,179

Hi Hari ,

What you have done is here :

First line of code : you have defined a internal table with name ysd_epermit

DATA : ysd_epermit TYPE STANDARD TABLE OF ysd_epermit WITH HEADER LINE.


Now , what you are trying : you want to modify the internal table with another internal table


MODIFY ysd_epermit FROM TABLE gt_upd.


Be clear with the logic...................

You will get the solution


Regards,


Yogendra Bhaskar

Read only

0 Likes
2,179

No I have declared YSD_EPERMIT as Internal table and also the Database table isYSD_EPERMIT.


MODIFY ysd_epermit FROM TABLE gt_upd. " This is supposed to update the DB table.

So are U suggesting to change the Internal table name to something else?

Read only

0 Likes
2,179

Hi hari ,

Yes , I am suggesting you to change the name of the internal table.

ysd_epermit is being treated as a internal table rather than the database table.


Regards


Yogendra Bhaskar

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
2,179

Hello Hari.

     gt_upd is your internal table,right?

Regards.

Read only

0 Likes
2,179

Yes, Please find the entire code above ^

Thank you.

Read only

Former Member
0 Likes
2,179

Hi Hari,

In the complete code that you have given, you are modifying the internal table i think as the statement is

MODIFY ysd_epermit FROM TABLE gt_upd.

But in the original question it is with reference to zsd_epermit. Please clarify on this.

Regards,

AyyamPerumal

Read only

0 Likes
2,179

Hi Hari,

Check the database table exist in Db or not you check and also you check the internal table type is same as DB table then it will work.

Sample Code below it is working fine

  IF LT_FINAL IS NOT INITIAL.
    MODIFY ZSECOND_BILLCNT FROM TABLE LT_FINAL.
    COMMIT WORK AND WAIT.

endif.

Read only

0 Likes
2,179

Hi Hari,

As per your complete code the Ztable name is ysd_epermit but in the modify statment you have mentioned different Ztable name as zsd_epermit.

Please use below modify statement.

MODIFY ysd_epermit FROM TABLE gt_upd.

Thanks & Regards,

Bala G

Read only

0 Likes
2,179

Sorry for confusion.. it is ysd_epermit.

Please refer the Prog only.

Thank you for your help and sorry for the confusion.

Read only

0 Likes
2,179

Hi Hari,

Yes...   If query resolved,i request you to please close the thread.

Thanks & Regards,

Bala G

Read only

Former Member
0 Likes
2,179

move record in structure then write

MODIFY YSD_EPERMIT FROM WA.