Skip to Content
0
Jan 18, 2013 at 03:13 PM

Scroll down in BDC using table control.

973 Views

Hi Experts,

I am using BDC for transaction LB01. There is 11 line items. At a time 9 items are processing in BDC. after that I need to scroll down. My code is below:

LOOP AT t_ltbk INTO w_ltbk.
REFRESH t_bdctab.
PERFORM sub_fill_bdc.
* For creating duplicate TR
CALL TRANSACTION 'LB01' USING t_bdctab
MODE 'A'
UPDATE 'S'
MESSAGES INTO t_msgtab.
CLEAR w_ltbk. " Marked
ENDLOOP.


FORM sub_fill_bdc .

DATA l_pdatu TYPE char10. " For converting date format to DDMMYYYY
CLEAR l_pdatu.

PERFORM bdc_dynpro USING 'SAPML02B' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LTBK-TBPRI'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LTBK-LGNUM'
g_zwhouse. " Warehouse number: 101
PERFORM bdc_field USING 'LTBK-BWLVS'
g_zwmmvt. " Movement type: 908
PERFORM bdc_field USING 'LTBK-BENUM'
w_ltbk-benum.
PERFORM bdc_field USING 'LTBK-BETYP'
w_ltbk-betyp.
CONCATENATE w_ltbk-pdatu+6(2) w_ltbk-pdatu+4(2) w_ltbk-pdatu+0(4) INTO l_pdatu
SEPARATED BY '.'.
PERFORM bdc_field USING 'LTBK-PDATU'
l_pdatu.
PERFORM bdc_field USING 'LTBK-PZEIT'
w_ltbk-pzeit.
PERFORM bdc_field USING 'LTBK-TBPRI'
w_ltbk-tbpri.

PERFORM bdc_dynpro USING 'SAPML02B' '1105'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RL02B-LGORT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
****************************************************************
************ For passing item details into BDC screen
****************************************************************

DATA : l_fnam(20) TYPE c, " Local variable for BDCDATA field name
l_idx(2) TYPE c, " Local index variable
l_menga TYPE char30." Local variable for Transfer Requirement Quantity in Altern

CLEAR: l_fnam,l_idx,l_menga.
MOVE 1 TO l_idx.
CONDENSE l_idx.

LOOP AT t_ltbp INTO w_ltbp WHERE lgnum = w_ltbk-lgnum AND
tbnum = w_ltbk-tbnum.
PERFORM bdc_field USING 'RL02B-WERKS'
w_ltbp-werks.
PERFORM bdc_field USING 'RL02B-LGORT'
w_ltbp-lgort.
CONCATENATE 'LTBP-MATNR(' l_idx ')' INTO l_fnam.
PERFORM bdc_field USING l_fnam
w_ltbp-matnr.

CONCATENATE 'LTBP-MENGA(' l_idx ')' INTO l_fnam.
l_menga = w_ltbp-menga. " Converting from QUAN to CHAR format
CONDENSE l_menga. " Eliminating all blank speces
PERFORM bdc_field USING l_fnam
l_menga.

CONCATENATE 'LTBP-ALTME(' l_idx ')' INTO l_fnam.
PERFORM bdc_field USING l_fnam
w_ltbp-altme.
l_idx = l_idx + 1.
IF l_idx = 10.
PERFORM bdc_dynpro USING 'SAPML02B' '1105'.
* PERFORM bdc_field USING 'BDC_CURSOR'
* 'RL02B-LGORT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE'

'=P+'.

ENDIF.
ENDLOOP.

****************************************************************
PERFORM bdc_dynpro USING 'SAPML02B' '1105'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LTBP-MATNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AK'.
PERFORM bdc_field USING 'RL02B-WERKS'
'1010'.
PERFORM bdc_field USING 'RL02B-LGORT'
'1010'.
****************************************************************
************ Another header details
****************************************************************

PERFORM bdc_dynpro USING 'SAPML02B' '0104'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LTBK-LZNUM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'LTBK-BENUM'
w_ltbk-benum.
PERFORM bdc_field USING 'LTBK-TBPRI'
w_ltbk-tbpri.
PERFORM bdc_field USING 'LTBK-PDATU'
l_pdatu.

PERFORM bdc_field USING 'LTBK-PZEIT'
w_ltbk-pzeit.
PERFORM bdc_field USING 'LTBK-LZNUM'
w_ltbk-lznum.


ENDFORM. " SUB_FILL_BDC

But my BDC scroll is not working properly. Upto 9th items , this ok. But next is not processing for 10th and 11th. How to solve this??

Regards,

Arindam Samanta.