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

Problem with call transaction MB1A

Former Member
0 Likes
2,153

Hi guys,

I use call transaction mb1a via a bdc but we could not capture the document number created in msgtab although the transaction is successful and it is created.

CALL TRANSACTION 'MB1A' USING i_bdc MESSAGES INTO i_msgtab

MODE 'N'

UPDATE 'S'.

why this is happening?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,943

Hi,

Try this format....

CALL TRANSACTION wl_fb70 USING int_bdcdata MODE wl_mode UPDATE wl_update MESSAGES

INTO int_bdcmsgcoll.

It will work....

Regards,

Rohan.

Hi guys,

I use call transaction mb1a via a bdc but we could not capture the document number created in msgtab although the transaction is successful and it is created.

CALL TRANSACTION 'MB1A' USING i_bdc MESSAGES INTO i_msgtab

MODE 'N'

UPDATE 'S'.

why this is happening?

14 REPLIES 14
Read only

Former Member
0 Likes
1,944

Hi,

Try this format....

CALL TRANSACTION wl_fb70 USING int_bdcdata MODE wl_mode UPDATE wl_update MESSAGES

INTO int_bdcmsgcoll.

It will work....

Regards,

Rohan.

Read only

0 Likes
1,943

Hi rohan,

im sorry but it did not work...

Read only

0 Likes
1,943

Hi,

Can i have ur piece of code which u have used in ur program for bdc run...

Regards,

Rohan.

Read only

0 Likes
1,943

here's the codes for BDC;

PERFORM f_bdc_dynpro USING 'SAPMM07M' '0400'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'RM07M-BWARTWA' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '/00',

'MKPF-BLDAT' '31.01.2009',

'MKPF-BUDAT' '31.01.2009',

'RM07M-BWARTWA' '261',

'RM07M-WERKS' v_werks,

'RM07M-LGORT' v_tank,

'XFULL' 'X',

'RM07M-WVERS2' 'X'.

PERFORM f_bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'MSEG-CHARG(01)' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '/00',

'MSEG-MATNR(01)' v_matnr,

'MSEG-ERFMG(01)' '1.000',

'MSEG-ERFME(01)' 'LAL',

'MSEG-CHARG(01)' v_charg.

PERFORM f_bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'COBL-AUFNR' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '=ENTE',

'COBL-AUFNR' v_aufnr.

PERFORM f_bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM f_bdc_field USING:

'BDC_CURSOR' 'COBL-GSBER',

'BDC_OKCODE' '=ENTE',

'COBL-GSBER' '0002',

'COBL-AUFNR' vl_aufnr.

PERFORM f_bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'MSEG-ERFMG(01)' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '/00',

'DKACB-FMORE' 'X'.

PERFORM f_bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'COBL-GSBER' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '=ENTE'.

PERFORM f_bdc_dynpro USING 'SAPMM07M' '0421'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'MSEG-ERFMG(01)' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '=BU',

'DKACB-FMORE' 'X'.

PERFORM f_bdc_dynpro USING 'SAPLKACB' '0002'.

PERFORM f_bdc_field USING u2018BDC_CURSORu2019 'COBL-GSBER' .

PERFORM f_bdc_field USING:

'BDC_OKCODE' '=ENTE'.

CALL TRANSACTION 'MB1A' USING i_bdc MODE 'N'

UPDATE 'S'

MESSAGES INTO i_msgtab.

i_msgtab does not have the entry for the material doc created... although it is created upon checking in MB03...

Read only

0 Likes
1,943

Hi,

Have you tried with code given by me..??

I think it should work for you..

If not then post the entries which you get after CALL TRANSACTION in your message table..

Regards,

Meet

Read only

0 Likes
1,943

HI,

my msgtab dont any entries at all...

Read only

0 Likes
1,943

Hi,

I have done same thing and it's working fine..

I have done below coding..

Try it...

Hope it helps you..


  DATA : G_OPT TYPE CTU_PARAMS.
  DATA :MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

  G_OPT-DISMODE = 'N'.
  G_OPT-UPDMODE = 'A'.
  G_OPT-DEFSIZE = 'X'.

  CALL TRANSACTION 'MB1A' USING BDCDATA OPTIONS FROM G_OPT
                          MESSAGES INTO MESSTAB.

  READ TABLE MESSTAB WITH KEY MSGTYP = 'S'
                              MSGID  = 'M7'
                              MSGNR  = '060'.
  IF SY-SUBRC = 0.
    MBLNR  = MESSTAB-MSGV1.
  ENDIF.

Regards,

Meet

Read only

Former Member
0 Likes
1,943

Hi,

To fetch messages ues FM " Format_message" .

Regards

Md.MahaboobKhan

Read only

Former Member
0 Likes
1,943

Hi,

After CALL TRANSACTION use below code..



  READ TABLE i_msgtab WITH KEY MSGTYP = 'S'
                              MSGID  = 'M7'
                              MSGNR  = '060'.

  IF SY-SUBRC = 0.
    MBLNR  = i_msgtab-MSGV1.
  ENDIF.

Hope it helps..

Regards,

Meet

Read only

Former Member
0 Likes
1,943

Hi Mark,

Here is a sample code below you can refer,

{

After CALL TRANSACTION Statement,

  • read message table of type 'E'

READ TABLE messtab WITH KEY msgtyp = 'E'. "message internal table is read for capturing messages

  • if record found

IF sy-subrc = 0.

wa_message-aufnr = wa_process-aufnr. " was just my programs logic,proceed here according to your pgm logic

  • use FORMAT_MESSAGE to read the complete description of message

  • based on the message-id (msgid) and message-number(msgnr)

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = messtab-msgid

lang = sy-langu

no = messtab-msgnr

  • v1 = messtab-msgv1

  • v2 = messtab-msgv2

  • v3 = messtab-msgv3

  • v4 = messtab-msgv4

IMPORTING

msg = wa_message-msg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

APPEND wa_message TO it_message.

ENDIF.

ENDIF.

}

Hope it helps you

Regrds

Mansi

Read only

Former Member
0 Likes
1,943

Hi,

Hope you have got your answer how to catch message.

However I will suggest you not to go for BDC you can use this BAPI

BAPI_GOODSMVT_CREATE

for the t-code MB1A it is working fine moreover it will be faster then your BDC .

Regards

Bikas

Read only

Former Member
0 Likes
1,943

I like to use below code to capture the generated doc number from BDC.

DATA:G_MBLNR TYPE MBLNR.

GET PARAMETER ID MBN FILED G_MBLNR.

WRITE:/ G_MBLNR.

Try with the above code after call transaction, hope that it will be helpful.

Thanks and regards

Read only

Former Member
0 Likes
1,943

Hi,

As far as I know this, messtab will have entries only when there is some error or warning occurin during the BDC.

If the BDC is success ful the messtab will always be empty.

Correct me if I am wrong.

When ever you create a BDC. The value of the metarial document will be stored in the Parameter ID of that field, material document in this case.

Try passing the value of parameter ID into your variable.

Parameter ID of material doc number is MBN.

Let us know if this works.

Alternatively you can use BAPI_GOODSMVT_CREATE.

I believe the parameter ID should work.

Regards,

Vivekanand

Read only

0 Likes
1,943

Hi,

thanks for all your responses.... greatly appreciated...

we used the get parametr Id but it still doesnt work... we had also used bapi_goodsmvt_create but it seems not to work for 261 movement with only the order number but without using the reservation number...

thanks!