‎2006 Aug 03 6:15 AM
Hi,
I need to get the reason for cancellation of a Business Even in Training & Event Management module, so I am passing Emp_id.
But the reason(CAAATRT) is returned with blank by the code.
please help.
/:DEFINE &EMP_ID&= &PPVAR-TOBJD&
/:PERFORM HR_REASON_PRINT IN PROGRAM ZHR_REASON_PRINT
/:USING &EMP_ID&
/:CHANGING &CAATRT&
REPORT ZHR_REASON_PRINT.
DATA : BEGIN OF in_par OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF in_par.
DATA : BEGIN OF out_par OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF out_par.
DATA: TOBJD TYPE PPVAR-TOBJD,
ADATANR TYPE HRP1001-ADATANR,
CAATR TYPE HRPAD25-CAATR,
CAATRT TYPE T77CART-CAATRT,
EMP_ID TYPE C.
TABLES : PPVAR,
HRP1001,
HRPAD25,
T77CART.
FORM HR_REASON_PRINT TABLES input output.
in_par[] = input[].
out_par[] = output[].
READ TABLE in_par INDEX 1.
CHECK sy-subrc = 0.
TOBJD = in_par-value.
MOVE in_par-value TO TOBJD.
SELECT ADATANR
into ADATANR
FROM HRP1001
WHERE OBJID EQ TOBJD.
ENDSELECT.
SELECT CAATR
into CAATR
FROM HRPAD25
WHERE ADATANR EQ ADATANR.
ENDSELECT.
SELECT CAATRT
INTO CAATRT
FROM T77CART
WHERE CAATR EQ CAATR.
ENDSELECT.
REFRESH out_par.
out_par-name = 'DREASON'.
move CAATRT To out_par-value.
MODIFY out_par INDEX 1.
APPEND out_par.
output[] = out_par[].
Thanks
Ramakrishna
‎2006 Aug 03 6:22 AM
1) I could not see and /<b>: ENDPERFORM</b> in your code.
2) You form should be like
<b>form fixed_text tables inttab structure itcsy
outtab structure itcsy.</b>
Modify the name and Value of the outtab.
Hope this helps you.
Cheers,
THomas.
‎2006 Aug 03 6:26 AM
Hi RamaKrishna,
Can i know the syntax you used for calling the subroutine. Try the below syntax,
PERFORM <subr>
| <subr>(<prog>) [IF FOUND]
|(<fsubr>)[IN PROGRAM (<fprog>)][IF FOUND].
Regards,
Prashanth
‎2006 Aug 03 6:30 AM
Hi ramakrishna,
1. while calling subroutines from sapscripts,
there is a special technique,
which has got its own limitations.
2.
FORM abc
TABLES
in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
ENDFORM.
3. The perform in se38 program should be of the
above format only.
4. We cannot pass internal tables.
5. Rather we need to pass
VARIABLE NAME
VARIABLE VALUE
(see the structure of itcsy in se11)
6. In this form, we have to read
the internal table in_tab
to capture the variable name and its value.
7. Similary, to return the values,
we have to put one record (for each variable)
in out_tab.
regards,
amit m.
‎2006 Aug 03 6:41 AM
Hi All,
Thanks for the immediate reply,
I have tried all the permutations and combinations in defining the Subroutine, I have even used the format given by Thomas and Amit but still the value(CAATRT) is empty.
One thing I forgot to mention is that the program ZHR_REASON_PRINT, I have created as type 'S', does it make any difference.
‎2006 Aug 03 6:44 AM
Hi again,
1. First of all make it a normal program - Executable
(instead of S)
2. then put break-point in your
subroutine
3. then run the layout, and check.
regards,
amit m.
‎2006 Aug 03 7:32 AM
Amit,
I did the debugging the routine is returning the proper value, but it is empty when it is shown in SAPSCRIPT. Do I need to Define the Changing variable? if so how do we need to do it? since I did it in the following way but not working.
/:DEFINE &CAATRT&=''
Thanks for your help.
‎2006 Aug 03 7:53 AM
Hi again,
1. Do not define in layout again.
2. just use the variable &CAATRT&
(provided u have passed it properly
while calling the subroutine,
using &CAATRT&
3. Also make sure,
in the subroutine, in the abap code program,
the OUTCSY (output internal table)
is MODIFY properly,
(the record for CAATRT should get modified properly)
regards,
amit m.
‎2006 Aug 03 8:08 AM
Few more thinks:
1) S type does not matters.
2) Defining the variable is not a problem, In fact it should be defined if NOT in print control program.
3) In the FORM, as I wrote earlier it should be
<b>form fixed_text tables inttab structure itcsy
outtab structure itcsy.</b>
4) read table outtab by index or by with key NAME = 'OUT_FIELD' index to get value. Modify this table VALUE with key NAME 'OUT_FIELD'.
And at the ENDFORM see the values are there in outtab. if so it will pass back to the script.
Cheers,
Thomas.
‎2006 Aug 03 6:35 AM
see ramakrishna ,
there is no ENDPERFORM in ur code..
syntax:
perform <name> in program <prog-name>
using < >
changing <>
ENDPERFORM.
and even check the u have given (/:) for all lines (command)