Skip to Content

Scroll down in BDC using table control.

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2013 at 03:41 PM

    Hi Arindam ,

    Try to implement these piece of code to your program it will help you ..........

    1)------------------------------------------------------------

    • for page down

    WHILE v_position GT 19.

    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.

    PERFORM bdc_field USING 'BDC_OKCODE'

    '=P+'.

    v_position = v_position - 13.

    ENDWHILE.

    Where v_position stores the line number

    and replace 'SAPMF02K' '0320' with your program name and dynpro number

    or ,

    2)--------------------------------------------------------------

    move 1 to idx1.

    SORT idata BY code.

    LOOP AT idata WHERE code = itab1-code.

    PERFORM bdc_field USING 'BDC_CURSOR' v_mat.

    PERFORM bdc_field USING 'BDC_OKCODE' '=OK4'.

    move idx1 to idx.

    CONDENSE idx.

    CONCATENATE 'MARA-MATNR(' idx ')' INTO v_mat.

    CONCATENATE 'QTY(' idx ')' INTO v_qty.

    PERFORM bdc_field USING v_mat idata-matcode.

    PERFORM bdc_field USING v_qty idata-qty.

    perform bdc_field using 'BDC_OKCODE' '=P++'.

    idx1 = idx1 + 1.

    ENDLOOP.

    Regards,

    Amit Kumar Singh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 18, 2013 at 03:54 PM

    Hi Arindam,

    Please avoid using BDC if there is a standard BAPI available.

    You can try BAPI CSAI_BOM_CREATE instead of using BDC of LB01.

    Thanks,

    Sreekanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2013 at 04:26 PM

    Hi Arindam Samanta,

    please check the following BAPI.

    L_TO_CREATE_SINGLE

    L_TO_CREATE_MULTIPLE

    Regards,

    Gurunath Kumar D

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 21, 2013 at 10:00 AM

    Hi Arindam,

    please try the below code.

    data: n_count(02) TYPE n.

    LOOP AT t_ltbp INTO w_ltbp WHERE lgnum = w_ltbk-lgnum AND

    tbnum = w_ltbk-tbnum.

    PERFORM bdc_dynpro USING 'SAPML02B' '1105'.

    PERFORM bdc_field USING 'RL02B-WERKS'

    w_ltbp-werks.

    PERFORM bdc_field USING 'RL02B-LGORT'

    w_ltbp-lgort.

    *- incrementing the counter varaible.

    n_count = n_count + 1.

    *- concatenating the komgg-matnr(01) into komgg-matnr.

    CONCATENATE 'LTBP-MATNR('n_count')' INTO LTBP-MATNR.

    *- pass the matnr.

    perform bdc_field using LTBP-MATNR

    w_ltbp-matnr.

    CONCATENATE 'LTBP-MENGA(' n_count ')' INTO LTBP-MENGA.

    condense w_ltbp-menga.

    perform bdc_field using LTBP-MENGA

    w_ltbp-menga.

    CONCATENATE 'LTBP-ALTME('n_count ')' INTO LTBP-ALTME.

    PERFORM bdc_field USING LTBP-ALTME

    w_ltbp-ALTME.

    perform bdc_field using 'BDC_OKCODE'

    '/00'.

    *- if table control lines > 9.

    if n_count > 9.

    *- incremeting the current line index.

    perform bdc_field using 'BDC_OKCODE'

    '=P+'.

    perform bdc_field using LTBP-MATNR

    w_ltbp-matnr.

    perform bdc_field using LTBP-MENGA

    w_ltbp-menga.

    PERFORM bdc_field USING LTBP-ALTME

    w_ltbp-ALTME.

    endif.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.