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

module pool programming

Former Member
0 Likes
1,204

hi, i am in assignment as a fresher, in that i need to code for module pool programing with table controls.

I am getting no errors, and getting the scrren after using trasaction code what the thing , if i try to insert any data, its giving not inserted message.i am sending the code can any one help me.

----


***INCLUDE ZSAINPUTSCREEN_USER_COMMANDI01 .

----


&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


TABLES: ZSAORDERS.

DATA: IT_ITAB LIKE ZSAORDERS OCCURS 0 WITH HEADER LINE.

CONTROLS: VCONTROL TYPE TABLEVIEW USING SCREEN '100'.

module USER_COMMAND_0100 input.

CASE SY-UCOMM.

WHEN 'INSERT'.

MOVE ZSAORDERS TO IT_ITAB. " SCREEN FIELDS TO WORKAREA

APPEND IT_ITAB. " WORK AREA TO BODY.

INSERT INTO ZSAORDERS VALUES IT_ITAB. " INTO DATA BASE.

IF SY-SUBRC = 0.

MESSAGE I000(0) WITH 'INSERTED'.

ELSE.

MESSAGE I000(0) WITH 'NOT INSERTED'.

ENDIF.

WHEN 'UPDATE'.

MOVE ZSAORDERS TO IT_ITAB.

APPEND IT_ITAB.

UPDATE ZSAORDERS FROM TABLE IT_ITAB.

IF SY-SUBRC = 0.

MESSAGE I000(0) WITH 'INSERTED'.

ELSE.

MESSAGE I000(0) WITH 'NOT INSERTED'.

ENDIF.

ENDCASE.

endmodule. " USER_COMMAND_0100 INPUT

-


PROCESS BEFORE OUTPUT.

LOOP AT IT_ITAB WITH CONTROL VCONTROL.

MODULE STATUS_0100.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

LOOP AT IT_ITAB.

ENDLOOP .

MODULE USER_EXIT.

-


----


***INCLUDE ZSAINPUTSCREEN_STATUS_0100O01 .

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module STATUS_0100 output.

MOVE-CORRESPONDING IT_ITAB TO ZSAORDERS.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

endmodule. " STATUS_0100 OUTPUT

-


thanks in advance.

sarath

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,167

The message might be displayed on the status bar at the bottom of your screen.

Jsut to make sure, repeat the MESSAGE statement one more time and you should be able to see a popup..

regards,

Ravi

12 REPLIES 12
Read only

Former Member
0 Likes
1,168

The message might be displayed on the status bar at the bottom of your screen.

Jsut to make sure, repeat the MESSAGE statement one more time and you should be able to see a popup..

regards,

Ravi

Read only

0 Likes
1,167

thanks for u r replay

i am not able to insert the data.

giving message like not inserted.

is coding is write or wrong

Read only

0 Likes
1,167

Then you might be trying to insert a duplicate key in the table. Just make sure that the data you are not inserting duplicates. Check the table once for existing data.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

0 Likes
1,167

Hi,

try using INSERT ZSAORDERS FROM TABLE IT_ITAB.

instead of INSERT INTO ZSAORDERS VALUES IT_ITAB.

Read only

0 Likes
1,167

its giving error,

i had given data which is not there in the data base then also its giving same msg

Read only

0 Likes
1,167

Hi Sarath,

Chk the SY-SUBRC check for UPDATE , may be one of ur lines of ITAB does not match with the primary key of Database table

SY-SUBRC = 0:

All lines from itab could be used to update the database table.

SY-SUBRC = 4:

At least one line of the internal table itab in the database table had no line with the same primary key. The other lines of the database table were updated.

Read only

Former Member
0 Likes
1,167

Hi,

declares these things in the top incklude . I don't how you are able to activate with declaring then in the module.

TABLES: ZSAORDERS.

DATA: IT_ITAB LIKE ZSAORDERS OCCURS 0 WITH HEADER LINE.

CONTROLS: VCONTROL TYPE TABLEVIEW USING SCREEN '100'.

go to debug and see whether you have data

change insert to modify

WHEN 'INSERT'.

MOVE ZSAORDERS TO IT_ITAB. " SCREEN FIELDS TO WORKAREA

APPEND IT_ITAB. " WORK AREA TO BODY.

modify ZSAORDERS from table IT_ITAB. " INTO DATA BASE.

IF SY-SUBRC = 0.

MESSAGE I000(0) WITH 'INSERTED'.

ELSE.

MESSAGE I000(0) WITH 'NOT INSERTED'.

ENDIF.

Hope this helps

Thanks

Read only

0 Likes
1,167

HI

ITS SHOWING AS INSERTED BUT DATA IS NOT THERE IN DATA BASE.

Read only

0 Likes
1,167

Hi sarath,

if you use the insert command and if the record with the same primary values already exist in the data it cannot insert.

so try using modify

Thanks

Read only

Former Member
0 Likes
1,167
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
LOOP AT IT_ITAB.
ENDLOOP .

can u just make this user command place after the endloop. like this and in debugging just chk the entries putting a breakpoint.

PROCESS AFTER INPUT.

LOOP AT IT_ITAB.
ENDLOOP .

MODULE USER_COMMAND_0100.

"over here

i cant make from the code but see if the user command triggering with the data .

regards,

vijay

Read only

ferry_lianto
Active Contributor
0 Likes
1,167

Hi Sarath,

Please check demo DEMO_DYNPRO_TABCONT_LOOP_AT perhaps it may help.

To insert to custom table from table control, you can do something like this.


...

WHEN 'INSERT'.
  READ TABLE TC-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
  IF SY-SUBRC = 0.
    LOOP AT I_BINLOC INTO ZMBINLOC WHERE ZMARK = 'X'.
      CLEAR ZMBINLOC.
      INSERT ZMBINLOC INTO I_BINLOC INDEX SY-TABIX.
    ENDLOOP.
    DESCRIBE TABLE I_BINLOC LINES TC-LINES.
  ENDIF.
...

Hope this will help.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,167

thanks to each and every one.

i will check my DB table and coding

sarath