cancel
Showing results for 
Search instead for 
Did you mean: 

What is The Field Mapping of BAPI_REQUISITION_CRAETE ?

shahad009
Participant
0 Kudos

Hello Experts,

I have created a program to create purchase requisition in mass.Below is my Selection screen.

Excel File has 4 fields material ,requisition quantity, Sales order, SO Item.

After giving these selection screen inputs PR Should be created.

I am using the Bapi : BAPI_REQUISITION_CREATE .

In the return tab showing error :

In the selection screen field IF Acct.cat is blank PR is created successfully

Below messages are showing based on data in selection screen field Acct.cat

If given F OR K

“Error in function can be made to G/L acct. 310370 in CoCode 8100”

If given C

“S not exist” ( Screen shot given in image file)

Sandra_Rossi
Active Contributor
0 Kudos

What error codes are these?

The closest messages are:

  • ME 038 No direct postings can be made to G/L acct. & in CoCode &
  • No idea for "S not exist". I doubt it's the exact message, or it is a custom message.
Sandra_Rossi
Active Contributor
0 Kudos

Also, please be careful if by editing your question you make the answers obsolete.

e.g. the question to which Jens answered "leading zeroes...material number" was "In the return tab showing error : The material 8000000190 does not exist or is not activated".

shahad009
Participant
0 Kudos

sandra.rossi

I think the filed in the selection screen account assignment category mapping is going wrong somewhere...

Below are the two tables mapping that I am passing in the bapi.

FORM post_data_to_bapi.

DATA: itab_bapiebanc LIKE bapiebanc OCCURS 0 WITH HEADER LINE,
wa2 TYPE bapiebanc.
DATA: itab_bapiebkn LIKE bapiebkn OCCURS 0 WITH HEADER LINE,
wa3 TYPE bapiebkn.

DATA: BEGIN OF errmsg OCCURS 10.
INCLUDE STRUCTURE bapiret2.
DATA: END OF errmsg.
DATA: errflag.

LOOP AT itab INTO DATA(wtab).

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = wtab-matnr
IMPORTING
output = wtab-matnr.

MOVE wtab-matnr TO wa2-material.
MOVE wtab-req_quan TO wa2-quantity.
APPEND wa2 TO itab_bapiebanc.
ENDLOOP.

LOOP AT itab INTO DATA(wtab1).
MOVE wtab1-s_ord TO wa3-sd_doc.
MOVE wtab1-s_item TO wa3-sdoc_item.
APPEND wa3 TO itab_bapiebkn.
ENDLOOP.



LOOP AT itab_bapiebanc .

itab_bapiebanc-doc_type = doc_type.
itab_bapiebanc-plant = plant.
itab_bapiebanc-store_loc = p_loc.
itab_bapiebanc-acctasscat = act_cat.
itab_bapiebanc-deliv_date = del_date.
itab_bapiebanc-preq_name = requis.
itab_bapiebanc-trackingno = trac_num .
itab_bapiebanc-pur_group = pur_grp .

MODIFY itab_bapiebanc.

ENDLOOP.



LOOP AT itab_bapiebkn .
itab_bapiebkn-cost_ctr = cost_c .
itab_bapiebkn-order_no = ord_num.

MODIFY itab_bapiebkn.
ENDLOOP.


CALL FUNCTION 'BAPI_REQUISITION_CREATE'
EXPORTING
* SKIP_ITEMS_WITH_ERROR =
automatic_source = 'X'
* IMPORTING
* NUMBER = n
TABLES
requisition_items = itab_bapiebanc
requisition_account_assignment = itab_bapiebkn
* REQUISITION_ITEM_TEXT =
* REQUISITION_LIMITS =
* REQUISITION_CONTRACT_LIMITS =
* REQUISITION_SERVICES =
* REQUISITION_SRV_ACCASS_VALUES =
return = errmsg.
* REQUISITION_SERVICES_TEXT =
* REQUISITION_ADDRDELIVERY =
* EXTENSIONIN =

LOOP AT errmsg.
IF errmsg-type EQ 'E'.
WRITE:/'Error in function', errmsg-message.
errflag = 'X'.
ELSE.
WRITE:/ errmsg-message.
ENDIF.
ENDLOOP.





ENDFORM.
Sandra_Rossi
Active Contributor
0 Kudos

This ABAP coding has been obsolete for 25 years:

  DATA: BEGIN OF errmsg OCCURS 10.
          INCLUDE STRUCTURE bapiret2.
  DATA: END OF errmsg.

Instead it should be:

DATA errmsg TYPE TABLE OF bapiret2.
Sandra_Rossi
Active Contributor
0 Kudos

Note that BAPIRET2 is also wrong because BAPI_REQUISITION_CREATE has parameter RETURN defined like a table of BAPIRETURN.

Sandra_Rossi
Active Contributor
0 Kudos

This has been obsolete for 15 years too:

  DATA: itab_bapiebanc LIKE bapiebanc OCCURS 0 WITH HEADER LINE,

It should be:

  DATA itab_bapiebanc TYPE TABLE OF bapiebanc.
Sandra_Rossi
Active Contributor
0 Kudos

Subroutines are obsolete too.

hmm I'm not very precise about the years 😛

  • 2005 7.0 header lines / occurs are made obsolete (19 years)
  • 2009 7.02 subroutines are made obsolete (15 years)
View Entire Topic
jens_michaelsen
Participant
0 Kudos

Please check if leading zeros are needed. If yes you must convert the material number with Funktion module convert exit alpha input

shahad009
Participant
0 Kudos

The issue is resolved but now its showing another error

In the selection screen field IF Acct.cat is blank PR is created successfully

but if the value is C

Below messages are showing based on data in selection screen field Acct.cat

If given F OR K

“Error in function can be made to G/L acct. 310370 in CoCode 8100”

If given C

“S not exist” ( Screen shot given in image file)

err.png

Sandra_Rossi
Active Contributor
0 Kudos

shahad009 Please embed the image in the comment or in the question e.g.

Note that you'd better choose the adequate data type for your internal table ERRMSG to avoid this very bad formatting.

Answers already exist about KO104 "Order & does not exist":