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

regarding development

Former Member
0 Likes
715

hi friends i have created one screen which is having 4 fields and also push button save. when i will save it is saving data.and also with this screen painter there is one table control also.so whenever i will save data from screen painter it has to be shown in table control also. i need that kind of coding which save the entry from screen painter and update in table control which is on same screen.

Internal table for scren painter is ITAB and Internal table to call data in table control is ITAB1.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
688

Hi,

when 'SAVE'.

move-corresponding itab to itab1.

Regards,

Sathish Reddy.

5 REPLIES 5
Read only

Former Member
0 Likes
689

Hi,

when 'SAVE'.

move-corresponding itab to itab1.

Regards,

Sathish Reddy.

Read only

Former Member
0 Likes
688

Hi Kartik,

You ABAP internal table and Screen Painter Internal tables are different. So you have to write 2 modules. One in PBO and one in PAI. There you have to do a move corresponding between the structures. And then either a modify or append based on the logic.

If your ABAP internal table and Dynpro table name were same, then this automatic transfer would have happened.

Here is the code snippet:

PBO.

Module transfer_ITAB_to_ITAB1.

PAI.

Module transfer_ITAB1_to_ITAB.

Module transfer_ITAB_to_ITAB1.

move-corresponding between ITAB to ITAB1.

End module.

Module transfer_ITAB1_to_ITAB.

move-corresponding between ITAB1 to ITAB.

End module.

Here is demo code which will give you some more idea.

DEMO_DYNPRO_TABCONT_LOOP

DEMO_DYNPRO_TABCONT_LOOP_AT

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2.

Thanks,

Samantak.

Read only

0 Likes
688

SEE MY CODING GURU

&----


*& Include ZPRATE_IT1

&----


TABLES : zprate.

DATA : BEGIN OF it_prate,

SEL(1),

bukrs type zprate-bukrs,

zterm type zprate-zterm,

land1 type zprate-land1,

prate type zprate-prate,

END OF it_prate.

DATA : itab LIKE it_prate occurs 0 with header line,

itab1 LIKE it_prate occurs 0 with header line.

CONTROLS : tabc TYPE TABLEVIEW USING SCREEN '0100'.

&----


*& Include ZPRATE_IT2

&----


SELECT BUKRS ZTERM LAND1 PRATE FROM ZPRATE INTO CORRESPONDING FIELDS OF TABLE ITAB.

SELECT BUKRS ZTERM LAND1 PRATE FROM ZPRATE INTO CORRESPONDING FIELDS OF TABLE ITAB1.

*&----


**& Module STATUS_0100 OUTPUT

*&----


    • text

*----


module STATUS_0100 output.

SET PF-STATUS 'AK'.

  • SET TITLEBAR 'xxx'.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE program.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'CANCEL'.

LEAVE TO SCREEN 0.

*when 'refresh'.

*move-corresponding itab to itab1.

WHEN 'SAVE'.

Zprate-bukrs = ITAB-bukrs.

ZPrate-Zterm = ITAB-zterm.

zprate-land1 = itab-land1.

zprate-prate = itab-prate.

INSERT zprate.

IF SY-SUBRC EQ 0.

MESSAGE 'SAVED SUCCEESSFULLY' TYPE 'I'.

ENDIF.

WHEN 'DELETE'.

LOOP AT ITAB1 WHERE SEL = 'X'.

SELECT SINGLE * FROM ZPRATE

WHERE BUKRS = ITAB1-BUKRS

AND ZTERM = ITAB1-ZTERM

AND LAND1 = ITAB1-LAND1

AND PRATE = ITAB1-PRATE.

IF SY-SUBRC EQ 0.

DELETE ZPRATE.

MESSAGE 'DELETED SUCCEESSFULLY' TYPE 'I'.

ENDIF.

delete itab1.

ENDLOOP.

ENDCASE.

endmodule. " USER_COMMAND_0100 INPUT

&----


*& Module TABC_MODIFY INPUT

&----


  • text

----


module TABC_MODIFY input.

modify iTAB1 index TABC-current_line.

endmodule. " TABC_MODIFY INPUT

AND IN SCREEN PAINTER

process before output.

MODULE STATUS_0100.

LOOP AT ITAB1 WITH CONTROL TABC.

ENDLOOP.

process after input.

LOOP AT ITAB1.

CHAIN.

FIELD itab1-bukrs.

FIELD itab1-zterm.

FIELD itab1-land1.

FIELD itab1-prate.

FIELD ITAB1-SEL.

MODULE TABC_MODIFY ON CHAIN-REQUEST.

ENDCHAIN.

MODULE USER_COMMAND_0100.

ENDLOOP.

SO WHEN I PRESS SAVE FROM SCREEN PAINTER MESSAGE DISPLAY AND AFTER THAT WHATEVER DATA I HAVE SAVED IT HAS TO BE DISPLAY IN TABLE CONTROL

WHICH IS ON SAME SCREEN

Read only

0 Likes
688

Hi Karthik,

Do the following steps

1.add one more

data : rec type i.

2.

In PBO write module

module initial_data.

In the module write the logic,

module initial_data outpu.

SELECT BUKRS ZTERM LAND1 PRATE FROM ZPRATE INTO CORRESPONDING FIELDS OF TABLE ITAB1.

describe table itab1 lines rec.

endmodule.

3.

In PBO, add madule in the loop

LOOP AT ITAB1 WITH CONTROL TABC.

module READ_TABLE_ITAB1.

ENDLOOP.

In this module write the following code,

module READ_TABLE_ITAB1 output.

read table itab1 index tabc-current_line.

endmodule.

4. In PAI,in loop add mdule

LOOP At ITAB1.

module modify_itab1.

endloop.

In this module add code,

module modify_itab1 input.

modify itab1.

endmodule.

This will definetely helps.

award the points........

regards,

mahantesh

Read only

Former Member
0 Likes
688

Hi,

In the PBO write module

module read_data .

loop at itab1 with tab_control.

module read_tab.

endloop.

in this module, read_data write code ,

select data from the database table in to the internal table itab.

in the module read_tab,

just write

modify itab1 from itab with tab_control-current_line.

assign if it helps...

regards,

mahantesh