RFC in loop

hi.. i used a rfc in a loop. every time in the pass the control is taking me to the logon of the remote system.but the control is not going into the respective function module..what is the problem

HI,
It means the RFC connection is failed...Goto SM59 , and test the connection first......While testing if it opens the SAP EASY ACCESS screen of other Client then it means it is success.
Please check the same.
Regsrds,
Nagaraj

Similar Messages

  • Abt RFC & FTP---- RFC to SAPFTP failed (urgent)

    Hi all,
    my program is working fine when i execute it in SAP GUI.
    in this program i need to send some local file to FTP server from presentation server.
      actually we have a scanner through which we can scan the barcode data from barcode label.this scanner is connected to  sap test server through web console.
         so ,i can see the sap screen on the screen of scanner for this perticular transaction.
    after scanning a barcode,the barcode data comes to scanner.when i execute this report on the scanner, it is showing the error---- RFC to SAPFTP failed.
            where as this same report is working very fine on the SAP server.it can send my file from presentation server to FTP server located at some other place.
        web console is installed so i can connect scanner to SAP for this perticular transaction through web.i think, to execute on scanner is same as execute on sap server.
       This error comes while executing a Function module FTP_CONNECT which is present in my program.
       can u please tell where  is the problem?it is very urgent as they need in 1 day of time.
    code is as follows.
    FORM ftp_send using printer dir.
          data: user(64) type c value 'man',
                pwd(64) type c value 'post',
                host(64) type c value '172.160.122.30',
                cmd1(80) type c ,
                cmd2(150) type c ,
                cmd3(80) type c ,
                dest like rfcdes-rfcdest value 'SAPFTP',
                compress type c value 'N'.
    data: hdl type i,
          key type i value 26101957,
          dstlen type i.
    data: begin of result occurs 0,
          line(100) type c,
          end of result.
    data:begin of tab_oline occurs 0,
         oline(200) type c,
         end of tab_oline.
    describe field pwd length dstlen.
    LOOP AT bt.
          CLEAR tab_oline.
          CONCATENATE
          bt-userid
          bt-zdate
          bt-seq
          bt-charg
          bt-batch
          bt-matnr
          bt-menge
          bt-lgpla
          bt-lifnr
          bt-lot_code
          bt-date_code
          bt-lead_nolead
          INTO tab_oline-oline SEPARATED BY ','.
    append tab_oline.
    endloop.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
       FILENAME                      = 'c:\pabi29.txt '
       FILETYPE                      = 'DAT'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = tab_oline.
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      OTHERS                        = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    clear tab_oline.
    refresh tab_oline.
    call 'AB_RFC_X_SCRAMBLE_STRING'
      id 'SOURCE'      field pwd    id 'KEY'         field key
      id 'SCR'         field 'X'    id 'DESTINATION' field pwd
      id 'DSTLEN'      field dstlen.
    **Set FTP File Paths
    call function 'FTP_CONNECT'
      exporting
        user            = user
        password        = pwd
        host            = host
        rfc_destination = dest
      importing
        handle          = hdl.
    if sy-subrc ne 0.
    message e020 with 'RFC connection failed'.
    endif.
       DATA: zfilename(150) TYPE c,
              zfilename2(150) TYPE c.
             printer(5) TYPE c." value 'P0001'.
    CONSTANTS: dir(50) TYPE c VALUE '\SAPuser\SAPfolder\'.
    DATA: dir(50) type c.
    select single pfolder from zkt014 into dir where printer = printer.
    TEXT file name
    CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.txt'
      INTO zfilename.
      CONDENSE zfilename no-gaps.
    Done filename
      CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.done'
      INTO zfilename2.
      CONDENSE zfilename2 no-gaps.
    clear bt.
    refresh bt.
    concatenate 'put' '\pabi29.txt' zfilename
    into cmd1 separated by space.
    if cmd1 ne ' '.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd1
          compress      = compress
        tables
          data          = result
        exceptions
          command_error = 1
          tcpip_error   = 2.
      IF SY-SUBRC NE 0.
      message e021 with 'bar tender is not submited due to error in RFC'.
      endif.
      loop at result.
        write:/ result.
      endloop.
    ENDIF.
      refresh result.
    endif.
    concatenate 'rename' zfilename zfilename2 into cmd2 separated by
    space.
    if cmd2 ne ' '.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd2
        tables
          data          = result
        exceptions
          command_error = 1
          tcpip_error   = 2.
          if sy-subrc eq 0.
      MESSAGE w044(zv).
      ELSE.
      message e019 with 'RFC ftp_command problem'.
       endif.
      loop at result.
        write:/ result.
      endloop.
      refresh result.
    endif.
    if cmd3 ne ' '.
      call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = cmd3
        tables
          data          = result
        exceptions
          command_error = 1
          tcpip_error   = 2.
      loop at result.
        write:/ result.
      endloop.
      refresh result.
    endif.
    call function 'FTP_DISCONNECT'
      exporting
        handle = hdl.
    thanks in advance.
    Regards
    pabitra

    Well may be the reason is that you are running report from SAP console.
    SAPFTP is just an RFC destination which is actually pointing to an exe file on your frontend. filename is 'sapftp' and it is installed with your GUI frontend installation. May be while running through web console it is having problems accessing this file.
    As a solution, why don't you use the rfc destination for the application server. It is called SAPFTPA. So instead of ws_download, you can save the file on application server through OPEN dataset ... ABAP commands. Than from application server ftp it using the same logic as it is in existing program. Just be sure to use the rfc destination SAPFTPA.
    Hope this helps.
    Cheers.

  • Performance Issue related to RFC

    Hi All,
    Iam moving attachments from CRM to R/3 .For this Iam using RFC.If Iam attaching multiple files at a time.Do I need to call the RFC in Loop or should I call it Once for all attachments.Which gives better PERFORMANCE.
    One more thing If I call the RFC in SYNCHRONOUS  mode what happends if the server is down the other side for two to three days.
    If I call the RFC in ASYNCHRONOUS  mode I need to work on the return values of the RFC.How to handle this situation.
    Plz give me the reply as early as possible.
    Thanks,
    Saritha

    Hi,
    If an RFC Channel already exists between the client and server the same channel will be used between the systems. Hence, even calling in a loop should not be a problem. But in here the data needs to go one by one through the channel. Try to send them in a table as this goes as one chunk of data.
    In case of ASYNCHRONOUS also if  you want to receive results then the called system should be up. for this the syntax is
    CALL FUNCTION 'FM' STARTING NEW TASK DESTINATION <dest>
    PERFORMING <form> ON END OF TASK
    EXPORTING
    EXCEPTIONS
    FORM <form> USING taskname.
      RECEIVE RESULTS FROM <fm>
      IMPORTING
    ENDFORM.
    But in any case, the called system should be open for connections.
    Try if possible tRFC calls.
    Regards,
    Goutham

  • Validation of SC/PO

    Hi all,
    I am doing FI validation in SRM 4.0.Actually i am getting error based on the GL account and company code at line item which are based on the costcenter or internal order or WBS using...for this i am using FM BAPI_ACC_GL_POSTING_CHECK(RFC enabled) from R3 to SRM.the error message i am getting i was populating while creating SC/PO in the DOC_CHECK_BADI ..One strange thing is for testing i have commented the code in DOC_CHECK_BADI still i am getting the error based on GL account and company code ..firstly i thought i might be some other error but this is the same error i am getting from the BAPI_ACC_GL_POSTING_CHECK..
    I want to know is there any standard functionality that the error is coming from the backend or it is the code that i have written
    Thank you

    <b>BADI CODE IN DOC_CHECK_BADI FOR POS</b>
    For direct PO's, R/3 validation. Get PO details
    Data: WA_HEADER TYPE BBP_PDS_PO_HEADER_D,
          LT_ITEMDATA TYPE TABLE OF BBP_PDS_PO_ITEM_D,
          WA_ITEMDATA LIKE LINE OF LT_ITEMDATA,
          LT_ACC TYPE TABLE OF BBP_PDS_ACC,
          WA_ACC LIKE LINE OF LT_ACC,
          lt_bapiache08 type zbapiache08,
          lt_bapiacgl08 type table of ZBAPIACGL08,
          wa_bapiacgl08 type ZBAPIACGL08,
          lt_bapiaccr08 type table of ZBAPIACCR08,
          wa_bapiaccr08 type ZBAPIACCR08,
          lt_return type table of BAPIRET2,
          wa_return type BAPIRET2,
          wa_messages type BBP_SMESSAGES_BADI,
          lv_docdate(8),
          lv_pstngdate(8),
          lv_counter type i,
          lv_value(15),
          lv_amount(16),
          lv_len type i,
          LV_SYSID(9).
    UPDK900880
    DATA : LV_PROFIT_CTR(4).
    UPDK900880
    get purchase order details
    IF SY-UCOMM = 'SAVE' AND SY-TCODE = 'BBP_POC'.
    *IF SY-UCOMM = 'CHEC' AND SY-TCODE = 'BBP_POC'.
      CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
       EXPORTING
         I_GUID                           = IV_DOC_GUID
        I_OBJECT_ID                      =
         I_WITH_ITEMDATA                  = 'X'
       IMPORTING
         E_HEADER                         = WA_HEADER
       TABLES
         E_ITEM                           = LT_ITEMDATA
         E_ACCOUNT                        = LT_ACC
    UPDK900880
       LOOP AT LT_ACC INTO WA_ACC.
          MOVE WA_ACC-PROFIT_CTR+0(4) TO LV_PROFIT_CTR.
       ENDLOOP.
    UPDK900880
    Concatenate document date and posting date, default system date
         concatenate  sy-datum0(4) sy-datum4(2) sy-datum+6(2) into lv_docdate.
         concatenate  sy-datum0(4) sy-datum4(2) sy-datum+6(2) into lv_pstngdate.
    build structure bapiache08 of RFC BAPI_ACC_GL_POSTING_CHECK
    UPDK900880
        move:  LV_PROFIT_CTR TO lt_bapiache08-comp_code,
              wa_header-co_code to lt_bapiache08-comp_code,
    UPDK900880
              'BTUSER' to lt_bapiache08-username,
              sy-datum+0(4) to lt_bapiache08-fisc_year,
              lv_docdate to lt_bapiache08-doc_date,
              lv_pstngdate to lt_bapiache08-pstng_date,
              'SA' to lt_bapiache08-doc_type.
    build structure bapiacgl08 of RFC BAPI_ACC_GL_POSTING_CHECK
        loop at lt_acc into wa_acc.
          lv_counter = lv_counter + 1.
          move: lv_counter to wa_bapiacgl08-itemno_acc,
                wa_acc-g_l_acct to wa_bapiacgl08-gl_account,
    UPDK900880
               wa_header-co_code to wa_bapiacgl08-comp_code,
                LV_PROFIT_CTR TO wa_bapiacgl08-comp_code,
    UPDK900880
                lv_pstngdate to wa_bapiacgl08-pstng_date,
                'SA' to wa_bapiacgl08-doc_type,
                sy-datum+0(4) to wa_bapiacgl08-fisc_year.
                if wa_acc-cost_ctr is not initial.
                  move wa_acc-cost_ctr to wa_bapiacgl08-costcenter.
                elseif wa_acc-wbs_elem_e is not initial.
                  move wa_acc-wbs_elem_e to wa_bapiacgl08-wbs_element.
                elseif wa_acc-order_no is not initial.
                  move wa_acc-order_no to wa_bapiacgl08-orderid.
                endif.
                append wa_bapiacgl08 to lt_bapiacgl08.
                clear wa_bapiacgl08.
           lv_counter = lv_counter + 1.
           move: lv_counter to wa_bapiacgl08-itemno_acc,
    UPDK900880
                wa_header-co_code to wa_bapiacgl08-comp_code,
                 LV_PROFIT_CTR TO wa_bapiacgl08-comp_code,
    UPDK900880
                 '0014109889' to wa_bapiacgl08-gl_account,
                 lv_pstngdate to wa_bapiacgl08-pstng_date,
                 'SA' to wa_bapiacgl08-doc_type,
                 sy-datum+0(4) to wa_bapiacgl08-fisc_year.
           append wa_bapiacgl08 to lt_bapiacgl08.
           clear wa_bapiacgl08.
        endloop.
        clear lv_counter.
    build structure bapiaccr08 of RFC BAPI_ACC_GL_POSTING_CHECK
        loop at lt_itemdata into wa_itemdata.
          lv_counter = lv_counter + 1.
          move: lv_counter to wa_bapiaccr08-itemno_acc,
          wa_itemdata-value to wa_bapiaccr08-amt_doccur,
          'USD' to wa_bapiaccr08-currency.
          append wa_bapiaccr08 to lt_bapiaccr08.
          clear wa_bapiaccr08.
          lv_counter = lv_counter + 1.
          move wa_itemdata-value to lv_value.
          concatenate lv_value '-' into lv_amount.
          move: lv_counter to wa_bapiaccr08-itemno_acc,
          lv_amount to wa_bapiaccr08-amt_doccur,
          'USD' to wa_bapiaccr08-currency.
          append wa_bapiaccr08 to lt_bapiaccr08.
          clear wa_bapiaccr08.
        endloop.
        clear lv_counter.
    Check the SRM system
        IF SY-SYSID = 'UPD'.                                                                     "3
          LV_SYSID = 'UHD_111'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPX'.                                                                 "3
          LV_SYSID = 'SAPUHD111'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPQ'.                                                                 "3
          LV_SYSID = 'SAPUHQ100'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPP'.                                                                 "3
          LV_SYSID = 'SAPUHP100'.
          CONDENSE LV_SYSID NO-GAPS.
        ENDIF.
    RFC call
        Call Function 'BAPI_ACC_GL_POSTING_CHECK' destination LV_SYSID
        Exporting
          DOCUMENTHEADER      = lt_bapiache08
        Tables
          ACCOUNTGL           = lt_bapiacgl08
          CURRENCYAMOUNT      = lt_bapiaccr08
          RETURN              = lt_return.
        Loop at lt_return into wa_return.
          lv_len = strlen( wa_return-message ).
          if lv_len le 49.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message to wa_messages-msgv1.
               append wa_messages to et_messages.
          elseif lv_len gt 50 and lv_len le 99.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2.
                  append wa_messages to et_messages.
          elseif lv_len ge 100 and lv_len le 149.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2,
                  wa_return-message+100(49) to wa_messages-msgv3.
                  append wa_messages to et_messages.
          elseif lv_len ge 150 and lv_len le 199.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2,
                  wa_return-message+100(49) to wa_messages-msgv3,
                  wa_return-message+150(49) to wa_messages-msgv4.
                  append wa_messages to et_messages.
          endif.
          clear: wa_messages, wa_return.
        endloop.
    endif.
    <b>BADI CODE FOR DOC_CHECK_BADI FOR SCs</b>
    *---Declaration
    Data: WA_HEADER      TYPE BBP_PDS_SC_HEADER_D,
          LT_ITEMDATA    TYPE TABLE OF BBP_PDS_SC_ITEM_D,
          WA_ITEMDATA    LIKE LINE OF LT_ITEMDATA,
          LT_ACC         TYPE TABLE OF BBP_PDS_ACC,
          WA_ACC         LIKE LINE OF LT_ACC,
          lt_bapiache08  type zbapiache08,
          lt_bapiacgl08  type table of ZBAPIACGL08,
          wa_bapiacgl08  type ZBAPIACGL08,
          lt_bapiaccr08  type table of ZBAPIACCR08,
          wa_bapiaccr08  type ZBAPIACCR08,
          lt_return      type table of BAPIRET2,
          wa_return      type BAPIRET2,
          wa_messages    type BBP_SMESSAGES_BADI,
          lv_docdate(8),
          lv_pstngdate(8),
          lv_counter type i,
          lv_value(15),
          lv_amount(16),
          lv_len type i,
          LV_SYSID(9).
    *------Changes for Line item company code
    DATA : LV_PROFIT_CTR(4).
    Get SC Details
    IF ( SY-UCOMM = 'SC_CHECK' AND SY-TCODE = 'BBPSC03' ) OR ( SY-UCOMM = 'SC_ORDER' AND SY-TCODE = 'BBPSC03' ).
      CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
       EXPORTING
         I_GUID                           = IV_DOC_GUID
        I_OBJECT_ID                      =
         I_WITH_ITEMDATA                  = 'X'
       IMPORTING
         E_HEADER                         = WA_HEADER
       TABLES
         E_ITEM                           = LT_ITEMDATA
         E_ACCOUNT                        = LT_ACC
    Concatenate document date and posting date, default system date
       concatenate  sy-datum6(2) sy-datum0(4) sy-datum+4(2)  into lv_docdate.
       concatenate  sy-datum6(2) sy-datum0(4) sy-datum+4(2) into lv_pstngdate.
         concatenate  sy-datum0(4) sy-datum4(2) sy-datum+6(2) into lv_docdate.
         concatenate  sy-datum0(4) sy-datum4(2) sy-datum+6(2) into lv_pstngdate.
    build structure bapiache08 of RFC BAPI_ACC_GL_POSTING_CHECK
    *loop at LT_ITEMDATA into wa_ITEMDATA.
    move wa_itemdata-BE_CO_CODE to lt_bapiache08-comp_code.
    *endloop.
       LOOP AT LT_ACC INTO WA_ACC.
          MOVE WA_ACC-PROFIT_CTR+0(4) TO LV_PROFIT_CTR.
       ENDLOOP.
    Chnages for Line item company code
        move:  LV_PROFIT_CTR TO lt_bapiache08-comp_code,
             wa_header-co_code to lt_bapiache08-comp_code,
    End of Chnages for Line item company code
              'BTUSER' to lt_bapiache08-username,
              sy-datum+0(4) to lt_bapiache08-fisc_year,
              lv_docdate to lt_bapiache08-doc_date,
              lv_pstngdate to lt_bapiache08-pstng_date,
              'SA' to lt_bapiache08-doc_type.
    build structure bapiacgl08 of RFC BAPI_ACC_GL_POSTING_CHECK
        loop at lt_acc into wa_acc.
          lv_counter = lv_counter + 1.
          move: lv_counter to wa_bapiacgl08-itemno_acc,
                wa_acc-g_l_acct to wa_bapiacgl08-gl_account,
    Chnages for Line item company code
               wa_header-co_code to wa_bapiacgl08-comp_code,
                LV_PROFIT_CTR TO wa_bapiacgl08-comp_code,
    End of Chnages for Line item company code
                lv_pstngdate to wa_bapiacgl08-pstng_date,
                'SA' to wa_bapiacgl08-doc_type,
                sy-datum+0(4) to wa_bapiacgl08-fisc_year.
                if wa_acc-cost_ctr is not initial.
                  move wa_acc-cost_ctr to wa_bapiacgl08-costcenter.
                elseif wa_acc-wbs_elem_e is not initial.
                  move wa_acc-wbs_elem_e to wa_bapiacgl08-wbs_element.
                elseif wa_acc-order_no is not initial.
                  move wa_acc-order_no to wa_bapiacgl08-orderid.
                endif.
                append wa_bapiacgl08 to lt_bapiacgl08.
                clear wa_bapiacgl08.
           lv_counter = lv_counter + 1.
           move: lv_counter to wa_bapiacgl08-itemno_acc,
    Chnages for Line item company code
                wa_header-co_code to wa_bapiacgl08-comp_code,
                   LV_PROFIT_CTR TO wa_bapiacgl08-comp_code,
    End of Chnages for Line item company code
                 '0014109889' to wa_bapiacgl08-gl_account,
                 lv_pstngdate to wa_bapiacgl08-pstng_date,
                 'SA' to wa_bapiacgl08-doc_type,
                 sy-datum+0(4) to wa_bapiacgl08-fisc_year.
           append wa_bapiacgl08 to lt_bapiacgl08.
           clear wa_bapiacgl08.
        endloop.
        clear lv_counter.
    build structure bapiaccr08 of RFC BAPI_ACC_GL_POSTING_CHECK
        loop at lt_itemdata into wa_itemdata.
          lv_counter = lv_counter + 1.
          move: lv_counter to wa_bapiaccr08-itemno_acc,
          wa_itemdata-value to wa_bapiaccr08-amt_doccur,
          'USD' to wa_bapiaccr08-currency.
          append wa_bapiaccr08 to lt_bapiaccr08.
          clear wa_bapiaccr08.
          lv_counter = lv_counter + 1.
          move wa_itemdata-value to lv_value.
          concatenate lv_value '-' into lv_amount.
          move: lv_counter to wa_bapiaccr08-itemno_acc,
          lv_amount to wa_bapiaccr08-amt_doccur,
          'USD' to wa_bapiaccr08-currency.
          append wa_bapiaccr08 to lt_bapiaccr08.
          clear wa_bapiaccr08.
        endloop.
        clear lv_counter.
    Check the SRM system
        IF SY-SYSID = 'UPD'.                                                                     "3
          LV_SYSID = 'UHD_111'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPX'.                                                                 "3
          LV_SYSID = 'SAPUHD111'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPQ'.                                                                 "3
          LV_SYSID = 'SAPUHQ100'.
          CONDENSE LV_SYSID NO-GAPS.
        ELSEIF SY-SYSID = 'UPP'.                                                                 "3
          LV_SYSID = 'SAPUHP100'.
          CONDENSE LV_SYSID NO-GAPS.
        ENDIF.
    RFC call
        Call Function 'BAPI_ACC_GL_POSTING_CHECK' destination LV_SYSID
        Exporting
          DOCUMENTHEADER      = lt_bapiache08
        Tables
          ACCOUNTGL           = lt_bapiacgl08
          CURRENCYAMOUNT      = lt_bapiaccr08
          RETURN              = lt_return.
         break-point.
        Loop at lt_return into wa_return.
          lv_len = strlen( wa_return-message ).
          if lv_len le 49.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message to wa_messages-msgv1.
               append wa_messages to et_messages.
          elseif lv_len gt 50 and lv_len le 99.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2.
                  append wa_messages to et_messages.
          elseif lv_len ge 100 and lv_len le 149.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2,
                  wa_return-message+100(49) to wa_messages-msgv3.
                  append wa_messages to et_messages.
          elseif lv_len ge 150 and lv_len le 199.
            move: wa_return to wa_messages-msgty,
                  'BBP_PD' to wa_messages-msgid,
                  '047' to wa_messages-msgno,
                  wa_return-message+0(49) to wa_messages-msgv1,
                  wa_return-message+50(49) to wa_messages-msgv2,
                  wa_return-message+100(49) to wa_messages-msgv3,
                  wa_return-message+150(49) to wa_messages-msgv4.
                  append wa_messages to et_messages.
          endif.
          clear: wa_messages, wa_return.
        endloop.
    endif.
    This is what i wrote in BADI except this i wrote nothing ...and no where

  • Message Split or Split message in ABAP

    Hi ABAP guru,
    I am facing a difficult choise, our secnario like following:
    we will use a background job to trigger a program to collect today's new material master data, then use RFC adapter to send data to XI, XI will use JDBC receiver to insert data into Oracle DB. We will use PLANT field to distinguish which message should be sent to which DB(we have 3 plant, each plant has its own oracle DB, and only needs own data)
    Choise A:
    in the program, loop the internal table which contains many material master data, call RFC each loop, to make sure every message contains one material only.
    Choise B:
    use BPM message split pattern.
    Could please let me know, depending on your experience, which way will be better?
    If you have another choise,that will be appreciate to let me know, thank you very much for your help.

    Hi,
    to tell you the truth the best way would be to go for ABAP proxies
    this way you'd be able to send a all material to one plant
    in one message (as you can easily nest XML nodes)
    with RFC or IDOC it's jut not possible as you can only use
    tables and one header
    but still I suggest small messages over the usage of a BPM in this case
    (BTW if you have any test tool - like mercury loadrunner)
    you can create both cases and compare the performance
    in your environment
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Synchronous RFC Receiver inside of a Loop in BPM

    Hi there,
    we have a RFC -> XI scenario where a BPM needs to receive messages from a RFC inside of a loop, to bundle these messages, just like the first example here: <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/08/16163ff8519a06e10000000a114084/frameset.htm</a>.
    But the problem is that the RFC is set as synchronous (best effort), thus we need to use a receiver in "Open S/A Bridge" mode, but this mode is not available for receivers inside a loop.
    Actually, we have managed to get the scenario working by creating another BPM which just receives the RFC messages in a S/A Bridge, sends the asynchronous message to the main BPM and sends a response back to RFC, closing the S/A bridge. But I think this solution is kind of "messy".
    Is there any other cleaner way of doing it?
    Thanks in advance,
    Henrique.

    Hi Henrique,
    Read this page carefully:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/d92e428819da2ce10000000a1550b0/frameset.htm
    "Do Not Transfer Application Logic
    Do not use integration processes to transfer application logic from the application systems to the Integration Server.
    No Replacement for Mass Interfaces
    Check whether it would not be better to execute particular processing steps, for example, collecting messages, on the sender or receiver system."
    I so recommend to rewrite the sending interface to collect the messages before sending.
    Andother idea is sending the messages with an asynchronous call.
    Regards
    Stefan

  • It is possible to get a response of a asynchronous RFC call thru wait loop

    Hi Experts,
    The requirement is that i queue up all the requests from a web services ( One queue per plant for example) which i set in the HTTP sender URL ( i mean the queue name ). and i am posting the records thru a RFC call.
    1. Let the RFC call be synchronous and in case the R/3 system is done.. Will the XI queue keep the Call and keep on retrying it till the R/3 system is up.
    2. Otherwise if the RFC call be asynchronous, is it possible to introduce a wait loop in BPM to listen to the RFC till i get some response ( i think this is not possible).
    Need your suggestion on the same...
    The requirement demands that no single request from the web service should be lost.. in case of failure of R/3 they should be queued up and re tried.. Forget about the error because of exception in RFC this will be taken care manually..
    Thanks for your response in advance.

    Hi Rajesh,
    you can queue and restart only asynchronous messages. I think you can build a Business Process, where you repeat sending a message til you have success or maximum number of tries is reached. But no good idea, coz you will get timeout at HTTP sender. Aynchronous messages dont have a response.
    May be, XI can solve your task in the standard: In transaction SMQR you can just configure what you describe. All asynchronous messages will be queued and restartet in case of receiver not reachable. You can configure no of retries and intervall between.
    Regards,
    Udo

  • How to use loop in VBAK table using BDC RFC connection through excel vba ?

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

  • RFC call from ECC to XI & message looping/splitting.

    Hi,
    I have a ECC RFC that returns table. The RFC does not have any input or output parameters. The data is sent to XI from ECC. I used RFC sender adapter but there is a problem. Once data comes in I am not able to map the response as source to another message type. Is there any way we can do this. Also this RFC returns multiple entries in the table, so I have to loop thru the entries and do another lookup to ECC before mapping to destination structure.
    Thanks for your help in advance.
    Edited by: developer on Jul 9, 2008 3:18 AM

    hi developer,
    I think it is better you go for ABAP PROXYS.....try it
    regards
    kummari

  • How to loop through single XML File and send multiple RFC calls?

    I am looking for the best approach to use for making multiple RFC calls (can be sequential) using a single XML file of data.  I have been attempting to get a BPM loop working, but to no avail.  My RFC only accepts a single set of delivery input and I have been told to try to work with it as is.
    input xml sample:
    <?xml version="1.0" encoding="UTF-8"?>
    <ProofOfDelivery>
       <POD>
          <delivery_number>1</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
       <POD>
          <delivery_number>2</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
    </ProofOfDelivery>
    I need to make a synchronous RFC call for each set of POD data.
    Thanks in advance!

    Thanks for the inputs.
    I tried with a BPM and multi-mapping transformation before a ForEach block.  I am getting this error:
    Work item 000000028028: Object FLOWITEM method EXECUTE cannot be executed
    Error during result processing of work item 000000028029
    com/sap/xi/tf/_ProofOfDeliveryMultiMapping_com.sap.aii.utilxi.misc.api.BaseRuntimeExceptionRuntim
    Error: Exception CX_MERGE_SPLIT occurred (program: CL_MERGE_SPLIT_SERVICE========CP, include: CL_
    Probably because I am not making/using the container objects properly.  Here is a screenshot of my BPM.  Can anyone spot my issue or point me to an example on this sort of container use?
    [http://kdwendel.brinkster.net/images/bpm.jpg|http://kdwendel.brinkster.net/images/bpm.jpg]
    Thanks

  • How to Loop thru a RFC model

    how to Loop thru the RFC model
    for(int i=0;i<wdContext.nodeEx_Org_Units().size();i++){
    //how to get the attribute each and every columns
      //mgr.reportSuccess("id" +nodeEx_Org_Units().getId());
    Message was edited by:
            yzme yzme

    Hi,
    When there is a RFC Model with table ouptut....every row in the table can be correlated to elements in the model node...
    your model node : <i>nodeEx_Org_Units</i>
    Now if you have 5 rows as output after executing the model...there will be 5 elements created under the node. Loop through all the elements and use the get methods as given below:
    // assuming tht u have two columns(attributes) <i>col1 & col2</i>
    // access the node
    IPrivate<view>.IEx_Org_UnitsNode tableNode = wdContext.nodeEx_Org_Units();
    // access the element under the node, do not initalize this element
    IPrivate<view>.IwdContext.nodeEx_Org_UnitsElement tableElem;
    //loop thrugh the elements
    for(int i=0; i<tableNode.size(); i++)
       tableElem = tableNode.getEx_Org_UnitsElementAt(i);
       // access the attributes col1 & col2
       tableElem.getCol1();
       tableElem.getCol2();
    Regards
    Srikanth

  • Call function RFC in a loop and kill old session

    Hi,
    we have a problem with a program.
    here's a part of the code:
    DO.
        CALL FUNCTION 'YC_REFRESH_GPT_START_CM25' STARTING NEW TASK 'TEST'
          EXPORTING
            i_profile       = p_prfl
            i_werks         = p_werks
            i_arbpl_low     = s_arbpl-low
            i_arbpl_high    = s_arbpl-high
          TABLES                                              
            t_arbpl =  it_arbpl.                                
        PERFORM wait_for_refresh.
        PERFORM terminate_session.
      ENDDO.
    So the program does a call function, waits a while, then terminates the session and recalls the function.
    Apparently, like this the data should be updated.
    But in the terminate session, the session is terminated using:
    CALL 'ThUsrInfo' ID 'OPCODE'  FIELD opcode_delete_mode
                       ID 'MODE'    FIELD l_mode.
    And it works the first time, but the second time there is a dump.
    So, is there another way to achieve what this program is trying to do?
    Or is there another way to kill the session?
    Thanks!!

    Hi,
    the DLL will stay in memory as long as there is a program running which has not closed (unloaded) the DLL.
    Doing repetitive calls to the DLL is irrelevant in this context. LV opens the DLL as soon as needed and will only unload it when there is no VI in memory which has a CLN to that DLL...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Call RFC Function Module and return 1000 records at a time

    I would like to call a Remote Enabled Function Module from a non SAP system.  This function module will select data from the database and return it to the calling program.
    Suppose there are 100,000 records that need to be returned, but the calling module would like the data in chunks of 1000 records.  Therefore the calling program would call the FM 100 times. 
    How do I code the function module to know on each subsequent call to grab the next chunk of 1000 records? 
    Let me know if additional information is needed.
    Thanks,
    Aaron

    Hello,
    Here is how you can go for this issue:
    1. Create one RFC function module with following parameter. These parameters are with respective of chunking logic.
         Import: Package Size
         Export: Total number of records
         Changing: chunk count
    Implement following logic:
    1. First of you need to know how many chunks you need to fetch for that get the count of total number of records. This is one  
        time activity so you better maintain one flag import parameter will be set to 'X' only first call.
    2. Get the number of chunk using total number of records / chunk size for e.g. 1000 / 100 so chunk count = 10.
    3. Define internal chunk counter in function module which will be used to locate the correct chunk depending on the chunk
        counter value sent from calling program.
    4. Send first call with package size 100 and chunk count = 1, execute select statement and increment internal
        chunk count check if chunk count = internal chunk count in current case chunk count = 1 so exit select statement and return
        with first chunk.
    5. Send second call with package size 100 and chunk count = 2. Execute select statement and check chunk count with internal
        chunk counter, in current case it will be 1 so skip that data and go for next chunk of 100 records increment internal chunk  
        counter. In this case it will match with external chunk count = 2. load output table with that data and return to calling program.
    6. Repeat step 4 until you reach last chunk.
    You need to use SELECT...ENDSELECT with PACKAGE SIZE addition so for every loop it will return number of records mentioned in package size.
    Hope this helps.
    Thanks,
    Augustin.

  • IDES Installation error (RFC connection error)

    Hi
    Would someone help me?
    I have a problem while installing the IDES ,ECC 6.0 with MaxDB. (Linux)
    The installaiton of CI is holding in the phase " Checking the DDIC password "  and it seems a loop.
    Looking through sapinst.log ,  there is some messages.
    These messages are showing as a loop.
    INFO 2008-06-25 13:46:09
    RFC connection information checked successfully.
    ERROR 2008-06-25 13:47:10
    FRF-00007  Unable to open RFC connection.
    ERROR 2008-06-25 13:47:10
    MUT-03025  Caught ERfcExcept in Modulecall: Timeout.
    And I tried to logon ,but I didn't  because of the timeout.
    The window says "waiting for response" and the logon is over with a error,timeout.
    Any hints and advice would be helpful for me ,thanks.

    Hi,
    1. Check dailog work processes through OS level
    2. Check all profile parameters through OS level and change it according.
    3. Then try for sap logon with 000 client and password.
    After login into sap, check RFC connection within the system. using by tcode sm59.
    4. Finally you can check also MaxDB services at OS level.
    Regards,
    Srini Nookala
    Edited by: Srini Nookala on Jun 28, 2008 6:11 AM

  • RFC Failure: Processing Repairable Materials: BAPI_ALM_ORDER_MAINTAIN

    Hello,
    We are using a Function Module BAPI_ALM_ORDER_MAINTAIN Process Maintenance-/Service Order with in
    custom RFC for "Autocreate repair order" and Executes in a separate LUW,
    called in the User Exit EXIT_SAPLMBMB_001 (Customer Function Exit in the Case of Updating a Material Document),
    in the Function Module MB_POST_DOCUMENT.
    We are getting the Short Dump with RFC as Connection Closed no data, where as the Destination is NONE.
    And the respective data is locked, while de-bugging no dump is resulted, seems like before getting the connection closed data is passed to the RFC, but here Destination is NONE,

    Hello,
    Please find the following Code.
    function Z_PM_0491_REPAIR_ORDER.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(T_MSEG) TYPE  CCRCTT_MSEG
    *"     VALUE(T_MKPF) TYPE  CCRCTT_MKPF
    *"  EXCEPTIONS
    *"      PROBLEM
    Description: Autocreate repair order                       *
    Get plant value
      loop at t_mseg into lw_mseg.
      Check if udd is active
        refresh lt_dev.
        call function 'Z_PM_XXXX_DEV_GET_PARAMETERS'
        exporting
          i_udd     = lc_udd_0491
          i_werks   = lw_mseg-werks
        importing
          e_dev     = lt_dev
        exceptions
          not_found = 1
          others    = 2.
        check sy-subrc eq 0 and not lt_dev[] is initial.
      Only for movement type 261
        read table lt_dev into lw_dev index 1.
        check lw_mseg-bwart = lw_dev-zzparameter1(3).
      Check if material is repairable
        move lw_mseg-matnr to lv_objek.
        call function 'CLAF_CLASSIFICATION_OF_OBJECTS'
            EXPORTING
              classtype          = lc_class_001
              object             = lv_objek
              inherited_char     = lc_x
            TABLES
              t_class            = lt_class[]
              t_objectdata       = lt_value_class[]
            EXCEPTIONS
              no_classification  = 1
              no_classtypes      = 2
              invalid_class_type = 3
              OTHERS             = 4.
        if sy-subrc eq 0.
          read table lt_value_class into lw_value with key atnam = lc_ypm_repairable.
          if sy-subrc eq 0.
            if lw_value-ausp1 eq lc_repairable.
            Material is repairable -> get PM order data
              CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
                EXPORTING
                  NUMBER                 = lw_mseg-aufnr
                IMPORTING
                  ES_HEADER              = lw_pheader
                TABLES
                  RETURN                 = lt_bapiret2.
            Continue if data read successfully
              read table lt_bapiret2 with key type = lc_e.
              check sy-subrc ne 0.
            Refresh all tables
              clear: lw_methods, lw_header, lw_operation, lw_component, lw_extension_in.
              refresh: lt_methods, lt_header, lt_operation, lt_extension_in, lt_component, lt_return, lt_numbers.
            Prepare data for suborder creation
            Append following info in the IT_METHODS
              lw_methods-refnumber = 1.
              lw_methods-objecttype = 'HEADER'.
              lw_methods-method = lc_create.
              lw_methods-objectkey = lc_objectkey.
              append lw_methods TO lt_methods.
              lw_methods-refnumber = 1.
              lw_methods-objecttype = 'OPERATION'.
              lw_methods-method = lc_create.
              lw_methods-objectkey = lc_objectkey.
              append lw_methods TO lt_methods.
            We will create a component
              lw_methods-refnumber = 1.
              lw_methods-objecttype = 'COMPONENT'.
              lw_methods-method = lc_create.
              lw_methods-objectkey = lc_objectkey.
              append lw_methods TO lt_methods.
              lw_methods-refnumber = 1.
              lw_methods-objecttype = space.
              lw_methods-method = lc_save_method.
              lw_methods-objectkey = lc_objectkey.
              append lw_methods TO lt_methods.
            Specify header information in IT_HEADER
              lw_header-orderid = lc_orderid.
              lw_header-order_type = lw_pheader-order_type.
              lw_header-planplant = lw_pheader-planplant.
              lw_header-mn_wk_ctr = lw_pheader-mn_wk_ctr.
              lw_header-plant = lw_pheader-planplant.
              lw_header-pmacttype = lc_rev.
              lw_header-funct_loc = lw_pheader-funct_loc.
              lw_header-equipment = lw_pheader-equipment.
              lw_header-priority = lc_3.
              lw_header-start_date = sy-datum.
              lw_header-finish_date = sy-datum + lc_30.
              lw_header-short_text = lw_mseg-matnr.
              shift lw_header-short_text left deleting leading lc_0.
              concatenate lc_repairof lw_header-short_text into lw_header-short_text separated by space.
              lw_header-assembly = lw_mseg-matnr.
              append lw_header to lt_header.
            Update IT_OPERATION
              lw_operation-activity = lc_0010.
              lw_operation-control_key = lc_ypm1.
              lw_operation-plant = lw_pheader-maintplant.
              lw_operation-assembly = lw_mseg-matnr.
              lw_operation-work_cntr = lw_pheader-mn_wk_ctr.
              lw_operation-description = lw_header-short_text.
              append lw_operation to lt_operation.
            Update component in IT_COMPONENT
              lw_component-material = lw_mseg-matnr.
              lw_component-plant = lw_pheader-maintplant.
              lw_component-stge_loc = lw_mseg-lgort.
              lw_component-activity = lc_0010.
              lw_component-item_cat = lc_l.
              lw_component-requirement_quantity = - lw_mseg-menge.
              lw_component-requirement_quantity_unit = lw_mseg-meins.
              append lw_component to lt_component.
            Linking to the superior order: will happen in Badi IBAPI_ALM_ORD_MODIFY
              lw_extension_in-structure = lc_struc.
              lw_extension_in-valuepart1 = lw_mseg-aufnr.
              append lw_extension_in to lt_extension_in.
            Create subordinate order
              call function 'BAPI_ALM_ORDER_MAINTAIN'
                tables
                  it_methods = lt_methods
                  it_header = lt_header
                  it_operation = lt_operation
                  extension_in = lt_extension_in
                  it_component = lt_component
                  return = lt_return
                  et_numbers = lt_numbers.
              read table lt_return into lw_return with key type = lc_e.
              if sy-subrc ne 0.
              If all went well, commit order creation
                clear lw_return.
                call function 'BAPI_TRANSACTION_COMMIT'
                    exporting
                      wait   = 'X'
                    importing
                      return = lw_return.
              else.
              Otherwise raise exception
                raise problem.
              endif.
            endif.
          endif.
        endif.
      endloop.
    endfunction.

Maybe you are looking for

  • My apple TV is not playing my purchased TV shows

    I have purchased several TV shows on my apple TV and not had any problems so far. The last week I am unable to watch a show. When I press PLAY it just returns back to the play screen. Help?

  • Problem using lilo in archCD0.7 after upgrade to 2.6.12.2-1

    What procedure is available to permit lilo to be activated with Udev kernel using arch 0.7CD for repair? Note that arch 0.7CD uses devfs nomenclature and that chroot doesn't permit Udev statements. What can be done?

  • Currency Conversion issue for YTD model

    Hello, Currently our Client is using YTD (year to date) model to maintain data into BPC 7.5NW, and planning to use BPC for currency conversion from LC to USD. They are not converting the values in Transactional system. When performing this all Balanc

  • Are custom queries supported in BOXI R2

    Are custom queries supported in BO XI R2. What are the possible issues that may come up when a BO 6.5 report with custom query is migrated to BO XI R2.

  • How I can wire an extern WebService to BPEL?

    I have started to work with BPEL PM (2.0.10) bbpelz 0.0.95. Now I would understand how I can wire an extern WebService (like a PLSQL WebService created in JDeveloper from a package) to BPEL. Therefore I look for Examples from BPEL - AmazonFlow or Goo