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: 

Dear Abapers..

Former Member
0 Kudos

Hi all,

Here iam having 2 tables ZESTHEADER &ZESTDETAILS(Items table) i have to create a modulepool to display these tables data in the same screen .the primary key is EstmNR . When i enter the EstmNR system should fecth and display the data from the both tables based on screen filed ZESTHEADER -EstmNR .

Please send me suggestions

thanks in advance

krishna

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

In the PAI module give as follows :

FIELD ZESTHEADER -EstmNR MODULE MOD1 ON INPUT .

In the MOD1 fetch the datas from ZESTHEADER &ZESTDETAILS tables using 2 select queries .

Hope it is helpful for u .

Regards ,

Senthil

10 REPLIES 10

Former Member
0 Kudos

Declare an Internal table where you fetch data from both these tables.

Declare a table control on your screen.

Your Table Control should be linked to the fields of the corresponding Internal table, You can lock those fields which you want on your table.

As your internal table gets populated , the fields on the screen also get poplutaed.

Try it. Refer back if you have doubts.

Rewards in terms of points expected.

Former Member
0 Kudos

Hi ,

In the PAI module give as follows :

FIELD ZESTHEADER -EstmNR MODULE MOD1 ON INPUT .

In the MOD1 fetch the datas from ZESTHEADER &ZESTDETAILS tables using 2 select queries .

Hope it is helpful for u .

Regards ,

Senthil

0 Kudos

Hi senthil can you please explain it clearly i have not got ur point clearly

0 Kudos

Hi senthil Please review the code below and mention where iam going wrong. iam Still iam not getting the output. Please help me out

screen painter code for screen '100'.

PROCESS BEFORE OUTPUT.

loop at itab1 with control VCONTROL.

MODULE STATUS_0100.

endloop.

PROCESS AFTER INPUT.

loop at itab1.

MODULE USER_COMMAND_0100.

endloop.

module user_exit.

the code for PAI & PBO

&----


*& Module Pool ZEST_HEADER

*&

&----


*&

*&

&----


PROGRAM ZEST_HEADER3.

tables:ZESTHEADER,zestdetails.

controls: vcontrol type tableview using screen '100'.

*internal table declaration

data: begin of itab occurs 0.

include STRUCTURE ZESTheader.

data: end of itab.

data: begin of itab1 occurs 0.

include STRUCTURE ZESTDETAILS.

data: end of itab1.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'DISP'.

refresh itab.

select ESTMATE_NBR VERSION ESTIMATE_DT TOT_AMT CUST_ID CUST_ADDR_NBR WBS_ELEMENT ESTIMATE_STATUS USER_FLD1 USER_FLD2 APPROVAL_STATUS LASTUPDATE_DTM LASTUPDATE_USRID from zestheader into itab where ESTMATE_NBR = zestheader-ESTMATE_NBR.

append itab.

endselect.

refresh itab1.

select LINE_NO LINE_STATUS SALES_MATNR UOM QTY UNIT_PRICE AMOUNT PRICE_TYPE COMMENTS from ZESTDETAILS into itab1 for all entries in itab where ESTMATE_NBR = itab-ESTMATE_NBR.

append itab1.

  • break-point.

endselect.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form selections

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

set pf-status 'ZEST'.

SET TITLEBAR 'TITLE'.

move-corresponding itab to zestHEADER.

MOVE-CORRESPONDING ITAB1 TO ZESTDETAILS.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module user_exit INPUT

&----


  • text

----


MODULE user_exit INPUT.

case sy-ucomm.

when 'EXIT'.

leave to screen 0.

endcase.

ENDMODULE. " user_exit INPUT

0 Kudos

***PBO

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

LOOP AT ITAB_F

WITH CONTROL ZTAB_CTRL

CURSOR ZTAB_CTRL-CURRENT_LINE.

MODULE ZTAB_CTRL_GET_LINES.

ENDLOOP.

***PAI

PROCESS AFTER INPUT.

LOOP AT ITAB_F.

CHAIN.

FIELD ITAB_F-MATNR.

FIELD ITAB_F-MAKTX.

FIELD ITAB_F-SUM.

FIELD ITAB_F-ACT_QTY.

ENDCHAIN.

MODULE UPDATE_VALUES_TO_IT.

ENDLOOP.

MODULE USER_COMMAND_0100.

itab_f is the final internal table,

When this gets populated in the program , etries are displayed on the table control.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

***DISPLAY

WHEN 'DISPLAY'.

CLEAR OK_CODE.

CLEAR ITAB_F[].

PERFORM CHECK_DATE.

PERFORM MARD.

PERFORM MAKT.

PERFORM CHECK_TABLE.

PERFORM ENTRIES.

endcase.

Your forms contain the actual logic what you want to do in your program.

Message was edited by:

Manu Kapur

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Create the text from dictionary as per your requirement in the screen.create a push button say display(function code DISPLAY).

In the PAI of the screen,

if sy-ucomm = 'DISPLAY'.

slect * from zestheader inner join zestdetails into wa where zestheader-estmnr = zestdetails-estmr.

zestheader-f1 = wa-f1.

....

endselect.

endif.

Former Member
0 Kudos

Hi ,

Go thru this link .

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/content.htm"></a>

Regards ,

Senthil

Former Member
0 Kudos

PAI code:

case sy-ucomm.

when 'fetch'.

select hh1 hh2 hh3 ii1 ii2 ii3 into table it_dest from ZESTHEADER as h inner join ZESTDETAILS as i on ZESTHEADER-h1 = ZESTDETAILS-i1.

loop at it_dest.

write: / it_dest-h1,.......

endloop.

when 'exit'.

leave program.

endcase.

Cheers.

Former Member
0 Kudos

Hi Krishna ,

Try like this .

PROCESS BEFORE OUTPUT.

loop at itab1 with control VCONTROL.

MODULE STATUS_0100.

endloop.

PROCESS AFTER INPUT.

loop at itab1.

endloop.

<b>MODULE USER_COMMAND_0100.</b>

module user_exit.

the code for PAI & PBO

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'DISP'.

refresh itab.

select ESTMATE_NBR VERSION ESTIMATE_DT TOT_AMT CUST_ID CUST_ADDR_NBR WBS_ELEMENT ESTIMATE_STATUS USER_FLD1 USER_FLD2 APPROVAL_STATUS LASTUPDATE_DTM LASTUPDATE_USRID from zestheader into <b>table</b> itab where ESTMATE_NBR = zestheader-ESTMATE_NBR.

<b>* append itab.

  • endselect.</b>

refresh itab1.

select LINE_NO LINE_STATUS SALES_MATNR UOM QTY UNIT_PRICE AMOUNT PRICE_TYPE COMMENTS from ZESTDETAILS into <b>table</b> itab1 for all entries in itab where ESTMATE_NBR = itab-ESTMATE_NBR.

<b>* append itab1.

  • break-point.

  • endselect.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Other things r ok .

Execute the pgm in debugging mode and check whether all the values are coming exactly . If not let me know .

Regards ,

Senthil .

0 Kudos

Hi Senthil,

I got the ouput . noiw i can insert display and change the data successfully in table control.

thanks for ur help senthil,

But i could not insert the multiple line items in table control?

please give some suggestions

thanks

krishna