Skip to Content
0
Former Member
Sep 28, 2007 at 04:18 AM

Need URGENT help in BDC program.....Please Please

215 Views

<b>Gurus,</b>

I need urgent help on this issue otherwise i will loose my job it seems...please help.....

I have written a BDC program for parking a FI document thru FV50L transaction....i have used table control on this code...but it doesnt work...i am also using OPTIONS...

If i set options-defsize = 'X' and then run the code it fills the line items untill only 7 rows after that it gives error...

IF i dont set defsize then it just fills 10 rows and then stops....

I have tried doing Page Up in the code it also doesnt work....I am attaching the entire code.....please please look into it and help me here....

<b>BDC CODE:</b>

PERFORM bdc_dynpro TABLES t_bdcdata USING 'SAPLACHD' '1000'.

PERFORM bdc_field TABLES t_bdcdata USING 'BDC_CURSOR'

'BKPF-BUKRS'.

PERFORM bdc_field TABLES t_bdcdata USING 'BDC_OKCODE'

'=ENTR'.

PERFORM bdc_field TABLES t_bdcdata USING 'BKPF-BUKRS'

wa_document_header-comp_code.

PERFORM bdc_dynpro TABLES t_bdcdata USING 'SAPMF05A'

'1001'.

PERFORM bdc_field TABLES t_bdcdata USING 'BDC_OKCODE'

'=PBBP'.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BLDAT'

wa_document_header-doc_date.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-LDGRP'

var_ledger.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BUDAT'

wa_document_header-pstng_date.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-XBLNR'

wa_document_header-ref_doc_no.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BKTXT'

wa_document_header-header_txt.

PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BLART'

wa_document_header-doc_type.

PERFORM bdc_field TABLES t_bdcdata USING 'BDC_CURSOR'

'ACGL_ITEM_GEN-GEN_CHAR2(02)'.

******Loop at the BDC Table to fill each line of items

LOOP AT t_bdc_document_item_main INTO wa_bdc_document_item_main.

idx = idx + 1.

ch3 = idx.

CONCATENATE 'ACGL_ITEM-HKONT('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_hkont.

CONCATENATE 'ACGL_ITEM-SHKZG('ch3')' INTO fname.

*****Transaction takes only H or S for Debit/Credit Indicator

IF wa_bdc_document_item_main-v_shkzg = 'C'.

var_shkzg = 'H'.

ELSEIF wa_bdc_document_item_main-v_shkzg = 'D'.

var_shkzg = 'S'.

ENDIF.

PERFORM bdc_field TABLES t_bdcdata USING fname

var_shkzg.

CONCATENATE 'ACGL_ITEM-WRBTR('ch3')' INTO fname.

MOVE: wa_bdc_document_item_main-v_wrbtr TO amount.

PERFORM bdc_field TABLES t_bdcdata USING fname

amount.

CONCATENATE 'ACGL_ITEM-SGTXT('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_sgtxt.

CONCATENATE 'ACGL_ITEM-PRCTR('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_prctr.

CONCATENATE 'ACGL_ITEM-KOSTL('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_kostl.

CONCATENATE 'ACGL_ITEM-BEWAR('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_bewar.

CONCATENATE 'ACGL_ITEM-VBUND('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_vbund.

CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR1('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_yylob.

CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR2('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_yycsg.

CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR3('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_yyprg.

CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR4('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_yydch.

CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR5('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_yymay.

CONCATENATE 'ACGL_ITEM-ZZITY('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzity.

CONCATENATE 'ACGL_ITEM-ZZSOU('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzsou.

CONCATENATE 'ACGL_ITEM-ZZPRO('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzpro.

CONCATENATE 'ACGL_ITEM-ZZACY('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzacy.

  • DI Fields added on 9/21/07

CONCATENATE 'ACGL_ITEM-ZZDIRNNAM('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdirnnam.

CONCATENATE 'ACGL_ITEM-ZZDIRNTYP('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdirntyp.

CONCATENATE 'ACGL_ITEM-ZZDIRNNUM('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdirnnum.

CONCATENATE 'ACGL_ITEM-ZZDIFLNAM('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdiflnam.

CONCATENATE 'ACGL_ITEM-ZZDIJRNID('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdijrnid.

CONCATENATE 'ACGL_ITEM-ZZDIJRNLNK('ch3')' INTO fname.

PERFORM bdc_field TABLES t_bdcdata USING fname

wa_bdc_document_item_main-v_zzdijrnlnk.

  • End of Changes.

  • Create options value for call transaction

  • options-defsize = 'X'.

  • options-updmode = ''.

  • options-dismode = 'A'. "N - No Display A - Display All

    options-nobinpt = 'X'.

    **Changes made

    • if ch3 >= 7.

    *

    • perform bdc_field TABLES t_bdcdata using 'BDC_OKCODE'

    • '=P+'.

    *

    • perform bdc_dynpro TABLES t_bdcdata using 'SAPMF05A'

    • '1001'.

    • perform bdc_field TABLES t_bdcdata using 'BDC_OKCODE'

    • '/00'.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BLDAT'

    • wa_document_header-doc_date.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-LDGRP'

    • var_ledger.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BUDAT'

    • wa_document_header-pstng_date.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-XBLNR'

    • wa_document_header-ref_doc_no.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BKTXT'

    • wa_document_header-header_txt.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'ACGL_HEAD-BLART'

    • wa_document_header-doc_type.

    *

    • PERFORM bdc_field TABLES t_bdcdata USING 'BDC_CURSOR'

    • 'ACGL_ITEM_GEN-GEN_CHAR2(07)'.

    *

    *

    *

    • endif.

    **end of changes.

    ENDLOOP.

    CALL TRANSACTION 'FV50L' USING t_bdcdata MESSAGES INTO

    t_messages OPTIONS FROM options.

    • Loop at messages and fill tb_result and t_return table.

    LOOP AT t_messages INTO wa_messages.

    ADD 1 TO l_lines.

    CALL FUNCTION 'MESSAGE_TEXT_BUILD'

    EXPORTING

    msgid = wa_messages-msgid

    msgnr = wa_messages-msgnr

    msgv1 = wa_messages-msgv1

    msgv2 = wa_messages-msgv2

    msgv3 = wa_messages-msgv3

    msgv4 = wa_messages-msgv4

    IMPORTING

    message_text_output = wa_result-message.

    MOVE:wa_result-message TO wa_return-message,

    wa_messages-msgtyp TO wa_result-result_flag,

    wa_messages-msgv1+0(10) TO wa_result-document_number,

    wa_messages-msgv2+0(4) TO wa_result-comp_code.

    APPEND wa_result TO tb_result.

    APPEND wa_return TO t_return.

    CLEAR: wa_result,

    wa_return.

    ENDLOOP.

    return[] = t_return[].

    ENDFUNCTION.

    • Form Definition for new screen

    FORM bdc_dynpro TABLES it_bdcdata STRUCTURE bdcdata USING program

    dynpro.

    DATA: wa_bdcdata TYPE bdcdata.

    wa_bdcdata-program = program.

    wa_bdcdata-dynpro = dynpro.

    wa_bdcdata-dynbegin = 'X'.

    APPEND wa_bdcdata TO it_bdcdata.

    ENDFORM. "BDC_DYNPRO

    • Form Definition to insert new field

    FORM bdc_field TABLES it_bdcdata STRUCTURE bdcdata USING fnam fval.

    DATA: wa_bdcdata TYPE bdcdata.

    IF fval <> space.

    CLEAR wa_bdcdata.

    wa_bdcdata-fnam = fnam.

    wa_bdcdata-fval = fval.

    APPEND wa_bdcdata TO it_bdcdata.

    ENDIF.

    ENDFORM. "BDC_FIELD<b></b>