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

BAPI in ABAP

Former Member
0 Likes
2,113


Hello All,

I am new in ABAP ,i am basically from BW background. My business requires me  to write a code to get details of a DSO. I have searched SCN and found out that there is BAPI_ODSO_GETDETAIL. How do i use this in ABAP. I have searched in SCN for sample codes, i have found out for BAPI_PO_GETDETAIL but iam not able to use the simillar code for BAPI_ODS_GETDETAIL. My business requirement is to enter the technical name as input and the details of the ODS should be my output. I ahev tried with a sample code which i haev used but nothing is getting displayed. PLS help

the code whch i used

REPORT ZBAPIDSO.



DATA: begin of B_ODS occurs 0.

      include structure BAPI6116.

DATA: end of B_ODS.


Parameter B_ODSOBJ like BAPI6116-ODSOBJECT default 'Z_DISC'.


CALL FUNCTION 'BAPI_ODSO_GETDETAIL' "Read Details for a DataStore

  EXPORTING

*   objvers = RS_C_OBJVERS-ACTIVE  " bapi6116-objvers  Object version

    odsobject B_ODSOBJ

       " bapi6116-odsobject  DataStore

IMPORTING

details  = B_ODS            " bapi6116      DataStore Object - Details

*return   =          " bapiret2      BAPI return parameter

* TABLES

* infoobjects = B_ODS              " bapi6116io    InfoObjects in DataStore Object

*   navigationattributes =      " bapi6116na    Navigation Attributes for the DataStore Object

*   indexes =                   " bapi6116in    Indexes for a DataStore Object

*   indexesinfoobjects =        " bapi6116ii    DataStore Object InfoObjects in Indexes

.



loop at B_ODS.



  Write : / 'ODSOBJECT =  ' ,

          / 'objvers = ',

          / 'owner = ' .

  endloop .

Can you pls elaborate on what all mistakes i have done.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,002

Hi Sashankan,

This is source which you can check. You can cross check with your code and see your self what you have missed.

In the table RSDODSO you can check all the details of the DSO records.

Make sure you give correct value for this parameter OBJVERS               

REPORT  ZR_BAPI_DSO.

TYPE-POOLS rsdg.

  DATA: l_s_details        TYPE BAPI6116.
  DATA: l_s_return         TYPE BAPIRET2.
  DATA: l_t_infoobjects  TYPE TABLE OF BAPI6116IO.
   DATA: l_t_navigationattributes TYPE TABLE OF BAPI6116NA.
  
   DATA: l_t_indexes      TYPE TABLE OF BAPI6116IN.
   DATA: l_t_indexesinfoobjects TYPE TABLE OF BAPI6116II.
Parameter B_ODSOBJ like BAPI6116-ODSOBJECT default '0D_FC_D01'.


START-OF-SELECTION.

CALL FUNCTION 'BAPI_ODSO_GETDETAIL'
    EXPORTING
     OBJVERS                    = 'D' "RS_C_OBJVERS-ACTIVE
     ODSOBJECT                  = B_ODSOBJ
    IMPORTING
     DETAILS                    = l_s_details
     RETURN                     = l_s_return
    TABLES
     INFOOBJECTS                = l_t_infoobjects
     NAVIGATIONATTRIBUTES       = l_t_navigationattributes
     INDEXES                    = l_t_indexes
     INDEXESINFOOBJECTS         = l_t_indexesinfoobjects
             .

   Write : / 'ODSOBJECT =  ' ,l_s_details-odsobject,
           / 'objvers = ',l_s_details-objvers,
           / 'owner = ', l_s_details-owner .

  

Hi Sashankan,

This is source which you can check. You can cross check with your code and see your self what you have missed.

In the table RSDODSO you can check all the details of the DSO records.

Make sure you give correct value for this parameter OBJVERS               

REPORT  ZR_BAPI_DSO.

TYPE-POOLS rsdg.

  DATA: l_s_details        TYPE BAPI6116.
  DATA: l_s_return         TYPE BAPIRET2.
  DATA: l_t_infoobjects  TYPE TABLE OF BAPI6116IO.
   DATA: l_t_navigationattributes TYPE TABLE OF BAPI6116NA.
  
   DATA: l_t_indexes      TYPE TABLE OF BAPI6116IN.
   DATA: l_t_indexesinfoobjects TYPE TABLE OF BAPI6116II.
Parameter B_ODSOBJ like BAPI6116-ODSOBJECT default '0D_FC_D01'.


START-OF-SELECTION.

CALL FUNCTION 'BAPI_ODSO_GETDETAIL'
    EXPORTING
     OBJVERS                    = 'D' "RS_C_OBJVERS-ACTIVE
     ODSOBJECT                  = B_ODSOBJ
    IMPORTING
     DETAILS                    = l_s_details
     RETURN                     = l_s_return
    TABLES
     INFOOBJECTS                = l_t_infoobjects
     NAVIGATIONATTRIBUTES       = l_t_navigationattributes
     INDEXES                    = l_t_indexes
     INDEXESINFOOBJECTS         = l_t_indexesinfoobjects
             .

   Write : / 'ODSOBJECT =  ' ,l_s_details-odsobject,
           / 'objvers = ',l_s_details-objvers,
           / 'owner = ', l_s_details-owner .

  

8 REPLIES 8
Read only

former_member210541
Active Participant
0 Likes
2,002

You also need to supply OBJVERS in the ODSOBJECT structure

Read only

Former Member
0 Likes
2,003

Hi Sashankan,

This is source which you can check. You can cross check with your code and see your self what you have missed.

In the table RSDODSO you can check all the details of the DSO records.

Make sure you give correct value for this parameter OBJVERS               

REPORT  ZR_BAPI_DSO.

TYPE-POOLS rsdg.

  DATA: l_s_details        TYPE BAPI6116.
  DATA: l_s_return         TYPE BAPIRET2.
  DATA: l_t_infoobjects  TYPE TABLE OF BAPI6116IO.
   DATA: l_t_navigationattributes TYPE TABLE OF BAPI6116NA.
  
   DATA: l_t_indexes      TYPE TABLE OF BAPI6116IN.
   DATA: l_t_indexesinfoobjects TYPE TABLE OF BAPI6116II.
Parameter B_ODSOBJ like BAPI6116-ODSOBJECT default '0D_FC_D01'.


START-OF-SELECTION.

CALL FUNCTION 'BAPI_ODSO_GETDETAIL'
    EXPORTING
     OBJVERS                    = 'D' "RS_C_OBJVERS-ACTIVE
     ODSOBJECT                  = B_ODSOBJ
    IMPORTING
     DETAILS                    = l_s_details
     RETURN                     = l_s_return
    TABLES
     INFOOBJECTS                = l_t_infoobjects
     NAVIGATIONATTRIBUTES       = l_t_navigationattributes
     INDEXES                    = l_t_indexes
     INDEXESINFOOBJECTS         = l_t_indexesinfoobjects
             .

   Write : / 'ODSOBJECT =  ' ,l_s_details-odsobject,
           / 'objvers = ',l_s_details-objvers,
           / 'owner = ', l_s_details-owner .

  

Read only

0 Likes
2,002

Hello Abdul,

Thanks i was able to get the data for ODSOBJECT,OBJVERS&OWNER<... Now if i have to display the data from the tables(infoobjects) i want to display the IO in DSO also, how do i code?

I tried it but it says the the table has no header line.

Thanks in advance.

Read only

0 Likes
2,002

Just use this code to display infoobjects


DATA: l_w_infoobjects  TYPE BAPI6116IO.


LOOP AT l_t_infoobjects into l_w_infoobjects.
     WRITE: / l_w_infoobjects-INFOOBJECT.
   ENDLOOP.

Read only

0 Likes
2,002

Hello Abdul

Thanks for your help.. I have one more doubt is it possible to compare the DSO from dev and Quality by writing an ABAP code. I want compare the results of the above mentioned code..

Read only

0 Likes
2,002

Yes, every BAPI implementing FM is RFC enabled, so you can execute the BAPI in different destination and compare returned informations.

Regards,

Raymond

Read only

0 Likes
2,002

So just to be clear, the  code should also be present in the quality system ? Is it possible to write a code in DEV which calls teh quality system and get the result for quality?

Read only

0 Likes
2,002

The RFC executed FM must exist in target system, but the wrapper may only exist in the source system, so an Abap report in DEV can execute a standard RFC FM in QAS, provided you created a RFC destination.

Regards,

Raymond