Application Development 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: 

Bapi problem

Former Member
0 Kudos

Hello all,

I getting some errors when I trying to use this BAPI.

The fields will be filled by an excel file:

OBJEK / OBJTYPE / KLART / CLASS / DESIGNATION_COURT / GPE_MARCHANDISES

1754490 / Mat / 001 / M001 / DLE10 - Chargement Txt Cde / 0102

DIVISION_ARTICLE / MATIERE / CONSTRUCTEUR / CDF_ATELIER / DCF

0273 / TEST / XYZ / 02 / DCF

into the program, I am coding:


DATA: t_char LIKE bapi1003_alloc_values_char OCCURS 0 WITH HEADER LINE,
      t_num  like BAPI1003_ALLOC_VALUES_NUM OCCURS 0 WITH HEADER LINE,
      t_curr like BAPI1003_ALLOC_VALUES_CURR OCCURS 0 WITH HEADER LINE,
      t_retur LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

DATA: status TYPE bapi1003_key-status.


t_char-charact = 'DESIGNATION_COURTE'.
t_char-value_char = 'DLE10 - Chargement Txt Cde'.

t_char-charact = 'GPE_MARCHANDISES'.
t_char-value_char = '0102'.

t_char-charact = 'DIVISION_ARTICLE'.
t_char-value_char = '0273'.

t_char-charact = 'MATIERE	CONSTRUCTEUR'.
t_char-value_char = 'TEST'.

t_char-charact = 'REF_CONSTRUCTEUR'.
t_char-value_char = 'XYZ'.

t_char-charact = 'CDF_ATELIER'.
t_char-value_char = '02'.

t_char-charact = 'DCF'.
t_char-value_char = 'DCF'.

t_char-charact = 'DIVISION_ARTICLE'.
t_char-value_char = '7852'.

APPEND t_char.

CALL FUNCTION 'BAPI_OBJCL_CREATE'
  EXPORTING
    objectkeynew            = 'TEST'
    objecttablenew          = 'MARA'
    classnumnew             = 'M001'
    classtypenew            = '001'
   status                  = '1'
*   STANDARDCLASS           =
*   CHANGENUMBER            =
   KEYDATE                 = SY-DATUM
*   NO_DEFAULT_VALUES       = ' '
 IMPORTING
   classif_status          = status
  TABLES
*   ALLOCVALUESNUM          =
   allocvalueschar         = t_char
*   ALLOCVALUESCURR         =
    return                  = t_retur.

After executing this BAPI, I got this message at table t_retur:

Assignment does not exist or is not valid on

1 ACCEPTED SOLUTION

deepak_dhamat
Active Contributor
0 Kudos

Hi ,

Please debug BApi when you are passing all required parameters ,

Because then only you will come to know while passing which parameter you are getting that error .

Try to go satep by step You will defenatily find where is problem and according you can find solution also try on your own first.

Regards

Deepak.

6 REPLIES 6

Jelena
Active Contributor
0 Kudos

Get the error message class and # and read the long text in transaction SE91.

It seems to me there is something wrong with the values you're entering (e.g. they're simply wrong or configured differently), but I'm not sure how anyone in the forum is supposed to figure this out since we don't have access to your system.

deepak_dhamat
Active Contributor
0 Kudos

Hi ,

Please debug BApi when you are passing all required parameters ,

Because then only you will come to know while passing which parameter you are getting that error .

Try to go satep by step You will defenatily find where is problem and according you can find solution also try on your own first.

Regards

Deepak.

0 Kudos

hi ,

Take help from this code

data:

l_classnumnew like bapi_class_key-classnum,

l_classtypenew like bapi_class_key-classtype,

l_classbasicdata like bapi1003_basic,

l_t_return like table of bapiret2 with header line,

l_t_classdescriptions like table of bapi1003_catch with header line,

l_objectkeynew like bapi1003_key-object,

l_counter like sy-tabix.

----


Neue Klasse anlegen -

l_classnumnew = wagud-filgr.

l_classtypenew = wagud-klart.

l_classbasicdata-status = rwaka-statu.

loop at g_t_kunnr where not selkz is initial.

clear l_t_return.

refresh l_t_return.

clear l_objectkeynew.

l_objectkeynew = g_t_kunnr-kunnr.

call function 'BAPI_OBJCL_CREATE'

exporting

objectkeynew = l_objectkeynew

objecttablenew = 'BETR'

classnumnew = l_classnumnew

classtypenew = l_classtypenew

  • STATUS = '1'

  • STANDARDCLASS =

  • CHANGENUMBER =

  • KEYDATE = SY-DATUM

tables

  • ALLOCVALUESNUM =

  • ALLOCVALUESCHAR =

  • ALLOCVALUESCURR =

return = l_t_return.

loop at l_t_return where type eq 'A' or type eq 'E'.

exit.

endloop.

if sy-subrc ne 0.

l_counter = l_counter + 1.

endif.

endloop.

Regards

Deepak.

Former Member
0 Kudos

I think you need to append to t_char for each charact and value_char


t_char-charact = 'DESIGNATION_COURTE'.
t_char-value_char = 'DLE10 - Chargement Txt Cde'.

append t_char. clear t_char.

Former Member
0 Kudos

Hi Rimeira,

I am new to SAP. But I tried to solve the problem,

First of all, I am not getting any error while executing,

and Second thing I want to ask you that why are you using APPEND statement at last only? before calling the BAPI FM?

I think either I am unable to get the logic, or you have forgotten to write.

Thank you Rimeira

(Sachin).

Former Member
0 Kudos

Thank you all for your help!

I got a solution with you.

First, I had a mistake doing only one append after all itens into the internal table t_char.

After, I did a debug at the FM and found that I was putting the erroneous importing parameters:

instead of:

objectkeynew            = 'TEST'

the parameters should be:

objectkeynew            ='000000000001754490' 

The material number with leading zeros.

Now it works!