01-29-2008 8:43 AM
Hi,
Can i use multiple CALL TRANSACTION from my report program as i need to have multiple transaction there.
Points for sure..
Regards
Gunjan
01-29-2008 8:47 AM
Yes, you can. You only have to ensure that the called transaction finds their way back to your program/report.
01-29-2008 8:51 AM
yes we can have as many as CALL TRANSACTION in our report if we want to call multiple transaction from our code.
01-29-2008 8:52 AM
Yes you can upload more than two transaction using the Call Transaction and Session Method.I have done it using the session method Just refer the coding below for single transaction that I have done it before similarly you will done for two transaction.
The code is :
I have designed a selection screen for getting the input file name from the legacy system.Slowly review this code you will clear idea.i am updating a z field in the IT0007.:
**********************************************************************
SELECTION SCREEN *
**********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS : P_PATH TYPE string.
SELECTION-SCREEN END OF BLOCK B.
SELECTION-SCREEN END OF BLOCK A.
**********************************************************************
CALL FUNCTION FOR INPUT FILE NAME *
**********************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FNAME.
p_path = p_fname.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_PATH
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = INT_0007
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform open_group.
*Looping pernr values*
LOOP AT INT_0007 INTO WA_0007.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*INSERTING THE PERNR VALUE*
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'00001011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC'
'0007'.
perform bdc_dynpro using 'SAPMP50A' '1000'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-PERNR'.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
perform bdc_field using 'RP50G-PERNR'
WA_0007-PERNR. "'1011'.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'RP50G-CHOIC'
'Planned Working Time - 0007'.
perform bdc_dynpro using 'MP000700' '2000'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0007-BEGDA'
'12/01/2007'.
perform bdc_field using 'P0007-ENDDA'
'12/31/9999'.
*INSERTING THE WORK SCHEDULE*
perform bdc_field using 'P0007-SCHKZ'
WA_0007-SCHKZ. "'N12'.
perform bdc_field using 'P0007-ZTERF'
WA_0007-ZTERF. "'1'.
*INSERTING THE OVERTIME CLASS*
IF WA_0007-R1 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_ELGBLE'
'X'.
ELSEIF WA_0007-R2 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_NOTELG'
'X'.
ELSEIF WA_0007-R3 = 'X'.
perform bdc_field using 'ZHQ0007-OVT_TMPELG'
'X'.
ENDIF.
*BDC output for transaction code*
perform f_bdc_output using 'pa30'.
PERFORM BDC_TRANSACTION USING 'PA30'.
ENDLOOP.
top-of-page.
INCLUDE ZWUHDG20 . "Global Data , Start-of-Sel. and Code
INCLUDE ZWUHDG30 . "Top-of-page and Call function
*Writing the output*
PERFORM f_write_output.
perform close_group.
&----
*& Form f_write_output
&----
text
-
--> p1 text
<-- p2 text
-
FORM f_write_output .
*For Successfull Records*
if int_OUT[] IS NOT INITIAL.
WRITE : /50 TEXT-004 color 4.
write : / sy-uline.
LOOP AT INT_OUT.
WRITE : /40 int_out-pernr,50 '-->',54 int_out-mesg.
ENDLOOP.
ENDIF.
write / sy-uline.
SKIP 2.
*For Error records*
if int_err[] IS NOT INITIAL.
WRITE /53 text-005 color 6.
write / sy-uline.
LOOP AT int_err.
write :/40 int_err-pernr,50 '-->',54 int_err-mesg.
ENDLOOP.
endif.
write / sy-uline.
ENDFORM. " f_write_output
&----
*& Form f_bdc_output
&----
text
-
-->P_0369 text
-
FORM f_bdc_output USING VALUE(P_0369).
DATA: L_MSTRING(480).
DATA: L_SUBRC LIKE SY-SUBRC.
REFRESH MESSTAB.
*Capturing the output message* Here You are going to * update the transaction similiar to this make another
transaction for uploading*
CALL TRANSACTION 'PA30' USING BDCDATA
MODE CTUMODE
UPDATE CUPDATE
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
IF SMALLLOG 'X'.
LOOP AT MESSTAB.
*Selection for capturing the text for records*
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
*Moving the text from T100 to local variable*
L_MSTRING = T100-TEXT.
IF ( MESSTAB-MSGTYP = 'W' or
MESSTAB-MSGTYP = 'S' OR
MESSTAB-MSGTYP = 'E' ).
*Moving the success records pernr and text to internal table*
IF MESSTAB-MSGTYP = 'S'.
INT_OUT-PERNR = WA_0007-PERNR.
INT_OUT-MESG = L_MSTRING.
APPEND INT_OUT.
CLEAR INT_OUT.
*Moving the success records pernr and text to internal table*
ELSEIF MESSTAB-MSGTYP = 'E'.
*For getting the error text exactly*
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
INT_ERR-PERNR = WA_0007-PERNR.
INT_ERR-MESG = L_MSTRING.
APPEND INT_ERR.
CLEAR INT_ERR.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
&----
*& CALL FUNCTION 'BDC_OPEN_GROUP'
&----
IF L_SUBRC 0 AND E_GROUP SPACE.
IF E_GROUP_OPENED = ' '.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = E_GROUP
USER = E_USER
KEEP = E_KEEP
HOLDDATE = E_HDATE.
E_GROUP_OPENED = 'X'.
ENDIF.
&----
*& CALL FUNCTION 'BDC_INSERT'
&----
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PA30'
TABLES
DYNPROTAB = BDCDATA.
&----
*& CALL FUNCTION 'BDC_CLOSE_GROUP'
&----
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
REFRESH BDCDATA.
ENDFORM.
01-29-2008 8:58 AM
01-29-2008 9:09 AM
hi
good
i dont think we can use multiple call transaction in our report.
thanks
mrutyun^
01-29-2008 9:29 AM
If we can't then whats the way out?
any pointers?
Edited by: Gunjan Kumar on Jan 29, 2008 11:07 AM