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: 

Purchase Requisition field is mandatory in ME21N T-code How to upload excel file in ME21N T-Code

Former Member
0 Kudos

Hi Experts,

I have done one enhancement(BADI) in ME21N T-code( Purchase Inquisition filed is mandatory in ME21N T-code). Now I have to upload excel file in ME21N T-code. I have used BAPI_PO_CREATE when i call this function module one error message i am getting 'Please enter the Purchase requisition filed'. How i can upload with out mandatory field in ME21N T-code. I am using BAPI_PO_CREATE1 also i am getting error. Please send me a sample program.

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

Well, you have to change your check in the BAdI, do not check the field if the PO is created via a BAPI but check it when user use transaction. You could find it by analyzing call stack :

call function 'SYSTEM_CALLSTACK'
     importing
       et_callstack = lt_callstack.
   loop at lt_callstack transporting no fields where eventname cs 'BAPI'.
     exit.
   endloop.
   if sy-subrc eq 0. " BAPI

Regards,

Raymond

Former Member
0 Kudos

Hi Mahesh,

You can use IMPORT and Export statements for your requirement.

For Example.

write export statement in your BAPI_PO_CREATE1 program.

EXPORT FLAG TO MEMORY ID 'FLAG_SET'

and in your badi,write,

IMPORT FLAG FROM MEMORY ID 'FLAG_SET'.

IF FLAG <> 'X'.

your badi code.

ENDIF.

Hope this will help you.