‎2005 Nov 16 2:23 PM
Hello,
I have one program let say XYZ through which i want to call other BDC program by passing internal table of XYZ program to BDC program.
Can any one have sample code or any idea about this problem.
Reagrds,
Amey
‎2005 Nov 16 2:32 PM
Hi
Use SUBMIT statement to call the program.Before the call use EXPORT statement to export your internal table to ABAP Memory and then use IMPORT statement to import the internal table in the 2nd BDC Program.
Hope this will solve.
Regards,
Abdul
‎2005 Nov 16 2:30 PM
Amey,
Once you have BDC mapped (use transaction SHDB), you can base your code in the folloing example:
.......
PERFORM iyr_dynpro_bdc USING 'SAPMKAUF'(008) '0110'(009).
PERFORM iyr_campo_bdc USING 'BDC_CURSOR'(010) 'COAS-AUFNR'(011).
PERFORM iyr_campo_bdc USING 'BDC_OKCODE'(012) '/00'(013).
PERFORM iyr_campo_bdc USING 'COAS-AUFNR'(011) wa_tpb020aufk-aufnr.
PERFORM iyr_dynpro_bdc USING 'SAPMKAUF'(008) '0600'(014).
PERFORM iyr_campo_bdc USING 'BDC_CURSOR'(010) 'COAS-KTEXT'(015).
PERFORM iyr_campo_bdc USING 'BDC_OKCODE'(012) '=LSET'(016).
PERFORM iyr_campo_bdc USING 'COAS-BUKRS'(017) 'PBR'(018).
PERFORM iyr_dynpro_bdc USING 'SAPMKAUF'(008) '0600'(014).
PERFORM iyr_campo_bdc USING 'BDC_CURSOR'(010) 'COAS-KTEXT'(015).
PERFORM iyr_campo_bdc USING 'BDC_OKCODE'(012) '=SICH'(019).
REFRESH it_bdc_msgcoll.
CALL TRANSACTION 'KO02' USING it_bdc_data
MODE 'A'(020) UPDATE 'S'(021)
MESSAGES INTO it_bdc_msgcoll.
*************************************************
Forms
*************************************************
FORM iyr_dynpro_bdc USING iyl_bdc_program_x TYPE c
iyl_bdc_dynpro_x TYPE c.
CLEAR wa_it_bdc_data.
wa_it_bdc_data-program = iyl_bdc_program_x.
wa_it_bdc_data-dynpro = iyl_bdc_dynpro_x.
wa_it_bdc_data-dynbegin = 'X'(038).
APPEND wa_it_bdc_data TO it_bdc_data.
ENDFORM. " IYR_DYNPRO_BDC
FORM iyr_campo_bdc USING value(iyl_fnam_x) TYPE c
value(iyl_fval_x) TYPE any.
CLEAR wa_it_bdc_data.
wa_it_bdc_data-fnam = iyl_fnam_x.
wa_it_bdc_data-fval = iyl_fval_x.
APPEND wa_it_bdc_data TO it_bdc_data.
ENDFORM. " IYR_CAMPO_BDC
.....
This is only an clue to you I hope this help you!
Flávio Furlan
‎2005 Nov 16 2:32 PM
Hi
Use SUBMIT statement to call the program.Before the call use EXPORT statement to export your internal table to ABAP Memory and then use IMPORT statement to import the internal table in the 2nd BDC Program.
Hope this will solve.
Regards,
Abdul
‎2005 Nov 16 2:41 PM
Hi Amey,
Firstly Your BDC program should be written in such a way that it can be called by passing an internal table.
Then you can call that program like (For eg:)
SUBMIT zacc_jv_postings
WITH inv_file = in_file
WITH out_file = oute_file
WITH ccode = ccode
WITH dtype = dtype
WITH period = period
WITH postdate = postdate
WITH p_group = v_group
WITH p_user = p_user
WITH group = group
WITH user = user
WITH keep = keep
WITH holddate = holddate
AND RETURN.
Regards,
Raj
‎2005 Nov 16 2:46 PM
HI,
Check the below links to know how to call a program from another program
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9d7535c111d1829f0000e829fbfe/content.htm
To call Executable Programs
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/content.htm
To call transactions
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9da935c111d1829f0000e829fbfe/content.htm
To pass data between programs
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/content.htm
Hope the links are useful to you.
Regards,
Vara
‎2005 Nov 16 3:19 PM
Declare the internal table in a common part of both programs. The contents will then be known to the submitted program. From F1 on 'common':
DATA: BEGIN OF COMMON PART c,
END OF COMMON PART. Rob
‎2005 Nov 16 3:25 PM
Pls use submit.
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET 'VARIANT1'
AND RETURN.
Befor this just export yuour internal table to the memory .
Then import in your bdc progrm
‎2005 Nov 16 5:05 PM
Hi Amey,
For this you gotta use the submit statement. Keep in mind the way the submit program is to be called, i.e., via selection screen or via job(background). Following is how you have to use the submit statement:
SUBMIT <BDC Program>
TO SAP-SPOOL
IMMEDIATELY ' ' DESTINATION '' KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
USER sy-uname VIA JOB <JOB NAME> NUMBER <JOB NUMBER>
WITH <SELECT-OPTIONS ON BDC Program Selection Screen> IN <INTERNAL TABLE>
AND RETURN.
In this way you can call the BDC program and come back to your calling program and do further processing.
If you do not want to submit the job, the following lines can be removed from the above code extract:
TO SAP-SPOOL
IMMEDIATELY ' ' DESTINATION '' KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
USER sy-uname VIA JOB <JOB NAME> NUMBER <JOB NUMBER>
Cheers,
Naveen.