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

How to update 2 databases?

Former Member
0 Likes
652

Hello guys,

I have a problem, we have a programm and the updates to the first database "edpar" does...fine.

But I need to update some data for some kind of recording protocol to another new zdatabase.

IF aendern EQ 'X' AND t_tab3 IS NOT INITIAL.
         UPDATE edpar FROM TABLE t_tab3.
         IF sy-subrc EQ 0.
                 LOOP AT t_zix_log INTO s_zix_log.
                 s_zix_log-inpnr_alt = <tab>-inpnr.
                 s_zix_log-bname = sy-uname.
                 s_zix_log-datum = sy-datlo.
                 s_zix_log-time  = sy-uzeit.

              ENDLOOP.
             s_zix_log-expnr = s_tab3-expnr.
             s_zix_log-parvw = s_tab3-parvw.
             s_zix_log-kunnr = s_tab3-kunnr.
             s_zix_log-inpnr_neu = s_tab3-inpnr.
               UPDATE zix_edpar_log From s_zix_log.
                  IF sy-subrc EQ 0.
                    COMMIT WORK AND WAIT.
                    ELSE.
                      ROLLBACK WORK.
                   ENDIF.
            COMMIT WORK AND WAIT.
          ELSE.
           ROLLBACK WORK.
         ENDIF.
       ENDIF



Changes are only updated if they're done at the last line of the t_tab3 , if I change inpnr of line before that nothing comes up to my database   

zix_edpar_log. And I don't get the inpnr from <tab> or even the sy-uname/datlo and time is always 00:00:00 .


Please help I am only student


Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
629

This message was moderated.

Hello guys,

I have a problem, we have a programm and the updates to the first database "edpar" does...fine.

But I need to update some data for some kind of recording protocol to another new zdatabase.

IF aendern EQ 'X' AND t_tab3 IS NOT INITIAL.
         UPDATE edpar FROM TABLE t_tab3.
         IF sy-subrc EQ 0.
                 LOOP AT t_zix_log INTO s_zix_log.
                 s_zix_log-inpnr_alt = <tab>-inpnr.
                 s_zix_log-bname = sy-uname.
                 s_zix_log-datum = sy-datlo.
                 s_zix_log-time  = sy-uzeit.

              ENDLOOP.
             s_zix_log-expnr = s_tab3-expnr.
             s_zix_log-parvw = s_tab3-parvw.
             s_zix_log-kunnr = s_tab3-kunnr.
             s_zix_log-inpnr_neu = s_tab3-inpnr.
               UPDATE zix_edpar_log From s_zix_log.
                  IF sy-subrc EQ 0.
                    COMMIT WORK AND WAIT.
                    ELSE.
                      ROLLBACK WORK.
                   ENDIF.
            COMMIT WORK AND WAIT.
          ELSE.
           ROLLBACK WORK.
         ENDIF.
       ENDIF



Changes are only updated if they're done at the last line of the t_tab3 , if I change inpnr of line before that nothing comes up to my database   

zix_edpar_log. And I don't get the inpnr from <tab> or even the sy-uname/datlo and time is always 00:00:00 .


Please help I am only student


Thanks

2 REPLIES 2
Read only

nishantbansal91
Active Contributor
0 Likes
629

Dear Andre,

First understand the purpose of loop.

    LOOP AT t_zix_log INTO s_zix_log.

                 s_zix_log-inpnr_alt = <tab>-inpnr.

                 s_zix_log-bname = sy-uname.

                 s_zix_log-datum = sy-datlo.

                 s_zix_log-time  = sy-uzeit.

              ENDLOOP.



Please check what your logic.

Because if your internal table contain 5 line's ur s_zix_log structure contains only last value.

and

<tab>-inpnr always contains blank because you have to assign some value to Field symbol.

Thanks

Nishant

Read only

Former Member
0 Likes
630

This message was moderated.