cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use LDB in a WDA !?

Former Member
0 Kudos

Can I use LDB in a WDA !?

Just like we do in a HR ABAP program with PNP or PCH .

and get the infotype data with Get PERNR .

If the LDB doesn't work in WDA again,

Is there any other special tools in WDA for HR develop !?!?!?

Thanks a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member194198
Active Participant
0 Kudos

Logical Databases are evil.

We've been using standard select statements in HR related Portal developments for many years with no problems.

E.g.

Select * from pa0001

where begda le sy-datum

and endda ge sy-datum

Thanks

Richard

Former Member
0 Kudos

To read the infotypes in WD4A I would suggest that you use the decoupled classes and not do a direct read on the tables.

- Harish.

kmoore007
Active Contributor
0 Kudos

SELECT statements are dangerous when dealing with HR data. LDB's do automatic authorization checks in HR. Hope you are putting in some authorization checks in your custom code.

Former Member
0 Kudos

Hi Wang,

Here in my project what we are doing to read the infotype is see the code whcih will give clear idea.

Here in my example i am reading the infortype 221.

<b>Code:</b>

method GET_221_DATA .

  • This method gets the 0221 data by calling the model component.

  • The dataset retrieved is then mapped to the Do_Not_Change node.

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

DATA:

lt_infotype_datasets TYPE /kyk/s_paitf_dataset_tab,

lv_temp TYPE string. " to hold the fieldname in a string type

DATA lo_nd_node_it0221structure TYPE REF TO if_wd_context_node.

DATA lo_el_node_it0221structure TYPE REF TO if_wd_context_element.

DATA ls_node_it0221structure TYPE wd_this->element_node_it0221structure.

  • declarations for 0221 data

DATA:

ls_infotype_dataset TYPE /kyk/s_paitf_dataset,

it_ui_structure TYPE /kyk/t_dataset_uistructure,

wa_ui_structure TYPE /kyk/s_dataset_uistructure,

wa_field_structure TYPE /kyk/s_value_of_field,

wa_field_structure1 TYPE /kyk/s_value_of_field,

it_field_structure TYPE /kyk/t_value_of_field.

DATA:

l_ref_interfacecontroller TYPE REF TO /kyk/iwci_c_pa_model,

l_componentinterface TYPE REF TO if_wd_component_usage.

l_componentinterface = wd_this->wd_cpuse_model( ).

IF l_componentinterface->has_active_component( ) IS INITIAL.

l_componentinterface->create_component( ).

ENDIF.

l_ref_interfacecontroller = wd_this->wd_cpifc_model( ).

ls_node_it0221structure-begda = '18000101'.

ls_node_it0221structure-endda = '99991231'.

ls_node_it0221structure-pernr = PERNR.

l_ref_interfacecontroller->readinfty(

EXPORTING

begda = ls_node_it0221structure-begda " Begda

endda = ls_node_it0221structure-endda " Endda

infty = '0221' " Infty

pernr = ls_node_it0221structure-pernr " Persno

subty = '*' " Subty

IMPORTING

patif_dataout = lt_infotype_datasets " /kyk/s_Paitf_Dataset_Tab

).

delete lt_infotype_datasets where subty ne 'YAWA' and subty ne 'YANA'.

    • navigate from <CONTEXT> to <NODE_IT0221STRUCTURE> via lead selection

lo_nd_node_it0221structure = wd_context->get_child_node( name = wd_this->wdctx_node_it0221structure ).

*--- first loop at infotype dataset

LOOP AT lt_infotype_datasets INTO ls_infotype_dataset.

it_ui_structure = ls_infotype_dataset-uifields.

lo_el_node_it0221structure = lo_nd_node_it0221structure->create_element( ).

lo_nd_node_it0221structure->bind_element( new_item = lo_el_node_it0221structure set_initial_elements

= abap_false ).

*---set lead selection

lo_nd_node_it0221structure->set_lead_selection( lo_el_node_it0221structure ).

**---second loop at uifieldstructure

LOOP AT it_ui_structure INTO wa_ui_structure where structurename eq 'HCMT_BSP_PA_CA_R0221'.

it_field_structure = wa_ui_structure-fieldvalues.

*--- Do not read if STATUS is not 'X'

READ TABLE it_field_structure WITH KEY fieldname = 'ADJRN' INTO wa_field_structure1.

IF wa_field_structure1-fieldvalue <> 'X'.

lo_nd_node_it0221structure->remove_element( lo_el_node_it0221structure ).

ELSE.

*---third loop at fieldstructure

LOOP AT it_field_structure INTO wa_field_structure.

  • Set all the general attribute values

lv_temp = wa_field_structure-fieldname.

CALL METHOD lo_el_node_it0221structure->set_attribute

EXPORTING

value = wa_field_structure-fieldvalue

name = lv_temp.

ENDLOOP.

ENDIF.

ENDLOOP.

ENDLOOP.

endmethod.

Warm Regards,

Vijay