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

Saving long text

Former Member
0 Likes
1,187

Hi experts,

Iam working on dialog programing and i have requirement to save two long texts at a time.

I put the long texts(custom controls) in tab strip control(container1,container2).

My problem is while saving....

1)if i enter data only in first container the data is getting saved.

2)If i enter data in second container it is getting saved.

3)But if i enter data in both the containers, <b>only second container data is getting saved.</b>

What might be the reason? What iam doing wrong?

(commit text written after the save_text.)

Reward guaraneed

thanks

kaki

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,151

Hi Kaki,

Include the logic to save data from TAB1 under SAVE of Tab2.

CASE ok_code.

WHEN 'SAVE'.

t_rhead-tdname = ag_no.

t_rhead-tdid = 'Z001'.

t_rhead-tdspras = sy-langu.

t_rhead-tdobject = 'ZAGREEMENT'.

CALL METHOD rem->get_text_as_stream

IMPORTING

text = rem_tab[].

LOOP AT rem_tab.

t_remk-tdformat = '/'.

t_remk-tdline = rem_tab.

APPEND t_remk.

ENDLOOP.

PERFORM SAVE_TEXT.

CALL FUNCTION 'COMMIT_TEXT'.

ENDCASE.

<b>This is tab2 container2 code</b>

CASE ok_code.

WHEN 'SAVE'.

CALL METHOD notes->get_text_as_stream

IMPORTING

text = notes_tab[].

IF flag_cont2 = 1.

LOOP AT notes_tab.

t_notes-tdformat = '/'.

t_notes-tdline = notes_tab.

APPEND t_notes.

ENDLOOP.

ENDIF.

t_nhead-tdname = ag_no.

t_nhead-tdid = 'Z002'.

t_nhead-tdspras = sy-langu.

t_nhead-tdobject = 'ZAGREEMENT'.

PERFORM save_text.

CALL FUNCTION 'COMMIT_TEXT'.

<i><b>* To updated Tab1, when SAVE is clicked on TAB2</b></i>

<b> t_rhead-tdname = ag_no.

t_rhead-tdid = 'Z001'.

t_rhead-tdspras = sy-langu.

t_rhead-tdobject = 'ZAGREEMENT'.

CALL METHOD rem->get_text_as_stream

IMPORTING

text = rem_tab[].

LOOP AT rem_tab.

t_remk-tdformat = '/'.

t_remk-tdline = rem_tab.

APPEND t_remk.

ENDLOOP.

PERFORM SAVE_TEXT.

CALL FUNCTION 'COMMIT_TEXT'.</b>

ENDCASE.

Best regards,

Prashant

Message was edited by: Prashant Patil

12 REPLIES 12
Read only

Former Member
0 Likes
1,151

Hi,

It seems, that when you are moving from TAB 1 to another TAB 2, the container TAB 1 is released/freed.

Check in debug mode, whether while calling CONTAINER 2( TAB 2 ) on the tab strip, CONTAINER 1 ( TAB 1 ) is freed/cleared.

Best regards,

Prashant

Read only

Former Member
0 Likes
1,151

Hi Kaki,

may be that time second container is active, try this way

first enter second, then first and see in this case which one is getting saved.

if first one is saved, then it means the container which is active only getting saved.

Check it once.

Regards

vijay

Read only

0 Likes
1,151

Hi Prashant & Vijay,

Yes..while moving from tab1 to tab2 the the container losing data in tab1.Iam able to get only active container data.

Can you tell me how to get inactive container data...

Thanks

kaki

Read only

0 Likes
1,151

call those texts in the PBO of the first tab's screen...

Read only

0 Likes
1,151

Hi Kaki,

please show us the current relevant code at 'save' time.

Read only

0 Likes
1,151

Hi Neil..

This is <b>tab1</b>(container1) code



  CASE ok_code.
    WHEN 'SAVE'.
      t_rhead-tdname = ag_no.
      t_rhead-tdid = 'Z001'.
      t_rhead-tdspras = sy-langu.
      t_rhead-tdobject = 'ZAGREEMENT'.

      CALL METHOD rem->get_text_as_stream
        IMPORTING
          text = rem_tab[].

      LOOP AT rem_tab.
        t_remk-tdformat = '/'.
        t_remk-tdline = rem_tab.
        APPEND t_remk.
      ENDLOOP.

      PERFORM SAVE_TEXT. 
      CALL FUNCTION 'COMMIT_TEXT'.
  ENDCASE.

This is <b>tab2</b> container2 code



  CASE ok_code.
    WHEN 'SAVE'.

      CALL METHOD notes->get_text_as_stream
        IMPORTING
          text = notes_tab[].

      IF flag_cont2 = 1.
        LOOP AT notes_tab.
          t_notes-tdformat = '/'.
          t_notes-tdline = notes_tab.
          APPEND t_notes.
        ENDLOOP.
      ENDIF.

      t_nhead-tdname = ag_no.
      t_nhead-tdid = 'Z002'.
      t_nhead-tdspras = sy-langu.
      t_nhead-tdobject = 'ZAGREEMENT'.

      PERFORM save_text.
      CALL FUNCTION 'COMMIT_TEXT'.

  ENDCASE.

Only active tab data is getting saved.How can i save both tabs containers data??

Read only

0 Likes
1,151

hI kAKI,

CAN'T YOU MOVE THE LOGIC AWAY FROM THE CONTAINERS AND HAVE IT ONLY ONCE AT THE pai OF THE MAIN SCREEN instead?

The logic will need to be done for both containers there of course.

ps, I don't think the logic at TAB2 WILL ALWAYS WORK. wHAT IF THE USER DOESN'T GO TO TAB2?? i THINK IT WOULD BE BEST TO BE DONE CENTRALLY.

Read only

0 Likes
1,151

Hi Neil,

Can you tell me how to do Centrally at the main screen of PAI.I tried that. But i count not get it.

Read only

0 Likes
1,151

it should be just a case of cutting and pasting the code from the other areas and putting it in a pai module. You will need a 'save' button on the main screen and will need to test for that value.

Post your existing PAI logic if I'm not making sense.

Read only

Former Member
0 Likes
1,151

Hi Kaki,

Include a logic to populate the data into global variables when user moves from TAB1 to TAB2. I mean in the EVENT of moving from TAB1 to TAB2, populate the values of TAB1 into global variables.

This should solve the problem.

Best regards,

Prashant

Read only

Former Member
0 Likes
1,152

Hi Kaki,

Include the logic to save data from TAB1 under SAVE of Tab2.

CASE ok_code.

WHEN 'SAVE'.

t_rhead-tdname = ag_no.

t_rhead-tdid = 'Z001'.

t_rhead-tdspras = sy-langu.

t_rhead-tdobject = 'ZAGREEMENT'.

CALL METHOD rem->get_text_as_stream

IMPORTING

text = rem_tab[].

LOOP AT rem_tab.

t_remk-tdformat = '/'.

t_remk-tdline = rem_tab.

APPEND t_remk.

ENDLOOP.

PERFORM SAVE_TEXT.

CALL FUNCTION 'COMMIT_TEXT'.

ENDCASE.

<b>This is tab2 container2 code</b>

CASE ok_code.

WHEN 'SAVE'.

CALL METHOD notes->get_text_as_stream

IMPORTING

text = notes_tab[].

IF flag_cont2 = 1.

LOOP AT notes_tab.

t_notes-tdformat = '/'.

t_notes-tdline = notes_tab.

APPEND t_notes.

ENDLOOP.

ENDIF.

t_nhead-tdname = ag_no.

t_nhead-tdid = 'Z002'.

t_nhead-tdspras = sy-langu.

t_nhead-tdobject = 'ZAGREEMENT'.

PERFORM save_text.

CALL FUNCTION 'COMMIT_TEXT'.

<i><b>* To updated Tab1, when SAVE is clicked on TAB2</b></i>

<b> t_rhead-tdname = ag_no.

t_rhead-tdid = 'Z001'.

t_rhead-tdspras = sy-langu.

t_rhead-tdobject = 'ZAGREEMENT'.

CALL METHOD rem->get_text_as_stream

IMPORTING

text = rem_tab[].

LOOP AT rem_tab.

t_remk-tdformat = '/'.

t_remk-tdline = rem_tab.

APPEND t_remk.

ENDLOOP.

PERFORM SAVE_TEXT.

CALL FUNCTION 'COMMIT_TEXT'.</b>

ENDCASE.

Best regards,

Prashant

Message was edited by: Prashant Patil

Read only

0 Likes
1,151

Hi Prashant,

Thanks a lot.It is working fine.

Full points alloted.

cheers,

kaki