Skip to Content
author's profile photo
Former Member

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

<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>

              Add comment
              10|10000 characters needed characters exceeded

              • Follow
              • Get RSS Feed

              7 Answers

              • Best Answer
                author's profile photo
                Former Member
                Posted on Sep 28, 2007 at 07:16 AM

                i think i have a solution for ur requirement, there is a button with two ++ sign on the screen, and if u move mouse onto in, it says 'Add Items ++'.

                after your first seven enteries are entered using BDC, u need to press that button, it creates a new line space for new record to be entered at end of Table control, in your case it is 7th row, so you can loop the remaining records one by one onto that 7th roe and place your OK_CODE of BDC of that button in loop.

                I think u might need to record the BDC again, it will help...

                Reward points if useful, get back in case of query...

                Cheers!!!

                Add comment
                10|10000 characters needed characters exceeded

              • author's profile photo
                Former Member
                Posted on Sep 28, 2007 at 04:44 AM

                hi,

                while recording when u enter record in table control use option edit inser tnew line item and then enter the records in table control after entering the first record and again go for edit insert new line item and save the recording it will take it as loop.

                now it will generate function code for table control use this in performs it works.

                u can use field name which is common both in header and items, or u can use

                unique identifier field which can identify the new record.

                regards

                siva.

                Add comment
                10|10000 characters needed characters exceeded

                • Sam,

                  Unfortunately it looks like there's no BAPI available to do the GL park. Yes, you are right that the BAPI I mentioned is for invoices and will need PO info etc....so its no good for you.

                  Two things you might want to try:

                  1. Find out if there's any other transaction for parking GL where screen do not have table controls - ask your func consultant. What about FB01? There's an option to park here - meubar Document->Park. Will this be ok if you used FB01?

                  Failling the above,

                  2. Debug the tcode FV50 when you click "Park". See what FM's the system is using to park the doc - try to follow the same after you debugged the module.

                  Hope this helps,

                  Cheers,

                  Sougata.

              • author's profile photo
                Former Member
                Posted on Sep 28, 2007 at 04:26 AM

                hi ,

                u must clear the ch3...

                u call like this..

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

                LOOP AT t_bdc_document_item_main INTO wa_bdc_document_item_main.

                at new <field-name>.

                idx = idx + 1.

                ch3 = idx.

                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)'.

                entat.

                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.

                      at end of <field-name>

                      idx = 0.

                      endat.

                      i hope it will clear that error ..

                      check it out..

                      thanks..

                      endat.

                    Add comment
                    10|10000 characters needed characters exceeded

                    • Former Member Former Member

                      hi ..

                      field-name means ( i am giving one example in MARA table MATNR is the primary key field ) like wise in your table which one is primary key ? that field name u give over there..

                      send me if u have any doubt..

                      thanks.

                      baskar

                  • author's profile photo
                    Former Member
                    Posted on Sep 28, 2007 at 04:22 AM

                    hi,

                    check this is bdc for multiple line items,

                    REPORT z_xd01_bdc_session

                    NO STANDARD PAGE HEADING LINE-SIZE 255.

                    INCLUDE <icon>.

                    *----


                    • DATA DELEClARATION

                    *----


                    DATA: BEGIN OF it_input OCCURS 0,

                    kunnr LIKE kna1-kunnr,

                    ktokd LIKE kna1-ktokd,

                    name1 LIKE kna1-name1,

                    sortl LIKE kna1-sortl,

                    land1 LIKE kna1-land1,

                    spras LIKE kna1-spras,

                    lzone LIKE kna1-lzone,

                    banks LIKE knbk-banks,

                    bankl LIKE knbk-bankl,

                    bankn LIKE knbk-bankn,

                    END OF it_input.

                    DATA: BEGIN OF it_header OCCURS 0,

                    kunnr LIKE kna1-kunnr,

                    ktokd LIKE kna1-ktokd,

                    name1 LIKE kna1-name1,

                    sortl LIKE kna1-sortl,

                    land1 LIKE kna1-land1,

                    spras LIKE kna1-spras,

                    lzone LIKE kna1-lzone,

                    END OF it_header.

                    DATA: BEGIN OF it_item OCCURS 0,

                    kunnr LIKE kna1-kunnr,

                    banks LIKE knbk-banks,

                    bankl LIKE knbk-bankl,

                    bankn LIKE knbk-bankn,

                    END OF it_item.

                    DATA: BEGIN OF it_messages OCCURS 0,

                    msg_type(1),

                    msg_text(70),

                    END OF it_messages.

                    DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,

                    it_params LIKE ctu_params.

                    DATA: g_file TYPE string,

                    g_cnt(2) TYPE n,

                    g_field(20) TYPE c,

                    g_msg(1) TYPE c VALUE 'E',

                    g_msg1(1) TYPE c VALUE 'S'.

                    *----


                    • Selection Screen.

                    *----


                    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

                    PARAMETER: p_file LIKE rlgrap-filename,

                    p_group LIKE apqi-groupid.

                    SELECTION-SCREEN: END OF BLOCK b1.

                    *----


                    • initialization.

                    *----


                    INITIALIZATION.

                    it_params-defsize = 'X'.

                    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

                    *F4 help to get the file name,

                    CALL FUNCTION 'F4_FILENAME'

                    EXPORTING

                    program_name = syst-cprog

                    dynpro_number = syst-dynnr

                    field_name = ' '

                    IMPORTING

                    file_name = p_file.

                    *----


                    • start-of-selection.

                    *----


                    START-OF-SELECTION.

                    PERFORM f1000_upload_file.

                    LOOP AT it_input.

                    MOVE-CORRESPONDING it_input TO it_header.

                    MOVE-CORRESPONDING it_input TO it_item.

                    APPEND it_header.

                    APPEND it_item.

                    CLEAR it_header.

                    CLEAR it_item.

                    ENDLOOP.

                    SORT it_header BY kunnr.

                    SORT it_item BY kunnr.

                    DELETE ADJACENT DUPLICATES FROM it_header COMPARING kunnr.

                    PERFORM open_group.

                    LOOP AT it_header.

                    REFRESH it_bdcdata.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0100'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'RF02D-KTOKD'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '/00'.

                    PERFORM bdc_field USING 'RF02D-KUNNR'

                    it_header-kunnr.

                    PERFORM bdc_field USING 'RF02D-KTOKD'

                    it_header-ktokd.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0110'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNA1-NAME4'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '/00'.

                    PERFORM bdc_field USING 'KNA1-NAME1'

                    it_header-name1.

                    PERFORM bdc_field USING 'KNA1-SORTL'

                    it_header-sortl.

                    PERFORM bdc_field USING 'KNA1-LAND1'

                    it_header-land1.

                    PERFORM bdc_field USING 'KNA1-SPRAS'

                    it_header-spras.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0120'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNA1-LZONE'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '/00'.

                    PERFORM bdc_field USING 'KNA1-LZONE'

                    it_header-lzone.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0125'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNA1-NIELS'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '/00'.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNBK-BANKN(01)'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '=ENTR'.

                    READ TABLE it_item WITH KEY kunnr = it_header-kunnr.

                    IF sy-subrc = 0.

                    g_cnt = 01.

                    LOOP AT it_item FROM sy-tabix.

                    IF it_item-kunnr = it_header-kunnr.

                    • PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.

                    • PERFORM bdc_field USING 'BDC_CURSOR'

                    • 'KNBK-BANKN(01)'.

                    • PERFORM bdc_field USING 'BDC_OKCODE'

                    • '=ENTR'.

                    *

                    CONCATENATE 'KNBK-BANKS( ' g_cnt ')' INTO g_field.

                    PERFORM bdc_field USING g_field

                    it_item-banks.

                    CONCATENATE 'KNBK-BANKL( ' g_cnt ')' INTO g_field.

                    PERFORM bdc_field USING g_field

                    it_item-bankl.

                    CONCATENATE 'KNBK-BANKN( ' g_cnt ')' INTO g_field.

                    PERFORM bdc_field USING g_field

                    it_item-bankn.

                    g_cnt = g_cnt + 01.

                    ELSE.

                    EXIT.

                    ENDIF.

                    ENDLOOP.

                    ENDIF.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0130'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNBK-BANKS(01)'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '=ENTR'.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0340'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'RF02D-KUNNR'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '=ENTR'.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0370'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'RF02D-KUNNR'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '=ENTR'.

                    PERFORM bdc_field USING 'KNA1-CIVVE'

                    'X'.

                    PERFORM bdc_dynpro USING 'SAPMF02D' '0360'.

                    PERFORM bdc_field USING 'BDC_CURSOR'

                    'KNVK-NAMEV(01)'.

                    PERFORM bdc_field USING 'BDC_OKCODE'

                    '=ENTR'.

                    PERFORM bdc_insert.

                    • PERFORM bdc_transaction USING 'XD01'.

                    ENDLOOP.

                    PERFORM close_group.

                    PERFORM display_messages.

                    &----


                    *& Form open_group

                    &----


                    FORM open_group .

                    CALL FUNCTION 'BDC_OPEN_GROUP'

                    EXPORTING

                    client = sy-mandt

                    group = p_group

                    • HOLDDATE = FILLER8

                    keep = 'X'

                    user = sy-uname

                    EXCEPTIONS

                    client_invalid = 1

                    destination_invalid = 2

                    group_invalid = 3

                    group_is_locked = 4

                    holddate_invalid = 5

                    internal_error = 6

                    queue_error = 7

                    running = 8

                    system_lock_error = 9

                    user_invalid = 10

                    OTHERS = 11.

                    IF sy-subrc <> 0.

                    EXIT.

                    ELSE.

                    PERFORM f1100_format_messages USING g_msg1 text-i02.

                    ENDIF.

                    .

                    ENDFORM. " open_group

                    &----


                    *& Form f1000_upload_file

                    &----


                    FORM f1000_upload_file .

                    g_file = p_file.

                    CALL FUNCTION 'GUI_UPLOAD'

                    EXPORTING

                    filename = g_file

                    filetype = 'ASC'

                    has_field_separator = 'X'

                    TABLES

                    data_tab = it_input

                    EXCEPTIONS

                    file_open_error = 1

                    file_read_error = 2

                    no_batch = 3

                    gui_refuse_filetransfer = 4

                    invalid_type = 5

                    no_authority = 6

                    unknown_error = 7

                    bad_data_format = 8

                    header_not_allowed = 9

                    separator_not_allowed = 10

                    header_too_long = 11

                    unknown_dp_error = 12

                    access_denied = 13

                    dp_out_of_memory = 14

                    disk_full = 15

                    dp_timeout = 16

                    OTHERS = 17.

                    IF sy-subrc <> 0.

                    PERFORM f1100_format_messages USING g_msg text-i11.

                    EXIT.

                    ELSE.

                    PERFORM f1100_format_messages USING g_msg1 text-i01.

                    ENDIF.

                    ENDFORM. " f1000_upload_file

                    &----


                    *& Form close_group

                    &----


                    FORM close_group .

                    CALL FUNCTION 'BDC_CLOSE_GROUP'

                    EXCEPTIONS

                    not_open = 1

                    queue_error = 2

                    OTHERS = 3.

                    IF sy-subrc <> 0.

                    EXIT.

                    ELSE.

                    PERFORM f1100_format_messages USING g_msg1 text-i04.

                    ENDIF.

                    ENDFORM. " close_group

                    &----


                    *& Form bdc_insert

                    &----


                    FORM bdc_insert .

                    CALL FUNCTION 'BDC_INSERT'

                    EXPORTING

                    tcode = 'XD01'

                    ctuparams = it_params

                    TABLES

                    dynprotab = it_bdcdata

                    EXCEPTIONS

                    internal_error = 1

                    not_open = 2

                    queue_error = 3

                    tcode_invalid = 4

                    printing_invalid = 5

                    posting_invalid = 6

                    OTHERS = 7.

                    IF sy-subrc <> 0.

                    EXIT.

                    ENDIF.

                    ENDFORM. " bdc_insert

                    &----


                    *& Form bdc_dynpro

                    &----


                    FORM bdc_dynpro USING program

                    dynpro.

                    CLEAR it_bdcdata.

                    it_bdcdata-program = program.

                    it_bdcdata-dynpro = dynpro.

                    it_bdcdata-dynbegin = 'X'.

                    APPEND it_bdcdata.

                    ENDFORM. " bdc_dynpro

                    &----


                    *& Form BDC_FIELD

                    &----


                    FORM bdc_field USING fnam fval.

                    CLEAR it_bdcdata.

                    it_bdcdata-fnam = fnam.

                    it_bdcdata-fval = fval.

                    APPEND it_bdcdata.

                    ENDFORM. "BDC_FIELD

                    &----


                    *& Form f1100_format_messages

                    &----


                    • text

                    ----


                    • -->P_G_MSG text

                    • -->P_TEXT_001 text

                    ----


                    FORM f1100_format_messages USING p_g_msg

                    p_text.

                    it_messages-msg_type = p_g_msg.

                    it_messages-msg_text = p_text.

                    APPEND it_messages.

                    ENDFORM. " f1100_format_messages

                    &----


                    *& Form display_messages

                    &----


                    FORM display_messages .

                    WRITE:/1(106) sy-uline.

                    WRITE:/1 sy-vline,2 'msgtype',

                    7 sy-vline,8 'msgtext',

                    106 sy-vline.

                    WRITE:/1(106) sy-uline.

                    LOOP AT it_messages.

                    IF it_messages-msg_type = 'E'.

                    WRITE:/1 sy-vline,2 icon_led_red AS ICON,

                    7 sy-vline,8 it_messages-msg_text,

                    106 sy-vline.

                    ELSE.

                    WRITE:/1 sy-vline,2 icon_led_green AS ICON,

                    7 sy-vline,8 it_messages-msg_text,

                    106 sy-vline.

                    ENDIF.

                    WRITE:/1(106) sy-uline.

                    ENDLOOP.

                    ENDFORM. " display_messages

                    regards

                    siva

                    Add comment
                    10|10000 characters needed characters exceeded

                  • author's profile photo
                    Former Member
                    Posted on Sep 28, 2007 at 04:22 AM

                    hi Sam,

                    Try to use insert option in near the table control while inserting the records in the table control, so there is no need to use page down , if u use page down then for screens with different resoultion it won't work.

                    regards,

                    Santosh Thorat

                    Add comment
                    10|10000 characters needed characters exceeded

                    • Former Member Former Member

                      Hi sam,

                      Try to record the t-code with the insert option near the table control.

                      there might be some function-code for that insert button, and then

                      loop the internal table for no of lines u want to enter in the table control as per ur internal table record and use the insert function - code.

                      regards,

                      Santosh Thorat

                  • Posted on Sep 28, 2007 at 04:36 AM

                    Hi Sam Williams,

                    Your approach is incorrect from the begining. You should have used BAPI_INCOMINGINVOICE_PARK to do the parking and not use BDC on EnjoySAP screens including table control. if you keep doing this BDC stuff, it may work at some point but by that time you would have lost your job :-D

                    So, chuck the BDC program in the rubbish bin and create a new program mapping the fields to the import/export parameters of the BAPI then call the BAPI_INCOMINGINVOICE_PARK and don't forget to call BAPI_TRANSACTION_COMMIT after that.

                    Hope you still have your job! 😊

                    Cheers,

                    Sougata.

                    Add comment
                    10|10000 characters needed characters exceeded

                  • author's profile photo
                    Former Member
                    Posted on Sep 28, 2007 at 04:39 AM
                    Add comment
                    10|10000 characters needed characters exceeded