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: 

Updationg of ztables in module pool programming

Former Member
0 Kudos
146

I have to update ztables.... When I tried doing only last records is getting updated and not the entire ones...

please help me

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

  • LOOP AT zasset. " into wa_zasset.

module put_data.

  • endloop.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

  • LOOP AT it_zasset . "into wa_zasset.

MODULE GET_DATA.

  • ENDLOOP.

MODULE EXIT AT EXIT-COMMAND.

PROGRAM ZASSET .

tables: anla,zasset.

data: begin of it_zasset occurs 0 , " with header line ,

  • bukrs like anla-bukrs,

anln1 like anla-anln1,

anln2 like anla-anln2,

end of IT_zasset.

data: v_lines type i.

*data: it_zasset type standard table of ty_zasset with header line.

*data: wa_zasset type ty_zasset .

*

&----


*& Module put_data OUTPUT

&----


  • text

----


MODULE put_data OUTPUT.

move it_zasset-anln1 to zasset-anln1.

move it_zasset-anln2 to zasset-anln2.

*DESCRIBE TABLE IT_ZASSET LINES v_lines.

*modify zasset . "from it_zasset.

*update zasset.

*clear it_zasset.

  • DESCRIBE TABLE it_zasset . "LINES TC_CONTROL-LINES.

ENDMODULE. " put_data OUTPUT

&----


*& Module GET_DATA INPUT

&----


  • text

----


MODULE GET_DATA INPUT.

*move zasset-anln1 to wa_zasset-anln1.

*move zasset-anln2 to wa_zasset-anln2.

move zasset-anln1 to it_Zasset-anln1.

modify it_zasset index sy-tabix.

  • MODIFY it_zasset from wa_zasset INDEX SY-TABIX. " INDEX

*update zasset . "t_zasset from wa_zasset.

ENDMODULE. " GET_DATA INPUT

&----


*& Module EXIT INPUT

&----


  • text

----


MODULE EXIT INPUT.

case sy-ucomm.

when 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " EXIT INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

*clear: it_zasset.

*refresh: it_zasset.

CASE SY-UCOMM.

  • WHEN 'INSERT'.

  • LOOP AT it_zasset into wa_zasset .

  • modify it_zasset from wa_zasset..

    • INSERT INITIAL LINE INTO it_zasset INDEX SY-TABIX.

    • TC_CONTROL-LINES = TC_CONTROL-LINES + 1.

  • ENDLOOP.

*when 'APPEND'.

  • APPEND INITIAL LINE TO TSPFLI.

  • CLEAR SY-UCOMM.

WHEN 'SAVE'.

if it_zasset = ''.

insert from it_zasset into Zasset values.

else.

modify zasset.

endif.

  • refresh it_zasset.

  • clear it_zasset.

  • clear wa_zasset.

  • LOOP AT it_zasset .

  • move it_zasset-anln1 to zasset-anln1.

move it_zasset-anln1 to zasset-anln1.

modify zasset . "index sy-tabix..

*endloop.

*MOVE ZASSET-ANLN2 TO WA_ZASSET-ANLN2.

*it_zasset-anln1 = wa_zasset-anln1.

*IT_zASSET-ANLN2 = WA_ZASSET-ANLN2.

*append wa_zasset to it_zasset.

*modify it_zasset from wa_zasset index sy-tabix..

*commit work.

*endloop.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


  • & Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

*data: v_lines type i.

SET PF-STATUS 'ASSET'.

SET TITLEBAR 'UPDATING ZASSET TABLE'.

*IF SY-TFILL IS INITIAL.

  • SELECT

    • bukrs

  • anln1

  • anln2

  • FROM anla

  • INTO TABLE it_zasset.

describe table it_zasset lines v_lines.

*ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

1 ACCEPTED SOLUTION

Former Member
0 Kudos
118

HI,

see the bellow coding...

MODULE MODIFY_IPACKING INPUT.

MODIFY IPACKING INDEX TABLE-CURRENT_LINE.

ENDMODULE. " MODIFY_IPACKING INPUT

8 REPLIES 8

Former Member
0 Kudos
119

HI,

see the bellow coding...

MODULE MODIFY_IPACKING INPUT.

MODIFY IPACKING INDEX TABLE-CURRENT_LINE.

ENDMODULE. " MODIFY_IPACKING INPUT

Former Member
0 Kudos
118

Hi Jaya,

I guess you have to LOOP AT it_zasset when you are Inserting Values from it_zasset into zasset. Please check your code when CASE is SAVE.

Debug the code and check the entires of the it_zasset and zasset tables...

Regards,

Sai

Former Member
0 Kudos
118

in this module

MODULE GET_DATA INPUT.

*move zasset-anln1 to wa_zasset-anln1.

*move zasset-anln2 to wa_zasset-anln2.

move zasset-anln1 to it_Zasset-anln1.

modify it_zasset index sy-tabix.

MODIFY it_zasset from wa_zasset INDEX SY-TABIX. " INDEX

Add this

if sy-subrc ne 0.

insert it_zasset from wa_zasset.

endif.

*update zasset . "t_zasset from wa_zasset.

ENDMODULE. " GET_DATA INPUT

krishnendu_laha
Active Contributor
0 Kudos
118

Hi Friend,

Please write this piece of code at the time of modifying:

Modify ZASSET from table IT_ZASSET

IT_ZASSET should be the same structure as ZASSET.

Regards

Krishnendu

0 Kudos
118

tHANKSA lot ... When I tried this I am getting the work area it_zasset is not long enough.... can you suggest me

Former Member
0 Kudos
118

Hi try this code...

PROGRAM ZASSET .

tables: anla,zasset.

data: begin of it_zasset occurs 0 , " with header line ,

u2022 bukrs like anla-bukrs,

anln1 like anla-anln1,

anln2 like anla-anln2,

end of IT_zasset.

data: v_lines type i.

*******************SCREEN FLOW LOGIC***************

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

u2022 LOOP AT it_zasset. " into wa_zasset.

module put_data.

u2022 endloop.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

u2022 LOOP AT it_zasset . "into wa_zasset.

MODULE GET_DATA.

u2022 ENDLOOP.

MODULE EXIT AT EXIT-COMMAND.

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

&----


*& Module put_data OUTPUT

&----


u2022 text

-


MODULE put_data OUTPUT.

move it_zasset-anln1 to zasset-anln1.

move it_zasset-anln2 to zasset-anln2.

ENDMODULE. " put_data OUTPUT

&----


*& Module GET_DATA INPUT

&----


u2022 text

-


MODULE GET_DATA INPUT.

move zasset-anln1 to it_zasset-anln1.

move zasset-anln2 to it_zasset-anln2.

modify it_zasset index sy-tabix.

ENDMODULE. " GET_DATA INPUT

&----


*& Module EXIT INPUT

&----


u2022 text

-


MODULE EXIT INPUT.

case sy-ucomm.

when 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " EXIT INPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


u2022 text

-


MODULE USER_COMMAND_0100 INPUT.

*clear: it_zasset.

*refresh: it_zasset.

CASE SY-UCOMM.

u2022 WHEN 'INSERT'.

u2022 LOOP AT it_zasset.

u2022 modify it_zasset from wa_zasset.

o INSERT INITIAL LINE INTO it_zasset INDEX SY-TABIX.

o TC_CONTROL-LINES = TC_CONTROL-LINES + 1.

u2022 ENDLOOP.

*when 'APPEND'.

u2022 APPEND INITIAL LINE TO TSPFLI.

u2022 CLEAR SY-UCOMM.

WHEN 'SAVE'.

if NOT it_zasset IS INITIAL.

insert zasset from table it_zasset.

ENDIF.

u2022 refresh it_zasset.

u2022 clear it_zasset.

u2022 clear wa_zasset.

u2022 LOOP AT it_zasset .

u2022 move it_zasset-anln1 to zasset-anln1.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


u2022 & Module STATUS_0100 OUTPUT

&----


u2022 text

-


MODULE STATUS_0100 OUTPUT.

*data: v_lines type i.

SET PF-STATUS 'ASSET'.

SET TITLEBAR 'UPDATING ZASSET TABLE'.

IF it_zasset[] IS INITIAL.

u2022 SELECT

o bukrs

u2022 anln1

u2022 anln2

u2022 FROM anla

u2022 INTO CORRESPONDING FIELDS OF TABLE it_zasset.

describe table it_zasset lines v_lines.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

0 Kudos
118

Hi,

I tried with the ciode which you specified...

but it says that

the work area it_zasset is not long enough...

Can you please let me know

0 Kudos
118

Hi Friend,

Please check the internal table type is same like Ztable.

Regards

Krishnendu