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

Reading from application server

0 Likes
512

Hi All,

I have a requirement wherein I need to uplaod an excel sheet which contains Material number, Plant and PO text. And accordingly update the material and plant with the given PO text. Now, if i have mat1, Plant1 and PO text given for this combination in the excl as below:

"This is the new PO Text

Please Update it"

If the above is the PO text (with a line's gap between 2 statements), the requirement is to upload this text into application server. Then in the update program, i need to read this text for the corresponding material and plant.

The uploading is happening correctly into the app server:

Mat1     Plant1     This is the new PO Text 

                           Please Update it

But while reading from the application server in the update program, the first read dataset statement reads only Mat1     Plant1     This is the new PO Text. This record is filled in the internal table meant for update. The structure of the internal table is Material, Plant, PO text.

Now the control goes to the next read dataset statement and reads text "Please Update it". This text is filled in the material column of the internal table and hence gives an error at the time of update.

The syntax used to upload into app server is :

 

OPEN DATASET

p_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

Transfer each record

The syntax used to read from app server is :

 

 

OPEN DATASET

p_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

If sy-subrc = 0.

Do.

Read dataset p_path into v_appltxt (where v_appltxt is of type string)

if sy-subrc = 0.

     fill the internal table for update.

Else.

exit.

Endif.

Enddo.

Please help me rectify the issue at the time of reading from the app server so that the PO text(no matter how is in entered in the excel sheet) is read against the correspoding material and plant combination.

Thanks

3 REPLIES 3
Read only

Former Member
0 Likes
468

Hi Jean,

     READ DATASET statement will always read one line of input file at a time. Since the PO text is not continuous, Its gettng read into material number in the next fetch.

     As a solution, try to keep the PO text entirely while uploading data to application server. You may have to put in logic to remove extra lines after the data is retrieved from the excel sheet to the internal table.

Hope this helps.

~Athreya

Read only

0 Likes
468

I tried the Condense PO text option to do this, but is it not removing the gaps. Also the user expects us to update the material master with the text as is entered in the excel file. Say the user has some salutaion in the end of the text, this salutation will be entered as a separate text after leaving a gap of 1 or 2 lines. In such a case, what do I need to do to update the text. 

Read only

0 Likes
468

The condense statement does not work because of the following reason: When there are gaps in the text in the excel, while uploading this excel data into an internal table, the gaps are converted to Hash (#) symbols. So the condense does not work in this case. When writing to the app server, the hash symbold are converted back to gaps. Next step which is the reading from app server does not read the data properly.