Application Development 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: 

Transaction

Former Member
0 Kudos

Hi all,

I have a ztable. I have 10,000 records to be updated into this ztable. I thought of going for a BDC program.

So in se38 I created a module pool program with a single screen which contains all the fields of the ztable. Also I implemented logic for this(On clicking save) in the PAI event. I gave a tcode too. when I try to do update single record using this tcode I am able to do that.But now I need to implement call transaction method with this. When I try to do recording I am not able to do that.I went to tcode shdb and gave the tcode zvlf and said start recording. I am taken to the screen I have designed, after I enter all the values I am not able to save the recording.

Can anyone please help me with this.

Regards,

Vijay.

1 ACCEPTED SOLUTION

suresh_datti
Active Contributor
0 Kudos

Hi Vijay,

If your reqt is just to update the Z table, why do you need a Transaction/BDC? You can put all your entries in a flat file, upload into an itab in a custom program using GUI_UPLOAD & UPDATE the ztable from the itab.

regards,

Suresh Datti

12 REPLIES 12

suresh_datti
Active Contributor
0 Kudos

Hi Vijay,

If your reqt is just to update the Z table, why do you need a Transaction/BDC? You can put all your entries in a flat file, upload into an itab in a custom program using GUI_UPLOAD & UPDATE the ztable from the itab.

regards,

Suresh Datti

0 Kudos

Hi,

The client wants me to develop a bdc for this requirement. Can you suggest me a method.

Regards,

Vijay

0 Kudos

sounds strange.. OK if that is what they want.. when you tried to save the recording, what is the error you got?

Regards,

Suresh Datti

0 Kudos

Hi Suresh,

I don't get any error. I go to tcode shdb give the name and tcode zvla and say start recording. I am taken to the screen I have developed. I enter the values and say the record is updated to the table but the recording is not saved. I will attach the code I have developed.

*********************************************************

Report zvlfa1.

tables zvlfa1.

data : lifnr like zvlfa1-lifnr,

NAME1 like zvlfa1-name1,

REGION like zvlfa1-REGION,

land like zvlfa1-land,

amount like zvlfa1-amount.

data: okcode type sy-ucomm, answer.

----


  • Module STATUS_0100 OUTPUT

----


module STATUS_0100 output.

SET PF-STATUS 'ZLFA'.

SET TITLEBAR 'ZTIT'.

endmodule. " STATUS_0100 OUTPUT

----


  • Module USER_COMMAND_0100 INPUT

----


module USER_COMMAND_0100 input.

case okcode.

when 'SAVE'. " <b>Push button on the screen to save contents to the ztable.</b>zvlfa1-lifnr = lifnr.

zvlfa1-name1 = name1.

zvlfa1-REGION = region.

zvlfa1-land = land.

zvlfa1-amount = amount.

*******************************************

call function 'POPUP_TO_CONFIRM'

exporting

TITLEBAR = 'Title for POPUP_TO_CONFIRM' "(A01)

  • diagnose_object = 'TEXT1_ZUM_POPUP_TO_CONFIRM'

text_question = 'Do you want to continue?' "(A02)

text_button_1 = 'Yes' "(A03)

ICON_BUTTON_1 = 'ICON_OKAY'

text_button_2 = 'Cancel' "(A04)

ICON_BUTTON_2 = 'ICON_CANCEL'

DEFAULT_BUTTON = '1'

DISPLAY_CANCEL_BUTTON = ' '

  • userdefined_f1_help = 'TEST_TEXT_ZUR_SPO1'

START_COLUMN = 25

START_ROW = 6

importing

answer = answer.

  • exception

  • TEXT_NOT_FOUND = 1

  • others = 2.

*******************************************

if answer eq 1.

insert zvlfa1.

if sy-subrc eq 0.

message s002(ZVM) .

endif.

elseif answer eq 2.

message e003(ZVM).

endif.

when 'BACK'.

call transaction 'SE38'.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

*********************************************************

Regards,

Vijay

0 Kudos

In your logic for 'BACK',do SET SCREEN 0, LEAVE SCREEN. Do not call SE38 again.

Are you doing the recording all the way till the end where it gets inserted after confirming the pop-up? You have to take it to the end.

Srinivas

0 Kudos

Hi Srinivas,

I changed the code as you said. I have only one screen. So what I am doing is I am just entering the values and click the save button.The record is getting inserted but the transaction is not recorded.

Regards,

Vijay.

0 Kudos

After clicking the SAVE button, are you also continuing to record the pop-up messageand click ok there also? What exactly do you mean by 'not recorded'? You started SHDB, entered the transaction name and started the recording and you don't see the option for stopping the recording and saving it?

Srinivas

0 Kudos

Hi srinivas,

When we record for MM01 or any other tcode after we click save we will be taken to a screen where You can see screen number, name, program name etc. And then you say save, the recording is saved. I am expeting the same after I click save. But instead of that the values get populated into ztable and I do not see my recording in SHDB tcode.

If I am really confusing Let me make it simple.

I have an ztable into which I want to populate data. I need to use bdc method for that. Can you please explain me the steps.

Regards,

Vijay.

0 Kudos

Ok, now I think I understand the problem. Please add the SET SCREEN 0 and LEAVE SCREEN at the following location(in bold)


case okcode.
  when 'SAVE'.
    zvlfa1-lifnr = lifnr.
    zvlfa1-name1 = name1.
    zvlfa1-REGION = region.
    zvlfa1-land = land.
    zvlfa1-amount = amount.
*******************************************
    call function 'POPUP_TO_CONFIRM'
      exporting
        TITLEBAR = 'Title for POPUP_TO_CONFIRM' "(A01)
*       diagnose_object = 'TEXT1_ZUM_POPUP_TO_CONFIRM'
        text_question = 'Do you want to continue?' "(A02)
        text_button_1 = 'Yes' "(A03)
        ICON_BUTTON_1 = 'ICON_OKAY'
        text_button_2 = 'Cancel' "(A04)
        ICON_BUTTON_2 = 'ICON_CANCEL'
        DEFAULT_BUTTON = '1'
        DISPLAY_CANCEL_BUTTON = ' '
*       userdefined_f1_help = 'TEST_TEXT_ZUR_SPO1'
        START_COLUMN = 25
        START_ROW = 6
      importing
        answer = answer.
*     exception
*       TEXT_NOT_FOUND = 1
*       others = 2.
*******************************************
    if answer eq 1.
      insert zvlfa1.
      if sy-subrc eq 0.
        message s002(ZVM) .
      endif.
    elseif answer eq 2.
      message e003(ZVM).
    endif.
  when 'BACK'.
  when OTHERS.
endcase.
<b>SET SCREEN 0.
LEAVE SCREEN.</b>

The problem was that after you save, you are not exiting the program screen. So you are not seeing the recording screen again. You haven't left your transaction completely.

Srinivas

0 Kudos

Hi,

Thank you Srinivas and Suresh for your valuable answers.

Thanks a Ton !!!

Regards,

Vijay.

0 Kudos

Hi Srinivas,

It worked but can you please explain me the reason. What difference it makes when I give those two lines of code.

Regards,

Vijay.

0 Kudos

Actually, please move those two lines inside the WHEN 'SAVE' and WHEN 'BACK', because if those lines are outside the CASE statement, they will be executed even if you press enter in your screen and you will be taken out of the screen.


CASE okcode.
  WHEN 'SAVE'.
    ......
    ..... 
    SET SCREEN 0.
    LEAVE SCREEN.
  WHEN 'BACK'.
    SET SCREEN 0.
    LEAVE SCREEN.
  WHEN OTHERS.
*-- do nothing.
ENDCASE.

What these two statements does is to take the user out of the current screen back to the screen from where the transaction is initiated. Earlier, when you press SAVE, you are saving the entries, but you are taking the user out of the screen. Either you have to record the 'BACK' after 'SAVE' or you do it this way. Hope this clarifies.

Srinivas