‎2010 Dec 27 12:01 PM
Hi,
i'm pretty new to HR Abap programming. I have a requirement like "calling an executable program within a function module and the output of the program data(Stored in internal tables) should be passed to the function module tables".
I've some idea about SUBMIT keyword and i used it in the function module..
Please do the needful to solve this.
Regards,
Selvi.
‎2010 Dec 29 6:01 AM
Hi,
Assuming that your EMPCODE is an internal table or a select option or a range,
use 'IN' operator instead of 'EQ' operator.
SUBMIT ZHR_RFC_PAYSLIP WITH PERNR-PERNR IN EMPCODE
WITH PYBEGDA IN FDATE
WITH PYENDDA IN LDATE
AND RETURN.Regards,
Jovito.
‎2010 Dec 27 1:52 PM
Hi
You can use IMPORT/EXPORT - but this is a litle dangerous
BEst Regards
Yossi
‎2010 Dec 27 1:59 PM
What you need is a subroutine inside the executable program with internal tables as parameters.The subroutine fills the internal tables and the Function Module calls this subroutine with the PERFORM xxx IN PROGRAM xxx keyword.
‎2010 Dec 27 2:27 PM
Hi Selvi,
SUBMIT... AND RETURN
EXPORTING LIST TO MEMORY.This statement stores the list in ABAP memory, allowing the calling program to access it once the called program has finished. You must use the AND RETURN addition in this case. You cannot use the additions EXPORTING LIST TO MEMORYand TO SAP-SPOOL together.
The function group SLST provides function modules for accessing the saved list, including for example:
· LIST_FROM_MEMORY
· WRITE_LIST
· DISPLAY_LIST
(Quoted from Affecting Lists in Called Programs)
Regards,
Clemens
‎2010 Dec 28 4:35 AM
Hi,
Thanks for your reply.Actually the executable program output will be displayed in smartforms. While using Submit keyword, as per Clemens advice, I'm getting exact output in smartforms thru the function module.
But i don't want to display the output in smartforms, I want to fetch the internal table data of executable program and pass it to the function module tables. I need to display the data using function module tables.
Waiting for your reply.
Regards,
Selvi
‎2010 Dec 28 5:17 AM
Hi,
As said by Adrian, try using PERFORM fill_table IN PROGRAM ztest777 TABLES itab statement.
Inside your FM, call a subroutine in the executable program like below.
FUNCTION ztest7.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" TABLES
*" ITAB STRUCTURE MARA
*"----------------------------------------------------------------------
PERFORM fill_table IN PROGRAM ztest TABLES itab. " Decalre itab in TABLES parameter and pass to program for filling it
ENDFUNCTION.
" Double click above include and create it and add code like below.
REPORT ztest.
FORM fill_table TABLES itab STRUCTURE mara.
DATA: wa TYPE mara.
SELECT SINGLE * FROM mara INTO wa WHERE matnr LIKE '%TEST%'.
APPEND wa TO itab.
ENDFORM. " FILL_TABLE
‎2010 Dec 28 5:21 AM
Hello concepts is really nice.
but can u tell me why we are calling it in fm can we call it in include programs.
‎2010 Dec 28 5:30 AM
Hi,
Please use Return command it wont display Smartform output.
I will suggess you to export table in memory and import table from memory.
you can use set/get parameter as well.
‎2010 Dec 28 5:43 AM
Hi,
Thanks for your nice reply.
This is a Customized Z program. I think PNP logical database can be used only in executable program. Other wise I would have used include program. More over lots of infotypes are used here in a single sub routine. Since I'm new to HR programming I need your help to solve this issue.
‎2010 Dec 28 5:18 AM
Hi,
Is this executable program a standard program or a custom (Z) program.
If its a standard program could you provide the name of the program.
If its a Z program, you can code the processing of the table in a separate form and call the form in this function module via perform statement ( make sure you use a table parameter).
Regards,
Jovito.
‎2010 Dec 28 6:22 AM
Hi,
Since I do not have much of the details of the Z program you are using here is what I can suggest :
Option 1:
Check if the Z program has any forms that you can use. If it does, you can call it using :
perform <form name>(<program name>) using <parameters>
Option 2:
If you are allowed to change the Z program, move all the processing code into a form .
You can then use this perform.
If the code is complicated, add a hidden parameter or select-option to the Z program based on which you will either print the smart form or export the table to memory. You can then submit this program from your function module and use the import statement to pull in the table.
Option 3:
If you are not allowed to change the Z program, make a copy of the program.
Remove the code to display the smart form and replace it with code to export the internal table to memory.
‎2010 Dec 29 5:10 AM
Hi,
Thanks for all your reply.
I've used Option 3 as per dsouzajovito suggestion. Now i'm getting data in function module tables using import/ export table to memory concept.
Again a small issue arises, while i'm executing function module it fetches all pernr available in the server and displays the details of last pernr. GET pernr statement is used in the Z report and submit statement is used like this as follows.
SUBMIT ZHR_RFC_PAYSLIP WITH PERNR-PERNR EQ EMPCODE
WITH PYBEGDA EQ FDATE
WITH PYENDDA EQ LDATE
AND RETURN.
Pls suggest if there is any corrections in the code.
If i give a pernr as input in the function module, then it should fetch the details related only to that pernr.
FYI, No selection screen is used here as per requirement.
Regards,
Selvi.
‎2010 Dec 29 6:01 AM
Hi,
Assuming that your EMPCODE is an internal table or a select option or a range,
use 'IN' operator instead of 'EQ' operator.
SUBMIT ZHR_RFC_PAYSLIP WITH PERNR-PERNR IN EMPCODE
WITH PYBEGDA IN FDATE
WITH PYENDDA IN LDATE
AND RETURN.Regards,
Jovito.
‎2010 Dec 29 10:19 AM
Hi Jovito,
Thanks for your reply. Problem solved.
RANGES : PYPERNR FOR PERNR-PERNR.
PYPERNR-SIGN = 'I'.
PYPERNR-OPTION = 'EQ'.
PYPERNR-LOW = EMPCODE.
APPEND PYPERNR.
SUBMIT ZHR_RFC_PAYSLIP WITH PYPERNR IN PYPERNR
WITH PYBEGDA EQ FDATE
WITH PYENDDA EQ LDATE
AND RETURN.