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

searching

Former Member
0 Likes
464

if i_open_posting[] is not initial.

*Fetching entry data from mkpf.

select mblnr mjahr cpudt from mkpf into table i_cpudt

for all entries in i_open_posting

where mblnr = i_open_posting-mblnr

and mjahr = i_open_posting-mjahr.

if sy-subrc = 0.

endif.

*looping at i_open_posting append the data into i_print_mat.

loop at i_open_posting into wa_open_posting.

move: wa_open_posting-mblnr to wa_print_mat-mblnr,

wa_open_posting-mbpos to wa_print_mat-mbpos,

wa_open_posting-bwart to wa_print_mat-bwart,

wa_open_posting-menge to wa_print_mat-menge,

wa_open_posting-meins to wa_print_mat-meins.

*looping at i_cpudt to append the data into i_print_mat.

read table i_cpudt into wa_cpudt with key mblnr = wa_open_posting-mblnr.

if sy-subrc = 0.

move wa_cpudt-cpudt to wa_print_mat-cpudt.

endif.

*looping at i_t156t to append the data into i_print_mat.

read table i_t156t into wa_t156t with key bwart = wa_open_posting-bwart.

if sy-subrc = 0.

move wa_t156t-btext to wa_print_mat-btext.

endif.

*Appending i_open_posting, i_cpudt, i_t156t into one i_print_mat.

append wa_print_mat to i_print_mat.

endloop.

*If the selection screen print option is 'Y'.

IF p_print EQ c_y.

loop at i_open_posting into wa_open_posting.

read table i_print_mat into wa_print_mat with key

mblnr = wa_open_posting-mblnr

bwart = wa_open_posting-bwart.

endloop.

ELSEIF p_print EQ c_n.

*If the selection screen print option is 'N'.

LOOP AT i_print_mat INTO wa_print_mat.

IF wa_print_mat-bwart EQ c_mt1

OR wa_print_mat-bwart EQ c_mt2

OR wa_print_mat-bwart EQ c_mt3

OR wa_print_mat-bwart EQ c_mt4

OR wa_print_mat-bwart EQ c_mt5

OR wa_print_mat-bwart EQ c_mt6.

DELETE i_print_mat INDEX sy-tabix.

endif.

endloop.

endif.

endif.

ENDFORM. " f_print_doc

FOR THE ABOVE CODE I NEED TO CHECK WHETHER BWART(131 movement type exist )

if so i neeed to delete the records for that movement type.

INSTEAD OF DELETING I NEED TO EXECUTE THIS STATEMENTS, WHEN I AM EXECUTING THIS STATEMENT, IF 131 DOESNT EXIST THEN ITS SKIPPING THE ENTIRE PROCESS.

loop at i_open_orders into wa_open_orders.

if wa_open_orders-bwart eq c_mt.

PERFORM f_idoc_907.

PERFORM f_idoc_860_757_54.

PERFORM f_idoc_335.

ELSE.

PERFORM f_idoc_errors_get.

  • PERFORM f_idoc_851.

PERFORM f_idoc850.

PERFORM f_idoc_52.

ENDIF.

endloop.

3 REPLIES 3
Read only

Former Member
0 Likes
442

u have written code as

loop at i_open_orders into wa_open_orders.

if wa_open_orders-bwart eq c_mt. <b>if this fails it will skip the reocrd for processing</b>.

PERFORM f_idoc_907.

PERFORM f_idoc_860_757_54.

PERFORM f_idoc_335.

ELSE.

PERFORM f_idoc_errors_get.

  • PERFORM f_idoc_851.

PERFORM f_idoc850.

PERFORM f_idoc_52.

ENDIF.

endloop.

<b>So, u have to see that write code in a way that if 131 is there delete the records else continue...</b>

Read only

0 Likes
442

if bwart has 131 it should move to

PERFORM f_idoc_907.

PERFORM f_idoc_860_757_54.

PERFORM f_idoc_335.

else if bwart has other than 131

PERFORM f_idoc_errors_get.

  • PERFORM f_idoc_851.

PERFORM f_idoc850.

PERFORM f_idoc_52.

ENDIF.

Read only

Former Member
0 Likes
442

put the code before endloop so that for each and every record it gets executed..

loop at i_open_posting into wa_open_posting.

move: wa_open_posting-mblnr to wa_print_mat-mblnr,

wa_open_posting-mbpos to wa_print_mat-mbpos,

wa_open_posting-bwart to wa_print_mat-bwart,

wa_open_posting-menge to wa_print_mat-menge,

wa_open_posting-meins to wa_print_mat-meins.

*looping at i_cpudt to append the data into i_print_mat.

read table i_cpudt into wa_cpudt with key mblnr = wa_open_posting-mblnr.

if sy-subrc = 0.

move wa_cpudt-cpudt to wa_print_mat-cpudt.

endif.

*looping at i_t156t to append the data into i_print_mat.

read table i_t156t into wa_t156t with key bwart = wa_open_posting-bwart.

if sy-subrc = 0.

move wa_t156t-btext to wa_print_mat-btext.

endif.

*Appending i_open_posting, i_cpudt, i_t156t into one i_print_mat.

append wa_print_mat to i_print_mat.

<b>if bwart has 131 it should move to

PERFORM f_idoc_907.

PERFORM f_idoc_860_757_54.

PERFORM f_idoc_335.

else if bwart has other than 131

PERFORM f_idoc_errors_get.

  • PERFORM f_idoc_851.

PERFORM f_idoc850.

PERFORM f_idoc_52.

ENDIF.</b>

endloop.