Tuesday, 2 March 2021
Function Module to Map a Deep Dictionary Structure : CATSXT_GET_DDIC_FIELDINFO
Wednesday, 9 December 2020
Do It Yourself EWB Programming
So I recently had to perform tasks described in note: https://launchpad.support.sap.com/#/notes/488765 the EWB - Engineering WorkBench... now "Do it yourself" is an interesting Business Model... on the one hand, you're giving people the flexibility to create and craft as they see fit... on the other hand, one might be thinking "Come on SAP, there should be a BAPI there..."
They come close, but it seems not as simple as a BAPI. Why do they not just tie the steps they've described up into a BAPI... like "To make a change, first you need to do the locking, reload, then make the change..."???
Another thing they note is "If you have difficulties using the API, we would like to support you within consulting."
I bet you would.
Anyway, here's some code that removes a Sequence from the "Sequences" part of CA02.
PARAMETERS: p_plnal type plnal DEFAULT '01',
p_plnnr type plnnr DEFAULT 'G0000338',
p_plnfl type PLNFOLGE DEFAULT '000022',
p_plnty type plnty DEFAULT 'N'.
START-OF-SELECTION.
select single * from plfl into ls_plfl where plnal = p_plnal
and plnnr = p_plnnr
and plnfl = p_plnfl
and plnty = p_plnty.
DATA: lt_SEQ_INV TYPE CPCL_SEQ_VERS_TAB_TYPE,
lt_SEQ_LOCK TYPE CPCL_SEQ_LOCK_TAB_TYPE,
lt_SEQ_IDENT_ECM TYPE CPCL_SEQ_TAB_TYPE,
ls_seq_class_data type SEQ_CLASS_DATA.
DATA: lt_SEQ_IDENT TYPE CPCL_SEQ_TAB_TYPE,
ls_seq_ident type cpcl_seq_ident_type.
MOVE-CORRESPONDING ls_plfl to ls_seq_ident.
append ls_plfl to lt_seq_ident.
CALL FUNCTION 'CP_CL_P_SEQ_LOAD'
EXPORTING
I_FLG_SET_LOCK = 'X'
IMPORTING
E_SEQ_INV = lt_seq_inv
E_SEQ_LOCK = lt_seq_lock
E_SEQ_IDENT_ECM = lt_seq_ident_ecm
CHANGING
c_seq_ident = lt_seq_ident .
DATA: E_TSK_INV TYPE CPCL_TSK_VERS_TAB_TYPE,
E_TSK_LOCK TYPE CPCL_TSK_LOCK_TAB_TYPE,
E_TSK_IDENT_LOCK TYPE CPCL_TSK_TAB_TYPE,
E_TSK_IDENT_ECM TYPE CPCL_TSK_TAB_TYPE.
DATA: lt_TSK_IDENT TYPE CPCL_TSK_TAB_TYPE,
ls_TSK_IDENT TYPE cpcl_tsk_ident_type.
loop at lt_seq_ident into ls_seq_ident.
MOVE-CORRESPONDING ls_seq_ident to ls_tsk_ident.
append ls_tsk_ident to lt_tsk_ident.
endloop.
CALL FUNCTION 'CP_CL_P_TSK_LOAD'
IMPORTING
E_TSK_INV = E_TSK_INV
E_TSK_LOCK = E_TSK_LOCK
E_TSK_IDENT_LOCK = E_TSK_IDENT_LOCK
E_TSK_IDENT_ECM = E_TSK_IDENT_ECM
CHANGING
c_tsk_ident = lt_tsk_ident
.
DATA ls_NAME TYPE SY-MSGV1.
CALL FUNCTION 'CP_CL_SEQ_LOCK'
EXPORTING
PLNTY = ls_plfl-plnty
PLNNR = ls_plfl-PLNNR
PLNAL = ls_plfl-PLNAL
PLNFL = ls_plfl-plnfl
_WAIT = ' '
IMPORTING
E_NAME = ls_NAME
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
MOVE-CORRESPONDING ls_plfl to ls_seq_class_data.
ls_seq_class_data-loekz = 'X'.
DATA ls_ECM_DATA_ERROR_TYPE TYPE CPCC_MESSAGE_TYPE.
CALL FUNCTION 'CP_CL_S_SEQ_CHANGE'
EXPORTING
I_ECN_S = ls_plfl-aennr
i_key_date_s = ls_plfl-datuv "sy-datum
I_FLG_SEQ_CHECK = ' ' "default 'X' try switching it off!?
* I_MARK_TXT_UPDATE = ' '
i_seq_class_data = ls_seq_class_data
I_FLG_COLLECT_ALL_MSG = 'X'
IMPORTING
E_ECM_DATA_ERROR_TYPE = ls_ECM_DATA_ERROR_TYPE
EXCEPTIONS
SEQUENCE_NOT_CONSISTENT = 1
NO_AUTHORITY = 2
NO_VALID_SEQUENCE = 3
SEQUENCE_NOT_LOCKED = 4
ECM_DATA_NOT_SUITABLE = 5
OTHERS = 6.
CALL FUNCTION 'CP_CL_P_SEQ_SAVE'
EXCEPTIONS
NO_SEQ_TO_SAVE = 1
OTHERS = 2.
commit work and wait.
Wednesday, 2 December 2020
PLPO - PLFL link
PARAMETERS: p_plnnr type plnnr DEFAULT '51000070',
p_vornr type vornr DEFAULT '0010'.select * from plfl into TABLE lt_plfl where plnnr = p_plnnr
and loekz = ' '.
select * from plas into TABLE lt_plas where plnnr = p_plnnr .
select * from plpo into TABLE lt_plpo where plnnr = p_plnnr
and vornr = p_vornr.
if lt_plpo is not INITIAL.
select * from crhd into table lt_crhd FOR ALL ENTRIES IN lt_plpo
where crhd~objid = lt_plpo-arbid.
endif.
loop at lt_plfl into ls_plfl.
READ TABLE lt_plas into ls_plas with key plnnr = ls_plfl-plnnr
plnfl = ls_plfl-plnfl.
if sy-subrc = 0.
READ TABLE lt_plpo into ls_plpo with key plnnr = ls_plas-plnnr
plnkn = ls_plas-plnkn.
if sy-subrc = 0.
READ TABLE lt_crhd into ls_crhd with key objid = ls_plpo-arbid.
if sy-subrc = 0.
write:/ ls_plpo-plnnr, ':' , ls_plpo-vornr, ':' , ls_plfl-plnfl, ':', ls_crhd-arbpl.
endif.
endif.
endif.
endloop.
Wednesday, 26 August 2020
Calling MS-SQL stored procedure from ABAP
My SAP System had to call a stored procedure on a 3rd party MS-SQL database. As suggested by many blogs, I used DBCO to maintain the parameters of the database... (kind of a BASIS job, but anyway...)
Then found I could use the DBCursor mechanism to retrieve to a table... but my 3rd Party guy didn't want to use SELECT statements, he wanted to use a stored procedure.
Turns out you can use DBCursor to select from an Stored Procedure too...
We had to "qualify" the database name, pre-empting the stored procedure (see highlight)
data: ls_output type tty_output, "This bit will differ in each Stored Procedure,
lt_output type TABLE of tty_output. " so I have not put it in!!
EXEC SQL.
CONNECT TO 'CO11' AS 'V'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'V'
ENDEXEC.
EXEC SQL.
open dbcursor for
EXEC [DatabaseName].[dbo].[StoredProcedureName] 700, '2041', 'S1233124'
endexec.
DO.
EXEC SQL.
FETCH NEXT dbcursor INTO :ls_output-SerialNumber,
:ls_output-MACID
ENDEXEC.
IF sy-subrc = 0.
APPEND ls_output to lt_output.
clear ls_output.
CONTINUE.
else.
exit.
endif.
enddo.
Monday, 11 November 2019
SMARTForms Colour Border Gotcha
Wednesday, 2 October 2019
VOFM Copy Routine being ignored!?
Wednesday, 10 July 2019
Android "App Not Installed" using Cordova
In my case, I managed to fix it by:
Checking the version of the phone [Settings->About Phone->Android Version] - mine was 5.1.1 i.e. Android Lollipop
Googling which SDKs were valid:
| Codename | Version | API level/NDK release |
|---|---|---|
| Marshmallow | 6.0 | API level 23 |
| Lollipop | 5.1 | API level 22 |
| Lollipop | 5.0 | API level 21 |
| KitKat | 4.4 - 4.4.4 | API level 19 |
Monday, 28 January 2019
Eclipse Grinding... Part 2
If you ever actually manage to load the thing : Preferences->General->Startup/ShutDown you can choose which plugins get invoked. I switched ALL these off, and even though this included some SAP related Plugins, I was still able to do everything I needed to. This sped it all up!
Tuesday, 15 January 2019
Eclipse is grinding my gears. Random Rant post, no useful information! :)
Having followed various blogs on the web explaining how to allocate more memory to Eclipse, and switch off all the plugins, I'm still only successfully launching the application about half the time, and then frequently hanging when trying to do mundane tasks like opening a CDS view, or interrogating a package.
I just wish there was an alternative. The way they've Eclipse hooking into the GUI Logon pad to pick up server details for logons was a really neat trick. As a way of developing UI5 applications and then loading on to BSP works nicely...
It's just it'll be working okay for a bit then for some reason I can't quite discern, it'll not load, or load and not work. AAAARRRHRHHGHHHGHGH!!
Wednesday, 5 December 2018
Cloud WebIDE - Grunt
Thursday, 22 November 2018
Cloud... really?
Seriously, what am I meant to do about this? With on-prem, you've got a BASIS team that you can go and bother, a manager to bother if they're getting slow, and your PM / SDM can go and bang some heads together to get things done...
Now, I'm at the mercy of some behemoth organisation, who may or may not have my back in prioritising fixing this.
One of the selling points of Cloud was that the infrastructure is handled by someone else, but it's hard to swallow that, when I get the above!
Which leads me to another thing... your business doesn't get a say in downtime. I guess with fail-overs etc, your cloud provider can do a good job of maintenance on one box, whilst you're being served by another, so you'd never have any downtime. In the case where this is unavoidable, the BASIS guys would talk to the Business and find an agreeable time to do it. With Cloud, the Business has no say? Doesn't sound that great!
Anyway, fortunately I've got some backend oData services to build, so I can wait for Cloud to be ready, but otherwise, I'm in the position of saying "Sorry Business, I can't work on it today" and there's nothing we can do about it!?
Tuesday, 6 November 2018
FIORI Security gotcha : Protocol cannot be switched to HTTPS: HTTPS is not configured / active
This was aiming for URL :
Wednesday, 31 October 2018
TechEd Barcelona 2018 Review
- Developing using Eclipse rather than SE80
- Developing using WebIDE
- CDS views on the HANA Database
- More interaction between Development, Functional and
End-User as an app is developed, using tools like BUILD. (This one’s an
interesting one, as it might mean we need to change the way we consult a
little, as we’ve traditionally not embarked on much work till we’ve got a
proper spec)
- Training a ChatBot using recast.ai
- Using AI to recognise images
- Connecting IoT devices to SAP
Wednesday, 22 August 2018
HANA Core Data Services
There's two things I've learned today... one is that the filters in Data Preview sometimes need the leading zeroes dropping in : I've spent ages getting rubbish data against Material 123456789 when I really needed 00000123456789. Kicked myself so hard when that one happened.
One of my problems with CDS in ADT is that I'm used to SE80 jumping into SE11 when I double click on an object.
Not here in ADT! I'm forced to go and find the thing.
Whether this is intentional, and will force devs to be all organised in the way they store their definitions, I don't know. There's a lot to like about the way Eclipse integrates with SAP, and time will tell whether it gets adopted by the community, but this feels like a step backwards.
Wednesday, 6 June 2018
SAP Web IDE Full Stack
Thursday, 26 April 2018
Function module to remove special characters : ES_REMOVE_SPECIAL_CHARACTER
Wednesday, 21 February 2018
Table Maintenance Generator
Wednesday, 7 February 2018
Three Reasons for Test Scripts
Friday, 5 January 2018
WebIDE vs Eclipse
The nice thing about Eclipse is that it's on my desktop, and once the HANA/UI5 setup has been done, I know full well that if my desktop can see the SAP system, then Eclipse can too. I don't need to negotiate any firewalls, install anything on the target system, or jump through any additional security hoops. I like that it's free (who doesn't!) and I know WebIDE has a free component, but when you've got a cloud solution, those guys could start charging any minute. (This happened to me recently with BKool online bike-training, who withdrew their free offering, making it a purely premium service...not happy!)
For those reasons, I've enjoyed using Eclipse. A co-worker, who started her UI5 journey with WebIDE decries the difficulty of getting Eclipse set up in the first place, that it's slow, and doesn't offer particularly good syntax checking or intellisense code completion.
She's right on both counts - getting Eclipse going for UI5 development isn't a straight "Download the UI5 Eclipse Version" - JDKs, System settings, JREs and adding software are all gotchas that can impair your progress.
Additionally, it requires updating every now and then, and if you're using Eclipse for a number of different purposes (say one day you're building an Android App, the next a WebPage) the libraries can all add up and start slowing Eclipse to a crawl - I solved this by having an install for each purpose, which takes up disk space, but at least keeps everything nicely siloed.
The verbal sparring we've had over the merits and drawbacks of each have made the long winter evenings just fly by, as you can imagine.
Bearing in mind that in our role as developers, we often have to just crack on and do the job, we don't get abundant time to try new things and compare the merits; Not wanting to knock something until I'd given it a fair chance, I've been dabbling with WebIDE recently.
The first few times I tried, it just seemed like someone had WebSkinned Eclipse, and it was slower and more unresponsive than my desktop. Why would I bother!? Here's a shootout for Developers:
Speed:WebIDE
The WebIDE is now faster... wasn't always the case, but Eclipse takes a long time to load. Once it's loaded, it's fine, but WebIDE has the win here:
Connection to backend:Eclipse
Using the HANA Cloud Connector, it's also possible to transmit your code to your on-premise solution relatively easily : There's a good blog about it here:
https://blogs.sap.com/2015/07/13/cloud-connector-a-brief-guide-for-beginners/
I don't think it's quite as straightforward as Eclipse's "Team->Share" option, but once set up is neat enough.
Getting Set Up:Contentious, but WebIDE
Sometimes you can have a really nice Eclipse setup experience, sometimes it takes forever. This seems to be a combination of laptop system settings, what JREs/JDKs you've already got on your computer, and whether HANA libraries and Eclipse releases are in sync at the moment.
The WebIDE should be a standard "set up an account on a website and you're in" experience... which could be sand-bagged by SAP.com's annoying habit of asking you for a password every page you go to.
Documentation: Eclipse
It's been around longer, so I'm expecting WebIDE to edge this in a year or so. The in-editor documentation on WebIDE is really good though.
Features: WebIDE
Intellisense code completion, documentation, object-method suggestion etc. WebIDE blows Eclipse out of the water on this one, and is the main reason I'm going to try and get some development work done there rather than in ol' faithful(Eclipse) in the next couple of months.
Once you know what you're doing, it'll be the connection to backend that makes the difference - and that'll depend on how amenable your sys-admins are to opening up their SAP system to a cloud solution... but I'm looking forward to using WebIDE a whole lot more.
Wednesday, 13 December 2017
How to track calls to SICF
Hadn't come across this before, good to see we can do it from inside as well as outside SAP...








