Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can we merge 2 BDC programs.

Former Member
0 Likes
796

Hi Gurus..

I have a doubt in BDCs... Can we merge 2 BDC programs of the same TCode. Like.. for the T-code F-02 there will be a header and line items. So I want to do a recoding and a program for the header and call the program for next line item. Is this possible????

Hi Gurus..

I have a doubt in BDCs... Can we merge 2 BDC programs of the same TCode. Like.. for the T-code F-02 there will be a header and line items. So I want to do a recoding and a program for the header and call the program for next line item. Is this possible????

4 REPLIES 4
Read only

Former Member
0 Likes
731

I think u cant write separate programs 4 2 BDCs .

Whts ur requirement? so i can suggest u.

Read only

0 Likes
731

The problem is I have to write a BDC for the Tcode F-02. Here we have header and a line item. The loop must start with the header.. the again the loop must run for line items(nested loop) then at some point the loop for line items end. Again it will start with header and it continues....

Read only

0 Likes
731

Friend ,

u can do it in one programe only.

its logic is same as table control BDC.

use on change of.

jst go thr this code.

if ur document will change on change of referance field.

sort ta_upload by xblnr.

loop at ta_upload into wa_upload.

  • Header Information

  • at new xblnr.

on change of wa_upload-xblnr.

clear : tp_docdat, tp_pdat, tp_bukrs, tp_refno, tp_invno, tp_pk, tp_sgl, tp_accno, tp_newccode,

tp_cc, tp_io, tp_wbs, w_wrbtr, tp_amt, tp_txt .

if tp_lineitem eq 0.

write: wa_upload-bldat to tp_docdat yymmdd,

wa_upload-budat to tp_pdat yymmdd.

move: wa_upload-bukrs to tp_bukrs,

wa_upload-refno to tp_refno,

wa_upload-xblnr to tp_invno,

wa_upload-newbs to tp_pk,

wa_upload-newum to tp_sgl,

wa_upload-newko to tp_accno,

wa_upload-newbk to tp_newccode,

wa_upload-kostl to tp_cc,

wa_upload-aufnr to tp_io,

wa_upload-ps_posid to tp_wbs,

wa_upload-wrbtr to w_wrbtr,

wa_upload-sgtxt to tp_txt.

endif.

perform bdc_dynpro using 'SAPMF05A' '0100'.

perform bdc_field using :

'BDC_OKCODE' '/00',

'BKPF-BLDAT' tp_docdat,

'BKPF-BLART' cn_kr,

'BKPF-BUKRS' tp_bukrs,

'BKPF-BUDAT' tp_pdat,

'BKPF-WAERS' cn_rm,

'BKPF-XBLNR' tp_invno,

'BKPF-BKTXT' tp_refno,

'RF05A-NEWBS' tp_pk,

'RF05A-NEWKO' tp_accno,

'RF05A-NEWUM' tp_sgl.

tp_amt = w_wrbtr.

tp_lineitem = 1. "Activate Line item Check.

continue.

endon.

  • endat.

  • First Line Item Amount is forwarded

if tp_lineitem eq 1.

perform bdc_dynpro using 'SAPMF05A' '0302'.

perform bdc_field using : 'BDC_OKCODE' '/00',

'BSEG-WRBTR' tp_amt,

'BSEG-SGTXT' tp_txt,

'RF05A-NEWBS' wa_upload-newbs,

'RF05A-NEWKO' wa_upload-newko,

'RF05A-NEWBK' wa_upload-newbk.

perform bdc_dynpro using 'SAPLFWTD' '0100'.

perform bdc_field using : 'BDC_CURSOR' 'WITH_ITEM-WT_WITHCD(01)',

'BDC_OKCODE' '=GO'.

tp_lineitem = 2.

tp_amt = wa_upload-wrbtr.

tp_txt = wa_upload-sgtxt.

tp_cc = wa_upload-kostl.

tp_io = wa_upload-aufnr.

tp_wbs = wa_upload-ps_posid.

tp_newccode = wa_upload-newbk.

  • Convert GL account to internal format.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = wa_upload-newko

importing

output = tp_saknr.

  • Check whether the GL account require tax code.

select single mwskz from skb1 into tp_mwskz

where bukrs = tp_newccode

and saknr = tp_saknr.

if sy-subrc ne 0.

clear tp_mwskz.

endif.

if tp_mwskz = '*'.

tp_mwskz = cn_s0.

endif.

continue.

endif.

if tp_lineitem eq 2.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using : 'BDC_CURSOR' 'RF05A-NEWBK',

'BDC_OKCODE' '/00',

'BSEG-WRBTR' tp_amt,

'BSEG-MWSKZ' tp_mwskz,

'BSEG-SGTXT' tp_txt,

'RF05A-NEWBS' wa_upload-newbs,

'RF05A-NEWKO' wa_upload-newko,

'RF05A-NEWBK' wa_upload-newbk.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using : 'BDC_CURSOR' 'COBL-KOSTL',

'BDC_OKCODE' '=ENTE',

'COBL-KOSTL' tp_cc,

'COBL-AUFNR' tp_io,

'COBL-PS_POSID' tp_wbs.

tp_amt = wa_upload-wrbtr.

tp_txt = wa_upload-sgtxt.

tp_cc = wa_upload-kostl.

tp_io = wa_upload-aufnr.

tp_wbs = wa_upload-ps_posid.

  • continue.

endif.

  • Save Document ***************************************

at end of xblnr.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using : 'BDC_OKCODE' 'BU',

'BSEG-WRBTR' tp_amt, "wa_upload-wrbtr,

'BSEG-MWSKZ' cn_s0,

'BSEG-SGTXT' tp_txt.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using : 'BDC_CURSOR' 'COBL-KOSTL',

'BDC_OKCODE' '=ENTE',

'COBL-KOSTL' tp_cc, " wa_upload-kostl,

'COBL-AUFNR' tp_io, "wa_upload-aufnr,

'COBL-PS_POSID' tp_wbs. "wa_upload-ps_posid.

tp_lineitem = 0.

perform insertion tables ta_bdcdata using tp_tcode.

refresh ta_bdcdata.

  • perform insertion tables ta_bdcdata using tp_tcode.

endat.

endloop.

Read only

0 Likes
731

If possible can u send the detail program for F-02??