Home > database >  Pb to do the SAP interface to send table data to SAP function
Pb to do the SAP interface to send table data to SAP function

Time:09-27

//how to pass table data to SAP function, and then write it by function into the SAP database? Please grant instruction, nasty,


Oleobject saprfc connectionsap, funct functions provides, intab
Long ll_status ll_count, ll_row
String ls_aa, ls_bb

Saprfc=create oleobject
Ll_status=saprfc. Connecttonewobject (" SAP functions provides ")
Connectionsap=saprfc. Connection
Connectionsap. Application server="10.22.0.200"
Connectionsap. System='ids'
Connectionsap. Systemnumber='00'
Connectionsap. Client='800'
Connectionsap. Language='useful'
Connectionsap. User='user name'
Connectionsap. Password='password'

If connectionsap. Logon (0, true)=false then
Connet messagebox (' SAP ', 'the connect failed')
Return
The else
Messagebox (' connect SAP ', 'connect' success ')
End the if
//connect to the database successfully

//call z_zlgq_llz
Funct=create oleobject
Funct=saprfc. Add (" z_zlgq_llz ")


//how to pass table data to SAP function and then write it by function into the SAP database?
//the convert oleobject in any variable to the string
//funct. Exports (I_EBELN, trim (sle_1. Text))
//funct. Exports (" xcarrname ", "aa")


If funct. Call=false then//call the Rfc
Messagebox (' failed ', 'call failed)
Destroy connectionsap
Destroy saprfc
Return
End the if

Intab=funct. Tables (" IT_zscarr ")

Ll_count=intab. Rowcount ()
If ll_count & gt; 0 then
For ll_row=1 To ll_count
Ls_aa=intab. Value (ll_row, 'carrname)
Ls_bb=intab. Value (ll_row, 'CURRCODE)
Messagebox (ls_aa ls_bb)
Next
End the if
Connectionsap. LogOff ()
Destroy connectionsap
Saprfc. Disconnectobject ()
Destroy saprfc

CodePudding user response:

Look not to understand

CodePudding user response:

This should be the problem of SAP interfaces, like pb net write data will be used in excel interface functions of excel,

Lz is best in the SAP discussion BBS ask

CodePudding user response:

The original concept called bapi_po_create create PO order


Oleobject saprfc connection2, funct
Oleobject poheader, poitems poitemschedule, it_RETURN
Oleobject ItemsRow, SchedulesRow

ANY PO_NO
Long ll_status



Saprfc=create oleobject
Ll_status=saprfc. Connecttonewobject (" SAP functions provides ")//SAP functions provides

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//connect to SAP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Connection2=saprfc. Connection
Connection2. Application server="10.1.4.71"//server IP
Connection2. System='DEV//system id
Connection2. Systemnumber='00'
Connection2. Client='110'
Connection2. User='
Connection2. Password='
Connection2. Language='EN'

If connection2. Logon (0, true)=false then//login
Messagebox (' connect to SAP, 'connection')
Return
End the if

SETPOINTER (HourGlass! )


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//to specify which function to call the SAP, and achieved the function of each object
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Funct=saprfc. Add (" BAPI_PO_CREATE ")

Poheader=funct. Exports. The Item (" PO_HEADER ")

Poitems=funct. Tables. The Item (" PO_ITEMS ")
Poitemschedule=funct. Tables. The Item (" PO_ITEM_SCHEDULES ")


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//to wa object assignment
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Poheader. Value [2]='NB//purchase vouchers type
Poheader. Value [3]='F'//purchase vouchers category
Poheader. Value [5]='1001'//procurement organization
Poheader. Value [6]='A01//procurement group
Poheader. Value [8]='0000100024'//supplier account number

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//to itab object assignment
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//00010
ItemsRow=poitems. Rows. The Add ()
ItemsRow. Value [2]='00010' item number//purchase vouchers
ItemsRow. Value [5]='000000001101010006'//material number
ItemsRow. Value [11]='1000'//inventory site
ItemsRow. Value [17]='1001'//factory
ItemsRow. Value [21]='5'//purchase vouchers in the net price (with proof of currencies)

SchedulesRow=poitemschedule. Rows. The add ()
SchedulesRow. Value [1]='00010' item number//purchase vouchers
SchedulesRow. Value [3]='1'/type/date (day, week, month, interval)
SchedulesRow. Value [4]='20100531'//project delivery date
SchedulesRow. Value [6]='100'//planned quantity

//00020
ItemsRow=poitems. Rows. The Add ()
ItemsRow. Value [2]='00020' item number//purchase vouchers
ItemsRow. Value [5]='000000001101010007'//material number
ItemsRow. Value [11]='1000'//inventory site
ItemsRow. Value [17]='1001'//factory
ItemsRow. Value [21]='6'//purchase vouchers in the net price (with proof of currencies)

SchedulesRow=poitemschedule. Rows. The add ()
SchedulesRow. Value [1]='00020' item number//purchase vouchers
SchedulesRow. Value [3]='1'/type/date (day, week, month, interval)
SchedulesRow. Value [4]='20100531'//project delivery date
SchedulesRow. Value [6]='99'//planned quantity


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//call the SAP function
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related