Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP : call transaction CN22

Former Member
0 Likes
1,800

Hello,

We use the call transaction to CN22 ( with MESSAGES into itab option...) to close networks.

Sometimes we have messages in a popup window which indicate that the closing action is not possible.

Unfortunately, those kind of messages are not returned by the call transaction and sy-subrc statement = 0.

Is it possible to read these messages with the call transaction statement ?

Thanks in advance for your answer

Jocelyne

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,465

Hi Guinamant,

you can collect al lthe error messages into bdcmsgcoll structure.

you follow the codes:

CALL TRANSACTION c_cn22 USING i_bdcdata

OPTIONS FROM wa_opt

MESSAGES INTO i_msgcoll.

note: i_msgcoll type standard table of bdcmsgcoll,

wa_msgcoll type bdcmsgcoll.

after bdc execution , all the error messages will be colllected in to i_msgcoll.

then if you want to get the text messages, then pass it through FM:

WRF_MESSAGE_TEXT_BUILD, OR USE FORMAT_MESSAGE

READ TABLE i_msgcoll INTO wa_msgcoll

WITH KEY msgtyp = c_e.

CALL FUNCTION 'WRF_MESSAGE_TEXT_BUILD'

EXPORTING

p_msgid = wa_msgcoll-msgid

p_msgno = l_msgno

p_msgv1 = wa_msgcoll-msgv1

p_msgv2 = wa_msgcoll-msgv2

p_msgv3 = wa_msgcoll-msgv3

p_msgv4 = wa_msgcoll-msgv4

IMPORTING

es_return = lwa_bapireturn1.

Hope this can solve your problems.

Regards,

Tutun

6 REPLIES 6
Read only

Former Member
0 Likes
1,465

we can't read the system messages to call transaction method...

you can try with this BAPI BAPI_BUS2002_CREATE

Read only

Former Member
0 Likes
1,466

Hi Guinamant,

you can collect al lthe error messages into bdcmsgcoll structure.

you follow the codes:

CALL TRANSACTION c_cn22 USING i_bdcdata

OPTIONS FROM wa_opt

MESSAGES INTO i_msgcoll.

note: i_msgcoll type standard table of bdcmsgcoll,

wa_msgcoll type bdcmsgcoll.

after bdc execution , all the error messages will be colllected in to i_msgcoll.

then if you want to get the text messages, then pass it through FM:

WRF_MESSAGE_TEXT_BUILD, OR USE FORMAT_MESSAGE

READ TABLE i_msgcoll INTO wa_msgcoll

WITH KEY msgtyp = c_e.

CALL FUNCTION 'WRF_MESSAGE_TEXT_BUILD'

EXPORTING

p_msgid = wa_msgcoll-msgid

p_msgno = l_msgno

p_msgv1 = wa_msgcoll-msgv1

p_msgv2 = wa_msgcoll-msgv2

p_msgv3 = wa_msgcoll-msgv3

p_msgv4 = wa_msgcoll-msgv4

IMPORTING

es_return = lwa_bapireturn1.

Hope this can solve your problems.

Regards,

Tutun

Read only

0 Likes
1,465

Hi,

Unfortunately, I have only a message which indicate that the network was modified. I expected to receive an error message.

We use CN22 => when we try to close a specific network, it's not possible because of standard rules (Balance of NWA is not zero).

This message appears in the entitled popup window "Error log from status check:displayed message". It explains why the user can't closed the network.

When we use the ''call transaction CN22" this kind of messages is not returned => no error detected.

Thanks for your answer

Jo

Read only

Former Member
0 Likes
1,465

hii,

BEGIN OF METHOD ZNET CHANGING CONTAINER.

DATA: net TYPE aufnr.

swc_get_property self 'NET' net.

REFRESH bdcdata.

PERFORM bdc_fill USING :

***

'X' 'SAPLCOKO' '2000',

' ' 'BDC_CURSOR' 'CAUFVD-AUFNR',

' ' 'CAUFVD-AUFNR' net,

' ' 'BDC_OKCODE' '=LIST',

  • Next Screen

'X' 'SAPLCOVG' '2000',

' ' 'BDC_CURSOR' 'AFVGD-VORNR(01)',

' ' 'RC27X-FLG_SEL(01)' 'X',

' ' 'BDC_OKCODE' '=INFV',

  • Next Screen to AOd User Fields

'X' 'SAPLCONW' '2700'.

****

REFRESH messtab.

CALL TRANSACTION 'CN22' USING bdcdata

MODE 'E'

UPDATE 'S'

MESSAGES INTO messtab.

END_METHOD.

FORM bdc_fill USING var1

var2

var3

CLEAR bdcdata.

IF var1 IS NOT INITIAL.

bdcdata-program = var2.

bdcdata-dynbegin = var1.

bdcdata-dynpro = var3.

ELSE.

bdcdata-fnam = var2.

bdcdata-fval = var3.

ENDIF.

APPEND bdcdata.

ENDFORM.

regards,

Shweta

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,465

Try to use

- BAPI_NETWORK_MAINTAIN (old) or BAPI_BUS2002_CHANGE (new)

- BAPI_BUS2002_SET_STATUS Set/Revoke Status for BUS2002 (Network)

Regards,

Raymond

Read only

Former Member
0 Likes
1,465

Hi,

Unfortunately, the evoked Bapis don't exist in our system.

With the call transaction function, it seems that we can't access to the following screens (example for CN22)=>

SAPLCO01 0400 X

BDC_CURSOR SPOP-TEXTLINE1

BDC_OKCODE =OPT1

SAPMSSY0 0120 X

BDC_OKCODE =&ONT

SAPLCO01 0400 X

BDC_CURSOR SPOP-TEXTLINE1

BDC_OKCODE =OPT2

(these lines are displayed only in 'not batch input mode' in SM35).

and so, no messages are returned with the 'MESSAGES into ..." option ....