Top include in Function module
Hi All,
I have written a select statment in a FM.I want to retain the values selected so that it is available even when the FM is executed next time.Is it possibe to retain values selected by declaring the internal table in the TOP include?
Thanks,
Rakesh.
hi Rakesh,
if you declare the internal table in the TOP include, that only means it will be avaliable for each FM in the function group. The internal table will be avaliable, not the data (which is filled with the SELECT statement)!
The question is when do you execute the FM next time? It it's only a while, you can export the data into the memory, import by the next FM call and you don't need to select again. but it only works if it is still the same user, same session. can you enlight the scenario?
thanks
ec
Similar Messages
-
Simple Examples on ABAP Objects without using include or function modules
Hi,
I am new to ABAP. I need simple example codes on ABAP Objects. It should not have Includes or Function Modules. Just simple codes, using local & global classes, interfaces etc. I searched the forum and even <<the site that shall not be mentioned>>, but did not find a solution. Kindly help please.
Regards,
Smruthi.
Edited by: Matt on Mar 1, 2009 1:20 PM - forbidden site reference removedHello Smruthi
If you go to the Forum Search and choose the forum ABAP Objects then serach for ZUS_SDN and you will find many of my simple sample reports.
These reports usually do not contain any includes but they may call function modules which makes perfectly sense. For example, if you are still doing a direct table SELECT instead of using an available BAPI (or class) to get a business object then this is a clear sign of poor (=non-ABAP-OO) programming.
Regards
Uwe -
What are the Includes in Function Module...? if the fuction group IS ZSJ_FC..?
How can I access SAP through Internet....?
Moderator Message: Interview-like question(s). Thread locked.
Edited by: Suhas Saha on Sep 30, 2011 11:14 AMHi
No! U can insert an own you Z-INCLUDE or somethingelse, try to regenerate the index of the program.
Max -
Creating Includes for Function Modules
Hi Experts,
Can you please let me know how to create includes for function modules.
I came across this in a standard include program, which was generated by a function library. The includes inside this program where linked to the function modules (when I double clicked on them).
Please let me know how to create it.
Thanks in advance !
Regards,
Anand Patil.Hi,
have a look at the code for better understanding
Declaration of Workareas *
DATA: lwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create,
lwa_data TYPE edidd, " Work area for IDOC
lwa_control TYPE edidc. " Work Area for control rec
Read the control data information of idoc.
loop at idoc_contrl INTO lwa_control Where mestyp = lc_mbgmcr.
Extract the data from the segments.
LOOP AT idoc_data INTO lwa_data
WHERE docnum = lwa_control-docnum and
segnam = lc_item_create.
*->> Set the tabix of the internal table
lv_index = sy-tabix.
Move the Material Document Item Segment data
MOVE lwa_data-sdata TO lwa_e1bp2017_gm_item_create.
Modify the material document item data internal table
PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create.
*->> set the changed values to the IDOC SDATA
MOVE lwa_e1bp2017_gm_item_create TO lwa_data-sdata.
*->> Modify the table
MODIFY idoc_data FROM lwa_data index lv_index.
Clear the Work areas
CLEAR : lwa_data,
lwa_e1bp2017_gm_item_create.
ENDLOOP. "LOOP AT t_idoc_data
Call the BAPI function module to create the
appropriate Material Document
CALL FUNCTION 'BAPI_IDOC_INPUT1'
EXPORTING
input_method = input_method
mass_processing = mass_processing
IMPORTING
workflow_result = workflow_result
application_variable = application_variable
in_update_task = in_update_task
call_transaction_done = call_transaction_done
TABLES
idoc_contrl = idoc_contrl
idoc_data = idoc_data
idoc_status = idoc_status
return_variables = return_variables
serialization_info = serialization_info
EXCEPTIONS
wrong_function_called = 1
OTHERS = 2.
IF sy-subrc = 1.
RAISE wrong_function_called.
ENDIF.
endloop.
ENDFUNCTION.
here when we write the statment
PERFORM sub_modify_idocdata changing lwa_e1bp2017_gm_item_create and double click on sub_modify_idocdata .
it will create a include with the name "LZDTSINT052F_GPOMS_GMF01 ".
now we can write the FORM ..END FORM In this inculde.like this.
***INCLUDE LZDTSINT052F_GPOMS_GMF01 .
*& Form sub_modify_idocdata
Modify the material document item data internal table
FORM sub_modify_idocdata
CHANGING pwa_e1bp2017_gm_item_create TYPE e1bp2017_gm_item_create.
contant declaration
CONSTANTS: lc_261(3) TYPE c VALUE '261'.
DATA : lv_aplzl LIKE resb-aplzl,
lv_aufpl LIKE resb-aufpl,
lv_subrc LIKE sy-subrc,
lv_charg LIKE resb-charg,
lv_uom LIKE pwa_e1bp2017_gm_item_create-entry_uom.
CLEAR: pwa_e1bp2017_gm_item_create-reserv_no,
pwa_e1bp2017_gm_item_create-res_item.
*->> Get SAP storage bin & Storage type from the Z table
SELECT lgtyp lgpla
INTO (pwa_e1bp2017_gm_item_create-stge_type,
pwa_e1bp2017_gm_item_create-stge_bin)
UP TO 1 ROWS
FROM zdtsint050_sttyp
WHERE zstorage_typ = pwa_e1bp2017_gm_item_create-stge_type
AND zstorage_bin = pwa_e1bp2017_gm_item_create-stge_bin.
ENDSELECT.
IF sy-subrc NE 0.
CLEAR: pwa_e1bp2017_gm_item_create-stge_type,
pwa_e1bp2017_gm_item_create-stge_bin.
ENDIF.
PERFORM get_oper CHANGING pwa_e1bp2017_gm_item_create.
Get the Reservation number and Reservation item number
basing on the idoc data.
SELECT rspos werks lgort
INTO (pwa_e1bp2017_gm_item_create-res_item,
pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
UP TO 1 ROWS
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
AND matnr = pwa_e1bp2017_gm_item_create-material
AND charg = pwa_e1bp2017_gm_item_create-batch
AND aufnr = pwa_e1bp2017_gm_item_create-orderid
AND vornr = pwa_e1bp2017_gm_item_create-activity
AND bwart = lc_261.
ENDSELECT.
IF sy-subrc <> 0.
Start of insertion for R31K993797
CLEAR lv_charg.
SELECT rspos werks lgort
INTO (pwa_e1bp2017_gm_item_create-res_item,
pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
UP TO 1 ROWS
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no
AND matnr = pwa_e1bp2017_gm_item_create-material
AND charg = lv_charg
AND aufnr = pwa_e1bp2017_gm_item_create-orderid
AND vornr = pwa_e1bp2017_gm_item_create-activity
AND ( splkz = 'X' or
splkz = space )
AND bwart = lc_261.
ENDSELECT.
IF sy-subrc <> 0.
End of insertion for R31K993797
SELECT SINGLE werks lgort
INTO (pwa_e1bp2017_gm_item_create-plant,
pwa_e1bp2017_gm_item_create-stge_loc)
FROM resb
WHERE rsnum = pwa_e1bp2017_gm_item_create-reserv_no.
CLEAR : pwa_e1bp2017_gm_item_create-reserv_no,
pwa_e1bp2017_gm_item_create-res_item.
ENDIF.
ENDIF.
get SAP UOM
SELECT SINGLE zsap_uom
INTO lv_uom
FROM zca_uom_conv
WHERE zext_uom = pwa_e1bp2017_gm_item_create-entry_uom.
IF sy-subrc = 0.
pwa_e1bp2017_gm_item_create-entry_uom = lv_uom.
ENDIF.
ENDFORM. " sub_modify_idocdata
*& Form get_oper
Get the operation
<--P_PWA_E1BP2017_GM_ITEM_CREATE_RE Segment
FORM get_oper CHANGING p_pwa_e1bp2017_gm_item_create TYPE
e1bp2017_gm_item_create.
DATA : l_aufpl LIKE afko-aufpl,
l_aplzl LIKE afvc-aplzl.
REFRESH : i_op.
UNPACK p_pwa_e1bp2017_gm_item_create-orderid TO
p_pwa_e1bp2017_gm_item_create-orderid.
Get the reservation and routing number for the order
SELECT SINGLE
rsnum
aufpl
FROM afko
INTO (p_pwa_e1bp2017_gm_item_create-reserv_no,
l_aufpl)
WHERE aufnr = p_pwa_e1bp2017_gm_item_create-orderid.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_NUMCV_INPUT'
EXPORTING
input = p_pwa_e1bp2017_gm_item_create-activity
IMPORTING
output = p_pwa_e1bp2017_gm_item_create-activity.
ENDIF.
ENDFORM. " get_oper
Regards,
nagaraj -
hiya ,
do INCLUDES in the function module all shud be in the same function group??
what iam doing is ..copied the sap standard function module but when iam executing it says <function module cannot be found in the same group>
is it something to do with includes...
plz advise
thanksHi
No! U can insert an own you Z-INCLUDE or somethingelse, try to regenerate the index of the program.
Max -
How to find an include's function module
Hi all,
How can we find the fm of an include?
Thanks.Hi..
You can find the FM name using the Include name in this way..
For EG:
INCLUDE<b> LSBDCU14.</b> "BDC_OPEN_GROUP
In this SBDC is the Name of the Function Group.
So in SE37 Open this Function Group SBDC and Check the Include where all the Function modules are stoted.
Now u can find the Include . Double click on this to see the FM.
<b>reward if Helpful.</b> -
Dear Gurus,
Could you explain me why is an include generated for a function module?
After I write a function module, to use this function module, how should I use the generated include?
Regards
SuzieHi,
The FM code is stored in the INCLUDES.
go to SE37- give the FM
u can c the code of the FM.
There u will get the import and export parameters.
if you know the import paramaters u can run the program there itself and test the ouput.
hope u got an idea
Rgds
Anver -
Chang Include by function module
Hi,
Is there any function modules to change an existing 'Include' 'File' in ABAP? I am seeking for the way to control the function pool or abap programm totally by programming.
Thanks !<b>No</b>, this is not support by SAP. You need to manually change the include.
-
Syntax error on include of Function Module (user exit) EXIT_SAPLRSAP_002
When I do a syntax check in the a routine within inlude ZXRSAU02 of FM EXIT_SAPLRSAP_002, I get an error. This object has been in production so I must be doing the syntax check incorrectly. The error is 'Field i_t_data is unknown. It is neither in one of the specified tatble nor defined by a 'DATA' statement. This is strange because this field is defined in main body of this user exit. Please advise the correct way to do syntax check.
Thank you.Hi,
The reason for this might be, though it is used in main body- check the main body is not in the routine. Check the field is declared globally, if not try to check the field assigned to what type, & try to re-assign to same one(like your target place where to update the values, continue to Declare& add accordingly.)
- Dileep .C -
How to make a normal Function Module remote able function module
Hi guys,
i am a beginner in abap programming. I have made a programm in Se80 which shows all the nodes of the active hierarchies (5 stk.)
in a ALV grid. Therefore i am getting the active hierarchies from table "rshiedir" and use the normal function module "RSSH_HIERARCHY_READ" to display the nodes of the hierarchie. The problem is the hierarchies do have a different techical name in the systems (development-acceptance-productive) but the descriptive nbame is the same in all systems. Because of the difference of the technical names I can use this programm in just one system. But the hierarchy content should be comparable and be displayed in all three systems. Therefore i would like to create a remoteable function module which covers the normal one. Can i do this and how can i create a remoteable function module and use it?
If not do you know any remotable functgion module which gives back all the nodes from an active hierarchy in table "RShiedir".
Thanks and kind regards,
MuratHello,
Simple, create a wrapper RFC (similar to 'RSSH_HIERARCHY_READ' ) & call the normal FM 'RSSH_HIERARCHY_READ' inside the wrapper.
Something like this:
FUNCTION z_rssh_hierarchy_read.
*"*"Global Interface:
*" IMPORTING
*" VALUE(I_RSHIEDIRKEY) TYPE RSHI_S_RSHIEDIRKEY OPTIONAL
*" VALUE(I_RSHIEDIRLOG) TYPE RSHI_S_RSHIEDIRLOG OPTIONAL
*" VALUE(I_DATE) TYPE RSHI_DATE DEFAULT SY-DATUM
*" EXPORTING
*" REFERENCE(E_RSHIEDIR) TYPE RSHI_S_HIEDIR
*" REFERENCE(E_T_RSNODES) TYPE RSHI_T_HIENODE
*" REFERENCE(E_TH_RSINTERVAL) TYPE RSHI_TH_INTERVAL
*" REFERENCE(E_DUPLICATE_LEAFS) TYPE RS_BOOL
*" REFERENCE(E_T_RSNODES_LNK) TYPE RSHI_T_HIENODE
*" EXCEPTIONS
*" INVALID_HIERARCHY
*" NAME_ERROR
*" IOBJ_NOT_FOUND
" Don't forget to add TYPE-POOLS rshi to the FuGr. TOP include
CALL FUNCTION 'RSSH_HIERARCHY_READ'
EXPORTING
i_rshiedirkey = i_rshiedirkey
i_rshiedirlog = i_rshiedirlog
i_date = i_date
IMPORTING
e_rshiedir = e_rshiedir
e_t_rsnodes = e_t_rsnodes
e_th_rsinterval = e_th_rsinterval
e_duplicate_leafs = e_duplicate_leafs
e_t_rsnodes_lnk = e_t_rsnodes_lnk
EXCEPTIONS
invalid_hierarchy = 1
name_error = 2
iobj_not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here Z_RSSH_HIERARCHY_READ is the wrapper RFC. Hope you get the point.
BR,
Suhas -
ALV object in function module shows old data
Hello,
I create a function module with import parameter matnr.
This function module calls a screen that displays an ALV with the whole info of matnr out of table mara.
I include this in a program where a material can be selected. This is then input for the function module. Everything looks good for the first material. However when the function module is called for a second material I still see the ALV with the data of the previous material.
When I debug the code I see that new data is selected and put on the alv (with method set_table_for_first_display) but still I see the old ALV (which I free by the way in the exit of my function module...). It drives me crazy, what's the problem?
<b>My function module:
</b>
FUNCTION ZJVB_TEST.
*"*"Lokale interface:
*" IMPORTING
*" REFERENCE(I_MATNR) TYPE MATNR
g_matnr = i_matnr.
call SCREEN 1979.
ENDFUNCTION.
<b>TOP include:</b>
FUNCTION-POOL ZJVB_TEST. "MESSAGE-ID ..
data: ok_code type sy-ucomm,
container type ref to cl_gui_custom_container,
alv type ref to cl_gui_alv_grid,
g_matnr type matnr.
*& Module STATUS_1979 OUTPUT
* text
MODULE STATUS_1979 OUTPUT.
SET PF-STATUS 'FMAIN'.
* SET TITLEBAR 'xxx'.
if container is INITIAL.
CREATE OBJECT CONTAINER
EXPORTING
CONTAINER_NAME = 'CONTAINER' .
CREATE OBJECT ALV
EXPORTING
I_PARENT = container.
data: itab type TABLE OF mara.
select *
from mara
into TABLE itab
where matnr = g_matnr.
CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = itab.
endif.
ENDMODULE. " STATUS_1979 OUTPUT
*& Module USER_COMMAND_1979 INPUT
* text
MODULE USER_COMMAND_1979 INPUT.
case ok_code.
when 'BACK'.
free container.
free alv.
LEAVE to SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_1979 INPUT
<b>My program:</b>
*& Report ZJEROEN_ALV_FM
REPORT ZJEROEN_ALV_FM.
data: ok_code type sy-ucomm,
l_matnr type matnr.
call SCREEN 1979.
*& Module STATUS_1979 OUTPUT
* text
MODULE STATUS_1979 OUTPUT.
SET PF-STATUS 'MAIN'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_1979 OUTPUT
*& Module USER_COMMAND_1979 INPUT
* text
MODULE USER_COMMAND_1979 INPUT.
case ok_code.
when 'BACK'.
leave to screen 0.
when 'CALL'.
CALL FUNCTION 'ZJVB_TEST'
EXPORTING
i_matnr = l_matnr.
endcase.
ENDMODULE. " USER_COMMAND_1979 INPUT
Thx for helping,
jeroenHello,
I found out that the container lifetime was the problem... When you create a container to put the ALV in the lifetime is set to default. Normally you never change this, I didn't mention it before I had the problem. But you have to change the lifetime to <your_instance_name>->lifetime_dynpro for instance my_container->lifetime_dynpro.
Also check this helplink: http://help.sap.com/saphelp_nw04/helpdata/en/9b/d080b79fc111d2bd68080009b4534c/frameset.htm -
Required help on Function Modules and Bapis
Web portal publishing of ERS invoice letters. This involves modification in the BAPI screens to show the invoice PDF instead of printing??
can anyone help me in fixing this issue.hi Anjaneyulu,
open the t-code --> and go to menu system->status-->select the program and open the program-->
selct the tree structure----in the left side the includes screen and function module everthing will show..
or
open the t-code --> and go to menu system->status-->select the program and open the program-->
go to attributes and select the Package..
next----
go to se80--> enter the package --> and dispalay it shows the list of Program , include transaction function modules and bapi's under the pakage
Regards,
Prabhudas -
Function modules and BAPIs for a transactio code
Hi friends,
How i can find the List of function modules and BAPIs being used for a particular transaction code?
for example: I would like to find List function modules and BAPIs being used for the Transaction code
"FBRA"(Reset cleared items)?
Any sort of help on this will be helpful.
Thanks,
Punjaalahi Anjaneyulu,
open the t-code --> and go to menu system->status-->select the program and open the program-->
selct the tree structure----in the left side the includes screen and function module everthing will show..
or
open the t-code --> and go to menu system->status-->select the program and open the program-->
go to attributes and select the Package..
next----
go to se80--> enter the package --> and dispalay it shows the list of Program , include transaction function modules and bapi's under the pakage
Regards,
Prabhudas -
How to get no. of lines in a function module
Dear Experts,
I want to get the no. of lines present in a function module. How can I do it.
For reports/ include I did like
read report 'rep name' into itab.
describe table itab lines wa_line.
But I am not able to do the same for function module. Is there any function module to find the no. of lines?
or is there any other way?
Thanks and regards,
VenkatHI,
In Se37, enter your FM name display,
now Goto --> Mainprogram --> you can see include for function modules
eg: include lalfauxx. " Function Modules
double click the include
you can see the function module names includes
Eg:
THIS FILE IS GENERATED BY THE FUNCTION LIBRARY. *
NEVER CHANGE IT MANUALLY, PLEASE! *
include lalfau01. "CONVERSION_EXIT_ALPHA_INPUT
include lalfau02. "CONVERSION_EXIT_ALPHA_OUTPUT _
double click your functipon module name
eg :lalfau02.
you can follow the same as you did for the report
read report 'rep name' into itab.
describe table itab lines wa_line
This is the Include program name for your function module.
Basically FM is a include program.
eg:
data: begin of itab occurs 0,
text type char2000,
end of itab.
data wa_line type syindex.
read report 'lalfau02' into itab.
describe table itab lines wa_line.
write wa_line.
output 13.
regards,
Nazeer -
Function Module to do "Where-used-list"
Dear sirs,
Please could anyone help me? I'd like to know if there is any FM which I can pass the name of an abap object (program, include, table, function module, etc) and returns the where used list of it in an internal table.
I need to map all transactions that call a report or are using an include.
Thank you in advance,
Fabio PurcinoYou can use the Function Module
RS_EU_CROSSREF
Read the Documentation of the same.
there is one example.
Maybe you are looking for
-
Sending Idocs from SAP-R/3 to XI, bundle and map them to one XML-file
Hi All, We need to send IDoc's (DEBMAS06) from R/3 to XI and bundle and map them to a single xml-file. Please help us with your suggestions on how to proceed using a simple solution (probably need of BPM). Regards, Theo
-
How to install OS X 10.5 on iBook G4?
I am having trouble installing OS X 10.5 on my iBook G4 it currently runs OS X 10.4.11 I put the disc for Leopard in my external cd/DVD drive and the window comes up to install, I click that then the window comes to to restart to start the installati
-
Hi, I am working on 4.6C system. We have an issue with substitution created for FI document. We are trying to substitute the field 'Insurance Indicator' (BSEG-VRSKZ) via some logic. The issue is that the substitution works well when we create a custo
-
Reverse/cancel outgoing excise invoice
Hello, We are using version 2005B. We created an outgoing excise invoice by copying from a goods return. We then noticed that the ship to address was posted incorrectly and need to reverse/cancel the outgoing excise invoice. After looking through
-
Create an HTTPService in PHP/MySQL?
Our development server has PHP and MySQL running on it. We're beginning to build in Flex, and would like to know how to create an HTTPService connection to our MySQL database. We have successfully created a connection to the database in DreamWeaver,