Skip to Content
0

ABAP Call a transaction in a new mode

Oct 25, 2016 at 09:30 AM

228

avatar image
Former Member

Hello dear ABAP colleagues,

I am facing a problem which I am not able to fix by myself:

I need to call a transaction FBL5N (Customer Line Item Display) but in a new mode. In the same mode, there is no problem at all. But when I try to call it in a new mode, I use the following code:

lv_spagpa-parid = 'KUN'.

lv_spagpa-parval = wa_display-kontonr.

APPEND lv_spagpa TO lt_spagpa.

CALL TRANSACTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'FBL5N'

EXPORTING

tcode = 'FBL5N'

skip_screen = 'X'

TABLES

spagpa_tab = lt_spagpa

EXCEPTIONS

communication_failure = 1

system_failure = 2.

If I call this function module with an Account-Nr which drops Line Items, no problem, it works and results will be displayed in a new mode.

But if I call the RFM with entries in lt_spagpa which do not trigger any results, the transaction delivers a status message: 'No postings were found'. The thing is, the new mode does not open itself, nothing happens and do not deliver any message. The new mode is open only when the transaction FBL5N throws positive results. If not, nothing happens.

I debugged, tried RECEIVE RESULTS but nothing happens. Does anybody have any idea about how can I display any message when negative results are thown?

Thanks a lot in advance!

BR Jorge.

10 |10000 characters needed characters left characters exceeded

Typo in your question: it must be CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'FBL5N'

0
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Raymond Giuseppi
Oct 25, 2016 at 12:33 PM
0

No need to add an explicit destination, with this syntax NONE will be selected by default (press F1 or read online help)

Nevertheless, ABAP4_CALL_TRANSACTION will only return a message table if skip screen is initial and bdcdata is not. (Just read the source of FM)

> So build a small BDC in place of SPA/GPA parameters.

Regards,
Raymond

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 25, 2016 at 12:43 PM
0

Hi

the problem is the called transaction backs to the calling point at the end, so it means the new mode is automatically closed: if no data are selected, the message should be shown in the new mode, but it's already closed.

This behavior is due on how you call the transaction and how the transaction leaves the program, I don't think you can avoid it, probably you should check if there's at least one item for the current customer in order to show a message by yourself.

Max

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 26, 2016 at 06:02 AM
0

Dear Jorge Ocana Molinero,

Yes, Sandra Rossi is correct, It should be CALL FUNCTION.
I would like to add some point with it. Since its RFM, Give DESTINATION to that function.

CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'FBL5N'

DESTINATION 'Some_Connection_Name'

Regards,

Sivaraj Sadasivam.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 03, 2016 at 08:37 AM
0

Hi guys.

Thank you very much for your answers.

Yes, CALL TRANSACTION is just a typo. I intended to mean CALL FUNCTION (I work remotely in SAP Systems so I do not have copy paste and I have to type manually the source code here).

I decided to build a check before calling the FM ABAP4_CALL_TRANSACTION, and calling it just when positive results are going to happen.

@Raymond I will try to build a BCD and will let you know.

Thanks again!

BR Jorge.

Share
10 |10000 characters needed characters left characters exceeded