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 Program Doubt

Former Member
0 Likes
644

Hi Xperts,

I am Working an object on module pool.I have a small doubt regarding that.

tables:lfa1.

data:begin of itab occurs 0,

lifnr like lfa1-lifnr,

land1 like lfa1-land1,

name1 like lfa1-name1,

end of itab.

case sy-ucomm.

when 'disp'.

select lifnr land1 name1 from lfa1 into itab where lifnr = lfa1-lifnr.

append itab.

endselect.

when 'exit'.

leave program.

endcase.

  • Here comes the doubt.Why do we use the statement underneath and why is this always under PBO.As lfa1 is an SAP standard table how can we move anything into that.

Move-corresponding itab to lfa1.

Query#2: Suppose a Z table was used.We pulled the fields onto the layout.For only retrieving of database values, do i need to declare an internal table like the way i defined here.

Thanks in advance.Hope i get my queries resolved.

--Ranjith.T.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
622

Hi,

The declaration "tables:lfa1" means you are declaring a work area of type lfa1. Anything you change in this workarea does not change the filed in the actual database table.

PBO means Process before output. It contains declarations and some initializations.

Yes you need an internal table and use that internal table to populate your values.

Regards,

Subramanian

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
622

I DIDNT GET UR 2 QN:

MOVE TO lfa1...

thE DATA IS MOVED ONLY TO THE HEADER OF LFA1 ...NOT TO THE TABLE.....

onLY WHEN A INSERT OR UPDATE IS EXECUTED ITS REFELCTED IN THE TABLE..

BUT INSERTING OR UPDATING INTO A sap TABLE IS NOT RECOMMENDED...

mAY BE ONLY THE HEADER IS USED...

Read only

Former Member
0 Likes
623

Hi,

The declaration "tables:lfa1" means you are declaring a work area of type lfa1. Anything you change in this workarea does not change the filed in the actual database table.

PBO means Process before output. It contains declarations and some initializations.

Yes you need an internal table and use that internal table to populate your values.

Regards,

Subramanian

Read only

0 Likes
622

Dear Keshu,

I created a ztable like ZTAB which has fields mandt,lifnr,name1,land1.

Tables:ztab.

under pai module.

case sy-ucomm.

when 'disp'.

select single * from lfa1 into corresponding fields of ztab where lifnr = ztab-lifnr.

when 'exit'.

leave program.

Is this also valid?

Read only

0 Likes
622

Yes its okay...

The source and target fieldnames are identical heRE.....SO NO ISSUE....

Read only

0 Likes
622

Hi,

see Tables LFA1.

this statment will create a structure in the memory which will have all the fields as in table LFA1.

This has no link to updation on deletion of table.

this is just like a variable of type LFA1.

hope i am clear.

reward points if helpful

Read only

0 Likes
622

Hi,

In the select quiry you have written ztable-f1, in the where condition. It can materialize only when in the lay out of the screen you have used inport from table option ( There is an on the tool bar area on the lay out design screen up clicking which you can enter the DB table name from which you wish to import the fields ).

Hope this explanation of mine helps you.

Ram.