‎2009 Apr 07 6:55 AM
i need to create a vendor with 8 line item of bank information through BDC and i was trying to write a program. but i'm having some problem with the code. how can i loop the program to enter 8 bank information line item for one vendor??
‎2009 Apr 07 7:56 AM
Hi,
Fill bank details in all 8 lines and then check recording .
You have to put row index depending on no of lines you want to add (below code is for withholding tax code and i am adding 2 lines)
PERFORM bdc_dynpro USING 'SAPMF02K' '0610'.
PERFORM fill_bdctab USING 'LFBW-WITHT(01)'
it_lfa1-w_tax_type13.
PERFORM fill_bdctab USING 'LFBW-WITHT(02)'
it_lfa1-w_tax_type14.
If no of lines are variable then refer to below link
[https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/bdcontable+control]
‎2009 Apr 07 8:10 AM
Use The below code
Just create a Variable and increment the value by 1 for the required bank line items in the Below screen for field LFBK-BANKN(05) here 5Line item are given while recording
Loop at Itab.
Prog dynpro dynbegin
SAPMF02K 0130 X
Fnam Fval
BDC_CURSOR LFBK-BANKN(05)
BDC_OKCODE =ENTR
LFBK-BANKS(01) IN
LFBK-BANKS(02) IN
LFBK-BANKS(03) IN
LFBK-BANKS(04) IN
LFBK-BANKS(05) IN
LFBK-BANKL(01) 16294004
LFBK-BANKL(02) VIJAYA
LFBK-BANKL(03) 00005363
LFBK-BANKL(04) 00810200003
LFBK-BANKL(05) 0510015
LFBK-BANKN(01) 12312
LFBK-BANKN(02) 12312
LFBK-BANKN(03) 12312
LFBK-BANKN(04) 12312
LFBK-BANKN(05) 12312
endloop.
‎2009 Apr 07 8:20 AM
Hi,
For this type of requirement you can use table control technic.
for that First loop the Vendors and run another loop for Bank details by checking condition about particular vendor. Then process the details into Table cotrol screen.
for ex : Loop at it into wa. "For vendors
Loop at it1 into wa1 where lifnr = wa-ifnr. "for Bank details.
Wrie necessary code to insert the bank data into table control.
endloop.
endloop.