cancel
Showing results for 
Search instead for 
Did you mean: 

UJD_TEST_PACKAGE_LINK - Link Answer Prompt (XML)

Former Member
0 Kudos

Hi,

I have a requirement where I have to run the same link multiple time depending on what time of year it is. I was hoping to call the package link using UJD_TEST_PACKAGE_LINK and passing the answer prompt to set the prompts run time.

How can i set the prompts at run time? For example if I want to set Time dimension and run the link 12 times passing each month. Please also note that link has multiple steps to it.

Thanks,
D

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi D,

Is the result from first run required for the 2nd run?

How many steps are in the link?

Andy

Former Member
0 Kudos

Hi Andy,

Thank for your time. Yes I require result of one in another but that I know how to get around. There are about 6 steps in package link each of which needs Time to be populated during run which I am struggling with.

Thanks again.

Former Member
0 Kudos

Hi D,

Are they all calculations in the link?

are they all ABAP or combination of ABAP and script logic?

If they are all logics in your link then what you can do is that you can create a new LGF file and use script logic to call the logics or BADIs, you only select the start month then let the script logic to determine the reminder and loop through it.

Andy

Former Member
0 Kudos

They are all standard packages. No ABAP routines.

Former Member
0 Kudos

what standard packages are in the link?

consolidations?

former_member186338
Active Contributor
0 Kudos

Please describe the packages in the link in details! Then some workaround may be proposed!

Vadim

Former Member
0 Kudos

Here are the steps:

1. Load Transnational Data from BW

2. Load Transnational Data from BW(different account range)

3. Balance CarryForward

4. Equity Pickup

former_member186338
Active Contributor
0 Kudos

Details about prompts, please!

Former Member
0 Kudos

Vadim - They all have Time as a user selection on them which I want to change dynamically.

Thanks for your reply.

former_member186338
Active Contributor
0 Kudos

Sorry, but you are talking about different time selections:

1. Time selection for transaction data load from BW (/CPMB/LOAD_INFOPROV_UI)

2. Time selection for script logic.

Even time format is different...

Former Member
0 Kudos

Vadim,


Even if we can set Time prompt for below then we can get around the issue.


Balance CarryForward

Equity Pickup


Thanks,

Devang

former_member186338
Active Contributor
0 Kudos

Yes, but only with the help of abap! You can copy to Z UJD_TEST_PACKAGE_LINK and make the copy to generate the answer prompt!

Vadim

Former Member
0 Kudos

Yes but what should be format of the answer prompt. Do you have a sample code?

Thanks,

Devang Desai

former_member186338
Active Contributor
0 Kudos

Please read about UJD_TEST_PACKAGE here

Vadim

former_member186338
Active Contributor
0 Kudos

P.S. Aso here:

Former Member
0 Kudos

Hi Vadim,

I used the following code

CALL METHOD do_package_link->get_plink_prompt

       EXPORTING

         i_link_id         = 'SAJKHSA'

         i_appset_id    = 'XYZ'

         i_appl_id        = 'ABC'

         is_user          = ds_user

       IMPORTING

         et_link_prompt = lt_link_prompt_act

         e_link_detail  = l_link_detail_act.

It actually gives me current prompt value for each step in link but in XML format as below with

L_LINK_DETAIL_ACT.

I want to convert L_LINK_DETAIL_ACT XML value to answer prompt(key value pair).


Thanks,

Devang Desai

former_member186338
Active Contributor
0 Kudos

Sorry, but not clear what are you doing... Please provide details!

Former Member
0 Kudos

Alright, so below code gives me all the required details in XML format:

CALL METHOD do_package_link->get_plink_prompt

       EXPORTING

         i_link_id         = 'SAJKHSA'

         i_appset_id    = 'XYZ'

         i_appl_id        = 'ABC'

         is_user          = ds_user

       IMPORTING

         et_link_prompt = lt_link_prompt_act

         e_link_detail  = l_link_detail_act.

How do I convert and extract those value prompts from XML format to internal table.

Snapshot of the XML:

<PACKAGE>Default Logic</PACKAGE>

<TEAM>TEAM</TEAM>

<GROUP>Packages</GROUP>

<APPSET>Environment</APPSET>

<APPLICATION>CONS</APPLICATION>

<ANSWERPROMPT>%SELECTION% /AE_Environment/CONSOLIDATION/PRIVATEPUBLICATIONS/TNEWELL/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@|DIMENSION:CATEGORY|ACT|DIMENSION:RPTCURRENCY|LC,USD|DIMENSION:TIME|2015.12 </ANSWERPROMPT>

former_member186338
Active Contributor
0 Kudos

I do not understand what for do you need to convert xml (if you have some xml you can simply replace time value in this xml with the required one )

But if you want - you can parse xml with abap xml parser Parse an xml file and insert values in ABAP - ABAP Development - SCN Wiki

Vadim

Former Member
0 Kudos

Yes i did that with REPLACE all OCCURRENCES

But now how do I run package link using that XML. how do I do that?

I guess that will be last step. Thanks.

former_member186338
Active Contributor
0 Kudos

Just debug the Z copy of UJD_TEST_PACKAGE_LINK...

former_member186338
Active Contributor
0 Kudos

P.S. Just looked on the UJD_TEST_PACKAGE_LINK code - it's absolutely simple!

And yes, xml is not required at all...

former_member186338
Active Contributor
0 Kudos

In general you have to understand the structure of IT_CONFIGURATION passed to RUN_PACKAGE_LINK inside program UJD_TEST_PACKAGE_LINK.

I have set an external breakpoint in the beginning of RUN_PACKAGE_LINK and launched the package link (I set prompts after launching package link!). My test package link has 2 steps:

TDM - prompt to select PERIODS member

TDM2 - prompt to select PERIODS member

Results:

Everything is clear!

Vadim

Former Member
0 Kudos

Vadim,

Thanks for helping out. What I tried to do is read CATEGORY as prompt user which they want the package link to run for 12 periods. So when I call the link every step should have CATEGORY and TIME passed to it.

which obviously is wrong looking at your screenshot. How do I convert the values which I have (2016.01, BUD,RF3) to the string which you have in above screenshot. I can hardcode Name to %SELECTION% but how do I derive string from the values.

I hope I didn't forgot to mention that that I have created a new data package(not package link) which prompts for CATEGORY and using that category I am trying to derive prompts for Package link which has TIME and CATEGORY.

I hope I am not too far from the solution.

Thanks again for your help.

Devang Desai

former_member186338
Active Contributor
0 Kudos

Actually you can use reduced string:

Like:

%SELECTION%      @@@SAVE@@@@@@EXPAND@@@|DIMENSION:TIME|2016.01|DIMENSION:CATEGORY|BUD,RF3

Read

Vadim

former_member186338
Active Contributor
0 Kudos

P.S. Full format of the SELECTION sting is like:

/ENVIR_NAME/MODEL_NAME/PRIVATEPUBLICATIONS/USER_NAME/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@|DIMENSION:DIMENSION_NAME|MEMBER_ID


but it can be reduced to:

@@@SAVE@@@@@@EXPAND@@@|DIMENSION:DIMENSION_NAME|MEMBER_ID


Multiple dimensions with multiple members can be defined in this string!


Vadim

Former Member
0 Kudos

Yes I was looking into it but @@@ char value has hexa 400040004000 where as string produced when I debug through my pakage link has hexa 004000400040 so I think even though it shows as @@@ as char value its different else behind the scene.

I hope I was clear with my explanation/question.

Thanks

former_member186338
Active Contributor
0 Kudos

Not clear! You have to put this string in the table LT_CONFIGURATION[...]-VALUE and that's all! Number of @ has to be correct as in my sample!

What is the issue?

former_member186338
Active Contributor
0 Kudos

Just for check:

From debug (string and hex)

/SIM/INPER/PRIVATEPUBLICATIONS/V.KALININ/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@|DIMENSION:PERIODS|2006.JUL,2006.AUG

2F00530049004D002F0049004E005000450052002F0050005200490056004100540045005000550042004C00490043004100540049004F004E0053002F0056002E004B0041004C0049004E0049004E002F00540065006D007000460069006C00650073002F00460052004F004D002E0054004D005000400040004000530041005600450040004000400040004000400045005800500041004E0044004000400040007C00440049004D0045004E00530049004F004E003A0050004500520049004F00440053007C0032003000300036002E004A0055004C002C0032003000300036002E00410055004700

Vadim

P.S. Compare:

T....M....P....@....@....@....S

5400 4D00 5000 4000 4000 4000 5300

Former Member
0 Kudos

Vadim - Yes you are right. I got it working. Below is the code just in case if somebody needs it. Thanks again for all the help.

Thanks,

Devang Desai

    lobj_context = cl_uj_context=>get_cur_context( ).

     ds_user = lobj_context->ds_user.

     CREATE DATA ls_value LIKE lt_configuration.

     CREATE DATA ln_value LIKE LINE OF lt_configuration.

     LOOP AT it_cv INTO lt_cv.

       IF lt_cv-user_specified = 'X'.

         LOOP AT lt_cv-member INTO wa_range.

           add_selection ls_ly_range lt_ly_range lt_cv-dimension wa_range space.

         ENDLOOP.

       ENDIF.

     ENDLOOP.

     CREATE OBJECT do_package_link TYPE cl_ujd_package_link.

     CALL METHOD do_package_link->get_plink_prompt

       EXPORTING

         i_link_id      = c_link                             

         i_appset_id    = i_appset_id                        

         i_appl_id      = i_appl_id                           

         is_user        = ds_user

       IMPORTING

         et_link_prompt = lt_link_prompt_act

         e_link_detail  = l_link_detail_act.

     LOOP AT lt_link_prompt_act INTO ln_link_prompt_act.

       CLEAR:ln_configuration.

       CONCATENATE ln_link_prompt_act-task_name lc_property_delimiter lc_property

                   lc_prevalue_delimiter lc_answerprompt lc_postvalue_delimiter

                   INTO ln_configuration-path.

       SPLIT ln_link_prompt_act-prompt AT '"' INTO v_temp ln_link_prompt_act-prompt.

       REPLACE ALL OCCURRENCES OF '"' IN ln_link_prompt_act-prompt WITH ''.

       SPLIT ln_link_prompt_act-prompt AT `,` INTO TABLE lt_prompt.

       IF lt_prompt IS INITIAL.

         CONTINUE.

       ENDIF.

       CLEAR: ls_prompt_line.

       ls_prompt_line-value = '/Environment/CONSOLIDATION/PRIVATEPUBLICATIONS/DDESAI/TempFiles/FROM.TMP@@@SAVE@@@@@@EXPAND@@@'.

       SORT lt_prompt ASCENDING.

       LOOP AT lt_prompt ASSIGNING <ls_column_data>.

         CONDENSE <ls_column_data>.

         CONCATENATE ls_prompt_line-value '|DIMENSION:' <ls_column_data> '|' INTO ls_prompt_line-value.

         ls_prompt_line-name  = '%SELECTION%'.

         IF <ls_column_data> = c_dim_time.

           CONCATENATE ls_prompt_line-value v_time_dummy INTO ls_prompt_line-value.

         ENDIF.

         LOOP AT lt_ly_range INTO ls_ly_range WHERE dimension = <ls_column_data>.

           IF sy-tabix <> 1.

             CONCATENATE ls_prompt_line-value ls_ly_range-low INTO ls_prompt_line-value SEPARATED BY ','.

           ELSE.

             CONCATENATE ls_prompt_line-value ls_ly_range-low INTO ls_prompt_line-value.

           ENDIF.

         ENDLOOP.

       ENDLOOP.

       APPEND ls_prompt_line TO ln_configuration-value.

       APPEND ln_configuration TO lt_configuration.

     ENDLOOP.

     CREATE OBJECT lo_package_link.

     CALL METHOD me->bpc_read_base_member

       EXPORTING

         i_enviroment_id    = i_appset_id

         i_dimension_id     = c_dim_time

         i_dimension_member = '2016.TOTAL'

       IMPORTING

         e_base_members     = lt_time_mbr.

     LOOP AT lt_time_mbr INTO lv_member.

       LOOP AT lt_configuration ASSIGNING <ls_configuration>.

         LOOP AT <ls_configuration>-value ASSIGNING <ls_variable>.

           IF <ls_variable>-name = '%SELECTION%'.

             REPLACE ALL OCCURRENCES OF v_time_dummy IN <ls_variable>-value WITH lv_member.

           ENDIF.

         ENDLOOP.

       ENDLOOP.

       v_time_dummy = lv_member.

       lo_package_link->run_package_link( EXPORTING i_appset_id     = i_appset_id

                                                 i_appl_id          = i_appl_id

                                                 is_user            = ds_user

                                                 i_link_id          = c_link                       

                                                 it_configuration   = lt_configuration

                                                 if_schedule        = abap_false

                                                 if_debug           = abap_true ).

     ENDLOOP.

Answers (0)