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

User Name for Material Document when using BAPI_GOODSMVT_CREATE

Former Member
0 Likes
1,416

Hi all,

I am using BAPI_GOODSMVT_CREATE to post goods movement.

My requirement is to create the material document with the given user name.

Ex: Using the BAPI_GOODSMVT_CREATE , if I post goods movement, the material document is created with my user name.

I want it to be created with the given user name.

For this, I used the field PR_UNAME of the import parameter GOODSMVT_HEADER.

It does not help me in creating the material doc. with the given user name.

I need to know, how we can post the material doc. using the given user name and which field of the import parameter i need to fill to get the expected result.

Thanks in advance

Uday Kumar.

1 REPLY 1
Read only

Former Member
0 Likes
765

Hi,

If there is no fields in the BAPI means, follow my idea.

You have to create one report program which will use BAPI_GOODSMVT_CREATE say Z_BAPICALL..

then you have to create background job using that report as shown below

 
 1.)  CALL FUNCTION 'JOB_OPEN'                       
   EXPORTING                                    
      jobname                = w_jobname            
  IMPORTING                                     
    jobcount               = w_co_job_count             
  EXCEPTIONS                                    
    cant_create_job        = 1                  
    invalid_job_data       = 2                  
    jobname_missing        = 3                  
    OTHERS                 = 4       .           


 2.) SUBMIT Z_BAPICALL TO SAP-SPOOL                  
                     SPOOL PARAMETERS w_print_parameters
                     WITHOUT SPOOL DYNPRO               
   WITH p_wi_id EQ wf_w_wid                             
   USER wf_w_user        " here you can specify the user ID whom you want
   VIA JOB w_jobname NUMBER w_co_job_count AND RETURN.                   

3.)                                                        
CALL FUNCTION 'JOB_CLOSE'                              
  EXPORTING                                            
    jobcount                          = w_co_job_count 
    jobname                           = w_jobname      
   strtimmed                         = 'X'                        " This flag is important.Because this will start the job immediately like BAPI call.
         
 

This will solve your issue.

Thanks and Regards,

Senthil Kumar Anantham.