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

Former Member
0 Likes
566

Hi experts,

suppose I hv a table with 5 different fields and suppose I wanted to delete duplicate entries of any one fields without deleting entire row of that table. How to do the same.

Shashikant

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
542

sort the table on that field.

Store the value in a variable.

check with the rows.

Wherever find that value, replace it with BLANK.

Modify the table for that row transporting that field.

Regards,

Amit

4 REPLIES 4
Read only

amit_khare
Active Contributor
0 Likes
543

sort the table on that field.

Store the value in a variable.

check with the rows.

Wherever find that value, replace it with BLANK.

Modify the table for that row transporting that field.

Regards,

Amit

Read only

Vijay
Active Contributor
0 Likes
542

hi

the sample code would be

sort itab by field f1.

itab1[] = itab[].

loop at itab1 into wa_itab1.

loop at itab1 into wa_itab2.

if wa_itab2-f1 = wa_itab1-f1.

count = count + 1.

endif.

if count ge 1.

clear wa_itab2-f1.

endif.

modify itab from wa_itab2 index sy-index.

endloop.

clear : wa_itab2

wa_itab1.

endloop.

regards

vijay

reward points if helpfull

Edited by: vijay sharma on Dec 19, 2007 12:23 PM

Read only

Former Member
0 Likes
542

can u send structure of the internal table and sample data.

Read only

0 Likes
542

I am writing a BAPI where I am using four tables

AGR_USERS(uname, agr_name), AGR_HIER(report), AGR_1016(profile), UST12(objct, field, von)

Now here i wan to display agr_name, report, profile, objct, field, von for the uname which user will enter. I want display the objct field von for all the profile the fields should not repeated for new valu of report.

My code is like this here it is repeating the values of ust12 fields for every new value of report

FUNCTION zbapi_autho_object .

*"----


""Local interface:

*" IMPORTING

*" VALUE(UNAME) TYPE XUBNAME

*" EXPORTING

*" VALUE(OUTPUT) TYPE ZST_ITAB

*" EXCEPTIONS

*" NO_RECORDS

*"----


*--


SHASHIKANT--


TYPES: BEGIN OF TY_TEMP,

UNAME TYPE AGUNAME,

AGR_NAME TYPE AGR_NAME,

REPORT TYPE EXTDREPORT,

PROFILE TYPE AGPROFILE,

END OF TY_TEMP.

DATA: IT_TEMP TYPE STANDARD TABLE OF TY_TEMP.

FIELD-SYMBOLS <FS_ITAB> LIKE LINE OF IT_TEMP.

DATA: BEGIN OF WA.

INCLUDE STRUCTURE ZAUTHO.

DATA: END OF WA.

SELECT puname pagr_name sreport tprofile

INTO CORRESPONDING FIELDS OF TABLE IT_TEMP

FROM agr_users AS p INNER JOIN agr_hier AS s ON sagr_name = pagr_name

INNER JOIN agr_1016 AS t ON tagr_name = pagr_name

WHERE p~uname EQ uname.

LOOP AT IT_TEMP ASSIGNING <FS_ITAB>.

CONCATENATE <FS_ITAB>-PROFILE '00' INTO <FS_ITAB>-PROFILE.

CONDENSE <FS_ITAB>-PROFILE NO-GAPS.

SELECT OBJCT FIELD VON INTO (WA-OBJCT, WA-FIELD, WA-VON)

FROM UST12 WHERE AUTH = <FS_ITAB>-PROFILE.

WA-UNAME = <FS_ITAB>-UNAME.

WA-AGR_NAME = <FS_ITAB>-AGR_NAME.

WA-report = <FS_ITAB>-report.

WA-PROFILE = <FS_ITAB>-PROFILE.

APPEND WA TO output.

ENDSELECT.

ENDLOOP.

ENDFUNCTION.

************************END********************************888

if anythig wan to ask pls give a call 9322468903 or give ur cell no.

Thanks