freesapabapnotes.blogspot.com Open in urlscan Pro
2a00:1450:4001:829::2001  Public Scan

URL: http://freesapabapnotes.blogspot.com/
Submission: On November 10 via manual from DE — Scanned from DE

Form analysis 2 forms found in the DOM

http://www.google.com/cse

<form id="cse-search-box" action="http://www.google.com/cse">
  <div>
    <input value="partner-pub-3493499566705062:5szzisa7175" name="cx" type="hidden">
    <input value="ISO-8859-1" name="ie" type="hidden">
    <input name="q" size="31" type="text" placeholder="" style="background: url(&quot;https://www.google.com/cse/static/images/1x/en/branding.png&quot;) left 9px top 50% no-repeat rgb(255, 255, 255);">
    <input value="Search" name="sa" type="submit">
  </div>
  <input name="siteurl" value="freesapabapnotes.blogspot.com/" type="hidden"><input name="ref" value="" type="hidden"><input name="ss" value="" type="hidden">
</form>

POST http://www.feedburner.com/fb/a/emailverify

<form action="http://www.feedburner.com/fb/a/emailverify" style="border:1px solid #ccc;padding:3px;text-align:center;" target="popupwindow" method="post"
  onsubmit="window.open('http://www.feedburner.com/fb/a/emailverifySubmit?feedId=2514112', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
  <p>Enter your email address:</p>
  <p><input style="width:140px" name="email" type="text"></p><input value="http://feeds.feedburner.com/~e?ffid=2514112" name="url" type="hidden"><input value="All SAP ABAP" name="title" type="hidden"><input value="en_US" name="loc"
    type="hidden"><input value="Subscribe" type="submit">
  <p>Delivered by <a href="http://www.feedburner.com" target="_blank">FeedBurner</a></p>
</form>

Text Content

skip to main | skip to sidebar


ALL SAP ABAP NOTES

SAP,ABAP PROGRAMMING,Reports,Bdc,SAP Scripts,Smart Forms,Debugging,Internal
table,interview Questions,FAQ'S,Series of Complete Course of all major topics of
ABAP

 Subscribe in a reader






POWERED BY






THURSDAY, FEBRUARY 12, 2009


VB CODES (OR VBA MACRO CODE) FOR ACCESS SAP, AND RUN ONE RFC





I am looking for, Vb codes (or VBA macro code) for access SAP, and run one RFC .

Does anyone have example VB to SAP code?

Hakan

I can give you some code, but not sure it will work for you. When you ( or the
help desk ) installs the SAP GUI, you can also install the SAP RFC development
kit, if you do this you will have in your c:\program files\SAP??? ( in my case
C:\Program Files\SAP620 ) a folder with a .frm extension
( in my case C:\Program Files\SAP620
\SAPGUI\rfcsdk\ccsamp\RFCSamp.VB\RFCsamp.frm )

From there you can start then, because you also need the vbp file and the vbw
file in order to really make it work. If you just need the code, then here you
go :

Option Explicit

Private Sub Command1_Click()
'Dim Foo As RFCSampObj ' Due to an acknowledged problem in MTS
Dim Foo As Object      ' we Dim Foo as Object instead of as RFCSampObj
Dim searchterm As String
Dim custlist As Recordset

Set Foo = CreateObject("RFCSampObj.RFCSampObj.1")
Foo.Destination = "IDES"
'Foo.Client     = "800"
'Foo.Language   = "E"
'Foo.UserID     = "test"
'Foo.Password   = "pw"

If Not Foo Is Nothing Then
  searchterm = Text1.Text
  'Unfortunately RFC_CUSTOMER_GET does not convert
  ' a SPACE selction into a * so we do it here....
  If IsEmpty(searchterm) Then searchterm = "*"
  
  On Error Resume Next
  Call Foo.GetCustList(searchterm, "", custlist)

  If Err.Number = 0 Then
      If Not custlist Is Nothing Then
          custlist.MoveFirst
          While Not custlist.EOF
              Debug.Print "------------------"
              Debug.Print "custlist.Fields(name1) " &
custlist.Fields("NAME1")
              Debug.Print "custlist.Fields(stras) " &
custlist.Fields("STRAS")
              Debug.Print "custlist.Fields(ort01) " &
custlist.Fields("ORT01")
              Debug.Print "custlist.Fields(pstlz) " &
custlist.Fields("PSTLZ")
              Debug.Print "custlist.Fields(telf1) " &
custlist.Fields("TELF1")
              Debug.Print "custlist.Fields(telfx) " &
custlist.Fields("TELFX")
              custlist.MoveNext
          Wend
      Else
         Debug.Print "ERROR: custlist is Nothing"
      End If
   Else
      Debug.Print "ERROR" & Err.Description
      MsgBox Err.Description, vbCritical, "Error:"
   
   End If
Else
  Debug.Print "Foo is nothing"
  MsgBox "Foo is nothing"
End If

End Sub

Private Sub Command2_Click()

'Dim Foo As RFCSampObj ' Due to an acknowledged problem in MTS
Dim Foo As Object      ' we Dim Foo as Object instead of as RFCSampObj

Dim rs As Recordset
Dim HeaderIn As Recordset
Dim ItemsIn As Recordset
Dim Partners As Recordset
Dim OrderNumber As String
Dim BapiReturn As Recordset
Dim SoldTo As Recordset
Dim ShipTo As Recordset
Dim Payer  As Recordset
Dim ItemsOut As Recordset

'Input tables can be crafted in two different ways:
' - either using the DimAsXXXX method which returns a fully
'   described but empty Recordset.
' - or using the AdvancedDataFactory to craft up a disconnected
'   Recordset.
' An example of the later is shown with the Partners Table
' the remaining input tables are crafted with the dim as.
Dim adf As Object
' Describe the shape of a disconnected recordset

Dim vrsShape(1)
Dim vrsParvw(3)
Dim vrsKunnr(3)

vrsParvw(0) = "PARTN_ROLE"
vrsParvw(1) = CInt(8)
vrsParvw(2) = CInt(2)
vrsParvw(3) = False

vrsKunnr(0) = "PARTN_NUMB"
vrsKunnr(1) = CInt(8)
vrsKunnr(2) = CInt(10)
vrsKunnr(3) = False

vrsShape(0) = vrsParvw
vrsShape(1) = vrsKunnr

' Create a disconnected recordset to pass as an input

Set adf = CreateObject("RDSServer.DataFactory")
If adf Is Nothing Then
  MsgBox "ADF == NOTGHING"
End If
Set Partners = adf.CreateRecordSet(vrsShape)

Set Foo = CreateObject("RFCSampObj.RFCSampObj.1")
If Not Foo Is Nothing Then

  ' Get an empty recordset which will be used as input in
CreateOrder call

  Call Foo.DimHeader(HeaderIn)
  HeaderIn.AddNew
  HeaderIn.Fields("DOC_TYPE") = "TA"
  HeaderIn.Fields("SALES_ORG") = "1000"
  HeaderIn.Fields("DISTR_CHAN") = "10"
  HeaderIn.Fields("DIVISION") = "00"
  HeaderIn.Fields("PURCH_NO") = "SM-1177-3"
  HeaderIn.Fields("INCOTERMS1") = "CPT"
  HeaderIn.Fields("INCOTERMS2") = "Hamburg"
  HeaderIn.Fields("PMNTTRMS") = "ZB01"
  HeaderIn.Update

  Call Foo.DimItems(ItemsIn)
  ItemsIn.AddNew
  ItemsIn.Fields("MATERIAL") = "R-1120"
  ItemsIn.Fields("PLANT") = "1200"
  ItemsIn.Fields("REQ_QTY") = 2000
  ItemsIn.Update

  Partners.AddNew
  Partners.Fields("PARTN_ROLE") = "AG"
  Partners.Fields("PARTN_NUMB") = "0000001177"
  Partners.Update

  'set logon information
  Foo.Destination = "IDES"
  'Foo.Client     = "800"
  'Foo.Language   = "E"
  'Foo.UserID     = "test"
  'Foo.Password   = "pw"

  Call Foo.OrderCreate(HeaderIn, _
                       ItemsIn, _
                       Partners, _
                       OrderNumber, _
                       SoldTo, _
                       ShipTo, _
                       Payer, _
                       ItemsOut, _
                       BapiReturn)
  Debug.Print "OrderNumber" & OrderNumber
  If BapiReturn Is Nothing Then
      MsgBox "BapiReturn is Nothing"
  Else
      BapiReturn.MoveFirst
      Debug.Print "BapiReturn.Type...." & BapiReturn.Fields("TYPE")
      Debug.Print "BapiReturn.Code...." & BapiReturn.Fields("CODE")
      Debug.Print "BapiReturn.Message." & BapiReturn.Fields
("MESSAGE")
      Debug.Print "BapiReturn.LogNo..." & BapiReturn.Fields
("LOG_NO")
      Debug.Print "BapiReturn.LogMsgNo" & BapiReturn.Fields
("LOG_MSG_NO")
  End If
Else
  MsgBox "Foo is nothing"
End If

End Sub


Private Sub Command3_Click()

'Dim Foo As RFCSampObj ' Due to an acknowledged problem in MTS
Dim Foo As Object      ' we Dim Foo as Object instead of as RFCSampObj

Dim SalesOrders As Recordset
Dim BapiReturn  As Recordset

Set Foo = CreateObject("RFCSampObj.RFCSampObj.1")

If Not Foo Is Nothing Then

  'set logon information
  Foo.Destination = "IDES"
  'Foo.Client     = "800"
  'Foo.Language   = "E"
  'Foo.UserID     = "test"
  'Foo.Password   = "pw"

  
  On Error Resume Next
  Call Foo.GetCustomerOrders(CustomerNumber.Text, _
            SalesOrg.Text, _
            , , , , _
            BapiReturn, _
            SalesOrders)

  If Err.Number = 0 Then
      If Not SalesOrders Is Nothing Then
          SalesOrders.MoveFirst
          While Not SalesOrders.EOF
              Debug.Print "------------------"
              Debug.Print "SalesOrders.Fields(SD_DOC).... " &
SalesOrders.Fields("SD_DOC")
              Debug.Print "SalesOrders.Fields(ITM_NUMBER) " &
SalesOrders.Fields("ITM_NUMBER")
              Debug.Print "SalesOrders.Fields(MATERIAL).. " &
SalesOrders.Fields("MATERIAL")
              Debug.Print "SalesOrders.Fields(REQ_QTY)... " &
SalesOrders.Fields("REQ_QTY")
              Debug.Print "SalesOrders.Fields(NAME)...... " &
SalesOrders.Fields("NAME")
              Debug.Print "SalesOrders.Fields(NET_VALUE). " &
SalesOrders.Fields("NET_VALUE")
              Debug.Print "SalesOrders.Fields(PURCH_NO).. " &
SalesOrders.Fields("PURCH_NO")
              SalesOrders.MoveNext
          Wend
      Else
         Debug.Print "ERROR: SalesOrders is Nothing"
      End If
      If BapiReturn Is Nothing Then
          MsgBox "BapiReturn is Nothing"
      Else
          BapiReturn.MoveFirst
          Debug.Print "BapiReturn.Type...." & BapiReturn.Fields
("TYPE")
          Debug.Print "BapiReturn.Code...." & BapiReturn.Fields
("CODE")
          Debug.Print "BapiReturn.Message." & BapiReturn.Fields
("MESSAGE")
          Debug.Print "BapiReturn.LogNo..." & BapiReturn.Fields
("LOG_NO")
          Debug.Print "BapiReturn.LogMsgNo" & BapiReturn.Fields
("LOG_MSG_NO")
      End If
   Else
      Debug.Print "ERROR"
      MsgBox Err.Description, vbCritical, "Error:"
   
   End If
Else
  MsgBox "Foo is nothing"
End If

End Sub


Posted by SAP TECHNOLOGY at 5:25 PM 7 comments
Labels: VB Codes

Older Posts Home

Subscribe to: Posts (Atom)


ARCHIVES

 * ▼  2009 (86)
   * ▼  February (58)
     * Vb codes (or VBA macro code) for access SAP, and r...
     * An Introduction to SAP
     * sap abap program for Upload Logo for REUSE_ALV_COM...
     * What is SLIS in sap abap ALV
     * How to Refresh ALV List/Grid once it is displayed?
     * sap abap ALV 'Classic' Creating User/Global Layout...
     * How to use ALV for Hierarchical Lists
     * sap abap program for Sample ALV: Heading in ALV
     * sap abap program for Test ALV Display With Header ...
     * Sample programs on sap abap ALV Grid
     * what is abap REUSE_ALV_GRID_DISPLAY Functions Example
     * Display a Secondary List using ALV Grid
     * sap abap program for Line Color in ALV Example
     * sap abap program for How to make ALV header like t...
     * sap abap program for Use Simple ALV Functions to M...
     * sap abap ALV Reporting - Z_LIST_MATERIALS
     * sap abap program for Reincarnation of REUSE_ALV_FI...
     * ALV Reporting - REUSE_ALV_BLOCK_LIST_DISPLAY
     * sap abap program for An Interactive ALV Report
     * sap abap program for Example of a Simple ALV Grid ...
     * ABAP Example Program ALV Grid Control
     * What Are The Events In abap ALV
     * abap program for Creation Of Active Icon
     * using alv grid real time implementation
     * Adding custom buttons on ALV grid controls
     * SAP free download book on ALV grid Control Tutorial
     * SAP Highlighting only a particular cell instead of...
     * SAP ALV - Details of Y/Z objects with lists of use...
     * SAP ALV report to find the list of infotypes confi...
     * SAP ALV Report using REUSE
     * ALV ABAP List Viewer
     * What is ALV Programming in sap abap?
     * SAP ALV Function Modules
     * All the SAP Online Help in PDFs
     * All the SAP Online Help in PDFs A-C
     * All the SAP Online Help in PDFs D-M
     * All the SAP Online Help in PDFs N-S
     * All the SAP Online Help in PDFs T-Z
     * PDF freedownloads for all module books
     * PDF free download ALE Programming Guide
     * PDF free download ALE Programming Guide
     * ABAP ALE Tutorials PDF Free downloads
     * PDF Free Download Advance Payments
     * Adding additional fields to Delivery Due List
     * PDF Free Download Actual Costing / Material Ledger
     * PDF Book free download activity-Based Costing
     * Free Download Activity-Based Costing CO-OM-ABC
     * SAP Activity-Based Costing pdf free download
     * SAP Activities/Strategies in FI
     * SAP ABAP program OR implementation: Accounting Doc...
     * Accessing BAPI using VB PPT free download
     * SAP ABAP4 Tuning Checklist
     * sap abap/4 sample codes
     * SAP ABAP/4 programming language overview
     * SAP ABAP/4 Optimization Techniques
     * ABAP/4 OLE Automation Controller pdf book free dow...
     * ABAP/4 OLE Automation Controller pdf free download
     * Questions and Answers about ABAP/4 and Developments
   * ►  January (28)

 * ►  2008 (139)
   * ►  October (139)




TRANSLATION BY GOOGLE




Enter your email address:



Delivered by FeedBurner





CATEGORIES

 * ABAP CODE
 * ABAP Demo Programming
 * ABAP OLE
 * ABAP Programming
 * ABAP Report
 * ABAP REPORTS BASICS
 * Abap XML Programming
 * ALV grid controls
 * ALV Sample Programs
 * calculator
 * Clipboard Utilities
 * FAQs
 * Free Download PDF
 * Internal Tables faq
 * Interview Questions
 * Introduction to SAP
 * Keyword a Day
 * List Viewer
 * List Viewer Classic
 * Materials
 * Memory
 * Objective Questions
 * Programming
 * Proxy
 * SAP ABAP DEVELOPMENT
 * SAP ABAP Development Faqs
 * SAP ABAP Objects
 * SAP ABAP Query
 * SAP ABAP Reports
 * SAP ABAP Sample Project
 * SAP ALV
 * SAP ALV Grid
 * SAP ALV Grid Tutorial
 * SAP Dictionary
 * SAP Documents
 * SAP Online Help
 * Unicode
 * VALIDATIONS PPT
 * VB Codes


Weight loss eating

 


All Rights Reserved

Diese Website verwendet Cookies von Google, um Dienste anzubieten und Zugriffe
zu analysieren. Deine IP-Adresse und dein User-Agent werden zusammen mit
Messwerten zur Leistung und Sicherheit für Google freigegeben. So können
Nutzungsstatistiken generiert, Missbrauchsfälle erkannt und behoben und die
Qualität des Dienstes gewährleistet werden.Weitere InformationenOk