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 -Table conrol with wizard

Former Member
0 Likes
1,227

Dear Abpaers,

i want to create table control with wizard. I have one table ZDESIGN having foll. fields

NFDESIGN

DEPT

MACH_TYPE

CUST_NM

MATNR

MACH_NO

MAKTX

NETWORK_NO

QTY

MOD_CODE

STATUS

DVER

IMPL

PART_ST

RELBY

RELDT

CODE

Now I want to add many records at a time . Finally when i save these records it should create one number id for this . all above record should save with this number in code field. next time when i create new entry it should increment by 1.

But now when i enter 1 record and press enter, the record disappears or if chenge in code the same record appears in all lines.

Please help me out for this problem.

12 REPLIES 12
Read only

Former Member
0 Likes
1,177

Hi,

I hope we should create number range in SNRO t code to get default numbers when u enter item details.

you shd append the work area of the table control to the internal table if the values geting refreshed when u eneter the same . follow the code.

PROCESS AFTER INPUT.

LOOP AT G_TA_CONTROL_ITAB.

CHAIN.

FIELD ZSD_BIDDING-CHECKBOX.

FIELD ZSD_BIDDING-SNO.

FIELD ZSD_BIDDING-MATERIAL_CODE.

FIELD ZSD_BIDDING-MAT_DESC.

FIELD ZSD_BIDDING-QTY.

FIELD ZSD_BIDDING-UNIT.

FIELD ZSD_BIDDING-DISC.

FIELD ZSD_BIDDING-NET.

FIELD ZSD_BIDDING-WAERS.

MODULE TA_CONTROL_MODIFY ON CHAIN-REQUEST.

ENDCHAIN.

ENDLOOP.

MODULE ta_control_modify INPUT.

MOVE-CORRESPONDING zsd_bidding TO g_ta_control_wa.

MODIFY g_ta_control_itab

FROM g_ta_control_wa

INDEX ta_control-current_line.

IF sy-subrc NE 0.

APPEND g_ta_control_wa TO g_ta_control_itab.

CLEAR g_ta_control_wa.

ENDIF.

ENDMODULE.

Thanks

Rasheed

Read only

Former Member
0 Likes
1,177

Hi,

This is happening bcoz after PAI , PBO calld automatically and there is nothing defined there.

And again when you enter a new record the previous record that has ben there appended again.

You do one thing the internal table in which you have populated all the records , move all the data into the temporary internal table at the end of PAI Eg: if IT1 is your internal table and temp_It is your temporary internal table the write

Move-corresponding fields of IT1 to temp_IT.

Refresh IT1.

Now in the PBO of your screen write

Loop at temp_it.

Move-correponding fields from temp_it to IT1.

Append IT1.

Endloop.

Refresh temp_it.

It will solve your problem.

Regards

Mudit

Read only

0 Likes
1,177

Hi Mudit,

When i enter more records only 1st record is appeared after pressing the enter and also in db table 1st record is save.

in PAI i have written a code like this,

move-corresponding ZDESIGN to g_TAB_CONTROL_wa.

move-corresponding g_TAB_CONTROL_wa to g_TAB_CONTROL_ITAB.

APPEND g_TAB_CONTROL_ITAB.

Read only

0 Likes
1,177

hi Mudit,

after entering the records when i press enter all the records are saved in databse, but on screen on last record is displayed. What is wrong in my coding.

LOOP AT g_TAB_CONTROL_ITAB .

MOVE-CORRESPONDING g_TAB_CONTROL_itab TO zdesign.

INSERT ZDESIGN.

ENDLOOP.

REFRESH g_TAB_CONTROL_ITAB.

Please help me out.

Read only

0 Likes
1,177

Hi khushi,

Please see my code and do accordingly hope my code will sort ur problem as i also face the same issue.

Thanks

Rasheed

Read only

0 Likes
1,177

actually the events triggered in module-pool will be like

PBO -> PAI -> PBO .

as per ur concern i think you have to pass the same thing into screen fields in PBO also.

so that when u press enter it the entered values will appeares on the screen.

in PBO . inside module between loop-endloop. just write the move-corresponding statement.

i think it may help u .

Read only

Former Member
0 Likes
1,177

HI kushi,

Please understand the Module pool Program Flow.

in PAI the data from screen is transferred to program

in PBO the data is again flows back from program to screen.

so first.

what ever you enter in the screen to be taken back to program.

like this.

in PAI.

loop at itab.

module modify_tab_control.

endloop.

in module modify_tab_control.

module modify_tab_control.

describe table itab lines tc-lines.

if tc-current_line > tc-lines.

***means this is a new line which is not there in the program

append itab.

else.

***means a record is alreay there in the program

modify itab index tc-current line.

endmodule.

here try to use a number range object go to tcode SNRO where u can create a number range object,

then call the function module NUMBER_GET_NEXT and this will give a new number as we have seen for sale order or production order number creations.

hope this will serve your purpose.

Thanks and regards

Ramchander Rao.Krishnamraju

Read only

0 Likes
1,177

hi Ramchander,

As i mentioned earlier, when i insert 4 or 5 records and press enter, all these records are updated in database table but on screen only last record is displayed. i have given my coding above. Please check and tell me.

Thanks.

Read only

0 Likes
1,177

Hi Khushi,

as you are using REFRESH statement means all the values are getting refreshed then only new and latest value remains.

please remove the refresh statement.

hope this will work for you.

and more over please transfer all the rows from the screen table control to the program as i said earlier then check them thouroghly later update the values into the database table.

regards

Ramchander Rao.K

Read only

0 Likes
1,177

Hi Ramchnader,

If i remove REFRESH stmt, the last material number is displayed in all lines of material column.

Thanks

Read only

0 Likes
1,177

Hi Khushi,

if you are using the above code in the PAI.

then while transferring rows from screen to progarm you need to check as follows.

      • this is in PAI

loop at itab

module modify_itab.

endloop.

    • IN the program

module modify_itab.

describe table itab lines tc-lines.

      • the above code will give you number of rows.

now

if tc-current_row > tc-lines.

append itab.

else.

modify itab.

endif.

endmodule.

by doing so all the rows of itab will be transferred to the program.

write the corresponding code in PBO

loop at itab with control tc.

***this will take the rows from program to screen

endloop.

hope this will serve your purpse.

Regards

Ramchander Rao.K

Read only

Former Member
0 Likes
1,177

thanx