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

How To validate Internal Tables

Former Member
0 Likes
675

Hi SAP guru's.

I have one query regarding validation of internal table.

In my requirement i am having one internal table with filelds MBRSH, MTART< WERKS VKORG,VKTWEG with Corresponding check tables T137, T134, T001W,TVKO. TVTW.

I need to validate these fields.If any of these record got failed in dont want that fields in my final internal Table.i.e Suppose for one record MTART got failed i dnt want the corresponding records for MBRSH,WERKS,VKORG,VTWEG.

Please help me with the sample code..

Will really appreciate your help.

Thanks

Simran.

Hi SAP guru's.

I have one query regarding validation of internal table.

In my requirement i am having one internal table with filelds MBRSH, MTART< WERKS VKORG,VKTWEG with Corresponding check tables T137, T134, T001W,TVKO. TVTW.

I need to validate these fields.If any of these record got failed in dont want that fields in my final internal Table.i.e Suppose for one record MTART got failed i dnt want the corresponding records for MBRSH,WERKS,VKORG,VTWEG.

Please help me with the sample code..

Will really appreciate your help.

Thanks

Simran.

2 REPLIES 2
Read only

Former Member
0 Likes
508

Hi,

Let's say it_tab1 is your internal table and you have to pass the valid records into it_tab2.

let say wa_tab1 & wa_tab2 are respective work area's for the above.

Data :flag(1) type c.

Loop at it_tab1 into wa_tab1.

IF(failure condition to validate mbrsh).

flag ='x'.

endif.

like this write validations for all fields.

at end of row.

if not flag = 'x'.

move wa_tab1 to wa_tab2.

append wa_tab2 to it_tab2.

endif.

endat.

clear :flag,wa_tab1,wa_tab2.

endloop.

regards,

viswa.

Read only

Former Member
0 Likes
508

Hi,

You have internal table, ITAB1 which has all the records,

Do the following

Loop at ITAB1 into WA_TAB1,

validation for MBRSH

if sy-subrc NE 0.

CONTINUE.

Endif.

validation for MTART

if sy-subrc NE 0.

CONTINUE.

Endif.

_

_

_

_

Do the same thing for all fields

Finally

APPEND WA_ITAB1 to ITAB2.

Endloop.

Regards,

Selva