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: 

How to Update the Maintain Activity Log for Documents using RFC

Former Member
0 Kudos

Hello all SAP Masters Here,

This is Rajnish Dubey and you are my last hope to solve my problem.

I have stuck at one place to update the Maintain Activity Log for the Contract.

Below is the Steps

SAP TC = SA38  -- > Z_RELATIONAL_VIEWER -> Enter the Documents Number and Execute --> Select the Doc and Uodate the Activity Log.

In Activity Log we have 3 fields to update

1) Activity type

2) Description

3) is the TEXT field and here i have Problem. I am not able to call this field in my Code. Below is the Code

add_bdcdata BdcTable, "SAPMS38M", "0101", "X", "", ""

add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "RS38M-PROGRAMM"

add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=STRT"

add_bdcdata BdcTable, "", "", "", "RS38M-PROGRAMM", "z_relational_viewer"

Then ..................

.....................

................

add_bdcdata BdcTable, "SAPLZMISC", "0100", "X", "", ""

add_bdcdata BdcTable, "", "", "", "ZACTIVITY_SCREEN-TYPE", "INPUT as per User"

add_bdcdata BdcTable, "", "", "", "ZACTIVITY_SCREEN-TEXT", "Input as per user"

???????????????????????????????/

add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=SAVE"

Before the SAVE , i need to update the Text value with two lines data.

Can you one help me in solving this issues.

I have attached the Screen print to understand. Also the Code is attached.

Thanks,

Rajnish Dubey

18 REPLIES 18

Former Member
0 Kudos

Can any one help me here?

0 Kudos

Hi Rajnish ,

Use Fm  SAVE_TEXT to save the text for that document ,

your problem will be solved without much change in your code.

Regards ,

Yogendra Bhaskar

0 Kudos

Hello Yogendra

Thank you so much for replying!!

I am not able to understand what do you mean by "Fm  SAVE_TEXT".

Can you write the Complete line (only for the to Update the Text).

Let me clear one thing, i am able to save the Data, but before Saving i have three field to update and i only able to update the first two field The last Filed is a "Text editor type" i have given the screen print for the clear understanding and this is the problem part.

I am not able to understand where to use the SAVE_TEXT.

please guide me

Regards,

Rajnish Dubey

0 Kudos

Hi rajnish ,

There is table STXH , which used to store the text in sap.

generally we use

TDOBJECT

TDNAME

TDID

to read a text for particular document through Function module " read_text ".

Similarly we can write a text for a document using  Function module  "write_text".

You require Textid i.e TDID and TDOBJECT for the same.

TDname will be the document no.

Regards,

Yogendra Bhaskar

0 Kudos

Hello Yogendra ,

Thank you so much for replying and spending time on my post.

I was not well for a long time, any way!!

I would like to know you that i am not well versed in code and just a beginner.

I tried to use the Table STXH but its say" Requested function is not available here".

I request you to can you edit my code and let me know. I mean how this code will execute.

Code is in the top of the page:

Thank you

Rajnsh Dubey

0 Kudos

Hi,

You will not be able to enter the data to SAP GUI frontend editor control using BDC or so called batch input: see note  311440 - Batch input and controls.The reason is simple - there is no frontend available during batch input... There is no easy solution to this, I believe. One would need to know the capabilities of the API you are using to interact with SAP to even suggest different method. If the BDC is the only method the API supports, something needs to change in SAP backend system - in Z_RELATIONAL_VIEWER. That would still be a messy solution - the Z program could try detecting if it's running under batch input and expose input fields for two text lines instead of editor control...

This is one of the main reasons the Business logic (Maintaining Activity log in your case) must always be separated from UI - so other solutions (like your macro) can access it without having to go to UI or having to deal with the limitations of things like BDC...

cheers

Jānis

0 Kudos

Hello Jānis

Thank you for the reply!

Can you suggest me is there any other way to update the Text as i need?

Thank you

Regards

Rajnish Dubey

0 Kudos

Hi,

My problem is - I know nothing about the particular Z solution you are trying to build an interface to or even what "Contract" that is...

If the business functionality of Z solution is not "exposed" in any other way in SAP than via BDC, and if the only access your macros (they have something to do with Excel, right?) have to SAP system is via BDCs, I'd say - reverse the control. An ABAP program should read whatever data it needs from the Excel files and "do the business" that needs to be done using the data. It would not IMO be wise to re-implement part of the business logic and dependencies (how to get from contract to that text and to update it) in some macro outside the SAP system.

I'm sorry I can't get more specific than that - I don't even know what kind of text we are talking about...

cheers

Jānis

former_member222709
Contributor
0 Kudos

Hey Rajnish,

Since you are able to update the first field, I believe your BDC call is working fine. To better understand the error, I can recommend you try the following:

1. Try using the T. Code: SE38

2. Instead of passing the value through the field 'ZACTIVITY_SCREEN-TEXT', hard code the value to 'ABCD' to test the code.

3. For two lines of data, you will have to do some research as most of the screen elements have an output length limitation of 256 characters. This is where FM 'SAVE_TEXT' helps. But, first confirm the hard coded value is saved.

Regards,

Pranav.

0 Kudos

Dear Pranav

It’s Being 1 year and still I have no solution to it.

I will try to explain you, Code is Below

add_bdcdata BdcTable, "SAPLZMISC", "0100", "X", "", ""

add_bdcdata BdcTable, "", "", "", "ZACTIVITY_SCREEN-TYPE", "12"   --> This I can able to Update.

add_bdcdata BdcTable, "", "", "", "ZACTIVITY_SCREEN-TEXT", "Only for test"  -->This Filed also I can able to update

{ Now I have one more Filed to Update with same text.

I can able to get the filed name for that.

I have attached a new Screen Print  for the test which I need to update. Then Finally I have to save the Screen with the below line. }

add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=SAVE"  --> This is the save command is working.

Help Me out Here!!!

Regards,

Rajnish Dubey

0 Kudos

Hi

The problem is the editor used to insert your text doesn't support a BDC, so I believe you need to consider another way to update the data

Max

0 Kudos

Dear Max

If Possible, Can you advise me another way i will try that.

Regards,

Rajnish Dubey

0 Kudos

Hi

You need to call a custom report z_relational_viewer, so I can't know what that program does, but it can try to change it in order it can support the BDC or update the database directly (if it updates custom tables)

Nax

former_member222709
Contributor
0 Kudos

Hi Rajnish,

As rightly suggested by Janis as well as Max, your problem does not a standard solution as your requirement is to update Free Text in a custom program. I can still recommend a few options and you can try these:

1.     As this is a custom program, please try to understand the original code for the transaction/program with reference to where the data entered as free text is stored?

2.     You can identify this by taking an example of an existing activity log and locating the data stored

3.     This data should be stored in the table STXH and STXL where you will have to identify the parameters TDOBJECT, TDID, etc.

4.     Once you have this information, you can execute the BDC program without the Free text and update the Free text as an update to the transaction.

Pranav.

Private_Member_7726
Active Contributor
0 Kudos

Hi guys,

Look at the code.txt.zip guys - it's some kind of Excel macro, if I'm not mistaken... So I suspect the scenario is as follows:- the data resides in Excel and the macro is invoking a Z transaction via BDC in SAP system. So, there is no other SAP program involved which could update the text, even if one magically manages to pass the text from Excel to it via BDC, bypassing frontend (SAP GUI) text editor control...

Rajnish, one year later, can you at least confirm that the scenario is as follows, please:

1) that it's an Excel Macro in code.txt.zip and that the data to be fed to SAP resides somewhere in Excel;

2) that Excel invokes via BDC a custom dialog transaction in SAP system with this data

Thanks,

Janis

0 Kudos

Dear Jains

yes, I am using Excel Macro to update the values in the Loop for many documents numbers.

Also Yes, Excel, invokes via BDC. I am looking for the field Name for the Text Box so that excel will call the text box and will hold the value.

Thanks,

Rajnish Dubey

0 Kudos

Hi,

The problem is - there is no "normal" dynpro field behind that text editor. It is built using so called SAP GUI Control. One can not address the GUI control contents using field name, or execute the GUI control under BDC...

Are you an ABAP programmer as well? If not, ask the company to get hold of one to solve this issue. What one could try is:- in addition to the text editor, which is shown to dialog user, one could put one or several additional fields on that screen, which would get exposed/processed only when the program is run in BDC mode. Then you can feed the text via those fields. Unfortunately, if would still be ugly solution, because the length of normal dynpro field is limited to 132.

Edit in: or maybe even better idea - an ABAPer should explore, whether that Z transaction can be extended to expose SAPScript line editor (normal table control based one) instead of the GUI control text editor, when running under in BDC mode:

As inline editor, you can use an editor based on screen-processing techniques or on the controls technology

But the basis for these solutions is ABAP to first extend the SAP part; I don't believe there Excel side macros can achieve anything on their own here, without first extending the SAP application.

cheers

Jānis

0 Kudos

Dear Jains


Thank you for the kind explanation. I understood the Problem and the also got the idea how to solve this.


Thank you so much.


Regards,

Rajnish Dubey