DATA:
gt_sflight TYPE STANDARD TABLE OF sflight.
BREAK-POINT.
SELECT *
INTO TABLE gt_sflight
FROM SFLIGHT
WHERE CARRID = 'LH' AND
CONNID = '0400' AND
PLANETYPE = '737-800' AND
FLDATE = '20200923' AND
PRICE = '685.14'.
IF sy-subrc <> 0.
WRITE: 'Error: Record do not exists.'.
ELSE.
DELETE SFLIGHT FROM TABLE gt_sflight.
ENDIF.
'-Begin-----------------------------------------------------------------
session.findById("wnd[0]/tbar[0]/okcd").text = "/nBC_GLOBAL_SFLGH_CREA"
session.findById("wnd[0]/tbar[0]/btn[0]").press
Randomize
FlightDate = FormatDateTime(DateAdd("d", Rnd * 365, Now), vbShortDate)
ABAPFlightDate = Right(FlightDate, 4) & Mid(FlightDate, 4, 2) & Left(FlightDate, 2)
session.findById("wnd[0]/usr/ctxtSFLIGHT-CARRID").text = "LH"
session.findById("wnd[0]/usr/ctxtSFLIGHT-CONNID").text = "400"
session.findById("wnd[0]/usr/ctxtSFLIGHT-FLDATE").text = FlightDate
session.findById("wnd[0]/usr/btn%#AUTOTEXT001").press
StatusBarText = session.findById("wnd[0]/sbar/pane[0]").Text
If InStr(StatusBarText, "already exists") Then
MsgBox "An error occured"
Exit Sub
End If
Randomize
FlightPrice = CStr(FormatNumber(Round(Rnd * 1000, 2), 2))
ABAPFlightPrice = Replace(FlightPrice, ",", ".")
session.findById("wnd[0]/usr/txtSFLIGHT-PRICE").text = FlightPrice
session.findById("wnd[0]/usr/ctxtSFLIGHT-PLANETYPE").text = "737-800"
session.findById("wnd[0]/tbar[0]/btn[11]").press
StatusBarText = session.findById("wnd[0]/sbar/pane[0]").Text
If InStr(StatusBarText, "created") = 0 Then
MsgBox "An error occured"
Exit Sub
End If
On Error Resume Next
Set ABAPRunner = CreateObject("ABAP.Runner")
On Error Goto 0
If Not IsObject(ABAPRunner) Then
MsgBox "Can't create ABAP.Runner", vbOkOnly, "Important hint"
Exit Sub
End If
'-ABAP------------------------------------------------------------------
ABAPCode = _
"REPORT Z_CHECK_SFLIGHT." & vbCrLf & _
"DATA:" & vbCrLf & _
" gt_sflight TYPE STANDARD TABLE OF sflight." & vbCrLf & _
"SELECT *" & vbCrLf & _
" INTO TABLE gt_sflight" & vbCrLf & _
" FROM SFLIGHT" & vbCrLf & _
" WHERE CARRID = 'LH' AND" & vbCrLf & _
" CONNID = '0400' AND" & vbCrLf & _
" PLANETYPE = '737-800' AND" & vbCrLf & _
" FLDATE = '" & ABAPFlightDate & "' AND" & vbCrLf & _
" PRICE = '" & ABAPFlightPrice & "'." & vbCrLf & _
"IF sy-subrc <> 0." & vbCrLf & _
" WRITE: 'Error: Record do not exists'." & vbCrLf & _
"ELSE." & vbCrLf & _
" DELETE SFLIGHT FROM TABLE gt_sflight." & vbCrLf & _
"ENDIF."
'-ABAPEND---------------------------------------------------------------
ABAPRunner.ABAPCode = ABAPCode
ABAPRunner.AddParameter = "ASHOST=ABAP"
ABAPRunner.AddParameter = "SYSNR=00"
ABAPRunner.AddParameter = "CLIENT=001"
ABAPRunner.AddParameter = "USER=BCUSER"
ABAPRunner.AddParameter = "PASSWD=minisap"
ABAPRunner.AddParameter = "LANG=EN"
Result = ABAPRunner.InstallAndRun()
If Result <> "" Then
MsgBox Result
End If
'-End-------------------------------------------------------------------
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ABAPFile = FSO.OpenTextFile("ABAPRunner.Test.abap", ForReading)
ABAPRunner.ABAPCode = ABAPFile.ReadAll
ABAPFile.Close
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |