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

Submit program

Former Member
0 Likes
1,903

Hi,

My requirement is that I have to read the file from the application server, change the existing values of functional area with the new SAP functional Area & then submit it to standard SAP prg RFBIBL00.

OPEN DATASET V_FILEPATH FOR INPUT IN TEXT MODE ENCODING DEFAULT

MESSAGE V_MSG.

DO.

READ DATASET V_FILEPATH INTO T_INPUTFILE.

IF SY-SUBRC <> 0.

EXIT.

ELSE.

  • Perform to get the SAP Functional Area.

PERFORM GET_FKBER.

ENDIF.

APPEND T_INPUTFILE.

CLEAR T_INPUTFILE.

ENDDO.

IF T_INPUTFILE[] IS NOT INITIAL.

SUBMIT RFBIBL00 WITH DS_NAME = V_FILEPATH

WITH FL_CHECK = SPACE

WITH CALLMODE = 'B'

AND RETURN.

ENDIF.

My query is that the all my changes are reflected in t_inputfile. But I cannot submit the t_inputfile for DS_NAME, it is giving me error. What should I do so the my changes reflect in the actual physical file ... ?? What should I give in DS_NAME ?? .. so that when I run SM35 changes are seen there.

Thank You,

SB.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,765

What error are you getting? Do a CLOSE DATASET before submitting the program.

16 REPLIES 16
Read only

Former Member
0 Likes
1,765

Hi,

Just DELETE DATASET after populating t_inputfile. Then OPEN DATASET v_filename FOR OUTPUT IN TEXT MODE loop at t_inputfile, transfer all the contents in the new file with the same name and pass the file name to the program.

Regards,

Srikanth

Read only

Former Member
0 Likes
1,766

What error are you getting? Do a CLOSE DATASET before submitting the program.

Read only

0 Likes
1,765

Hi Srinivas,

I did as u said but still in SM35 it is showing the old values only ...

Read only

0 Likes
1,765

<i>> Hi Srinivas,

>

> I did as u said but still in SM35 it is showing the

> he old values only ...

</i>

What old values? I thought your issue is with the file not being accessable to your RFBIBL00 program. So now you are able to create the session, which means the file is no longer the issue. What is the issue now?

Read only

0 Likes
1,765

Hi Srinivas,

Well what i did was closed the dataset v_filepath. & then write the submit program ... even then the changes I did for functional area was not reflecting. I could see the old values while running the SM35 session. Then I used the suggestion of again open dataset for output command loop thru the t_inputfile , transfer the file to the application server, Close the dataset & then wrote the submit command ... it works fine for one file but for another file it errors...

Thank You,

SB

Read only

0 Likes
1,765

Is it possible to roughly explain your logic as a pseudo code? I will give it a try and you can expand/correct it as appropriate.

Read a file from desktop into an internal table.

Loop at the internal table and prepare the data in the RFBIBL00 file format.

Download the RFBIBL00 formatted file onto the application server.

Submit RFBIBL00 to process the file previously downloaded.

This creates SM35 sessions.

Please explain your process, may be there is something missing.

Srinivas

Read only

0 Likes
1,765

With regards to seeing old values, I think here is your problem.

You are uploading the file from application server into an internal table and changing the values in the internal table. But you are not tranferring the changed internal table back to the file. Here is flow you need to implement.

do.

open dataset myfile.

read file record.

exit if no record found.

append record to internal table.

enddo.

close dataset myfile.

open dataset myfile for output.

loop at the internal table.

modify functional area.

transfer record to myfile.

endloop.

close dataset myfile.

submit RFBIBL00.

Read only

0 Likes
1,765

Here is your modified code.


OPEN DATASET V_FILEPATH FOR INPUT IN TEXT MODE 
                         ENCODING DEFAULT
                          MESSAGE V_MSG.
DO.
  READ DATASET V_FILEPATH INTO T_INPUTFILE.
  IF SY-SUBRC <> 0.
    EXIT.
  ELSE.
* Perform to get the SAP Functional Area.
   PERFORM GET_FKBER.
  ENDIF.
  APPEND T_INPUTFILE.
  CLEAR T_INPUTFILE.
ENDDO.

CLOSE DATASET V_FILEPATH.
IF T_INPUTFILE[] IS NOT INITIAL.
  OPEN DATASET V_FILEPATH FOR OUTPUT IN TEXT MODE 
                           ENCODING DEFAULT
                            MESSAGE V_MSG.
  LOOP AT T_INPUTFILE.
    TRANSFER T_INPUTFILE TO V_FILEPATH.
  ENDLOOP.
  CLOSE DATASET V_FILEPATH.
  SUBMIT RFBIBL00 WITH DS_NAME = V_FILEPATH
                  WITH FL_CHECK = SPACE
                  WITH CALLMODE = 'B' AND RETURN.
ENDIF.

Read only

0 Likes
1,765

Hi,

I get a file from other system in my application server.

I populate the data of V_Filepath(application server file) in T_inputfile.

Logic is applied to get the correct SAP functional area. (The logic is correct & I can see the new values in t_inputfile )

Close the dataset.

Submit to RFBIBL00 with DS_NAME = V_FILEPATH.

Now what was happening is that after execution of submit command I go to SM35 & process the session .. here the Func area was the old values ...

So I again wrote

Open dataset v_filepath for output.

Loop at t_inputfile.

transfer t_inputfile to v_filepath.

endloop.

close dataset v_filepath.

Then write Submit to RFBIBL00 with DS_NAME = V_FILEPATH.

Read only

0 Likes
1,765

So your logic now is more or less like the one I posted previously? Can you please post the latest piece of that code?

Srinivas

Read only

0 Likes
1,765

<i>it works fine for one file but for another file it

> errors... </i>

So you are uploading multiple files. How is your loop logic for multiple files?

Get the list of files.

loop at the file list.

get the file contents into internal table.

modify the functional area.

close the file.

open the file.

transfer the contents of the internal table to file.

close the file.

submit RFBIBL00.

refresh the contents of <b>all internal tables</b>

read the next file and repeat the process.

Read only

0 Likes
1,765

Yes that's the way it is & works fine for one file but for another file gives an error saying unable to open the file . I have checked with others & it is guessed that it may have to do with file auhorizations coming from the other application system on to my application server....

for the above thing I also tried this ... I went to sxda_tools transaction ..

gave object type BKPF,

Program type DINP,

Program RFBIBL00,

File type physical

filename v_filepath (/usr/sap/...)

click change , go to next screen , changed one feild BBSEG-SGTXT , saved it , again saved it ... there it was trowing an error Unable to open the file ... then I came to know that this is not due to my code but something to do with authorizations at the system level...

Read only

0 Likes
1,765

Ok, if that is the case then I guess your problem is resolved. Someone will take care of the permissions and you can then read all the files.

Please close the post if that is the case.

Thanks,

Srinivas

Read only

0 Likes
1,765

I did that ... hopefully it reflects

Read only

0 Likes
1,765

Nope, you either select 'Problem Solved' next to any post or 'Solved on my own' next to your first post.

Read only

Former Member
0 Likes
1,765

Hi sb,

1. Capital / Lower case

check out the exact name of the file

on the application server.

Each letter should be EXACTLY in the same case

(In unix/aix, upper/lower case is very important)

regards,

amit m.