Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Help on code

Hello All,

Here is some code and need to verify if its the right way for coding and how to better improve it.

The logic is based on DATA_PACKAGE-/BIC/ZCM_CUST get all the /BIC/ZBU_CUST . This will give the relation between these 2 elements. Now for each zcm_cust get the 4 attributes of zbu_cust and output the data. Can you help me with this code.

data: begin of itab occurs 100,

a type /BIC/OIZBU_CUST,

b type /BIC/OIZCM_CUST,

end of itab.

data : begin of itab2 occurs 100,

c type /BIC/OIZBU_NLVL,

d type /BIC/OIZBU_ISTAT,

e type /BIC/OIZBU_FDATE,

f type /BIC/OIZBU_NEWIN,

g type /BIC/OIZBU_CUST,

end of itab2.

break-point.

select /BIC/ZBU_CUST /BIC/ZCM_CUST from /BIC/QZBU_CUST into itab

for all entries in DATA_PACKAGE

where /BIC/ZCM_CUST = DATA_PACKAGE-/BIC/ZCM_CUST

and DATETO = '20050822'.

endselect.

select /BIC/ZBU_NLVL /BIC/ZBU_ISTAT /BIC/ZBU_FDATE /BIC/ZBU_NEWIN

/BIC/ZBU_CUST

from /BIC/PZBU_CUST

into itab2

for all entries in itab

where /BIC/ZBU_CUST = itab-a.

endselect.

Loop at DATA_PACKAGE.

read table itab with key b = DATA_PACKAGE-/BIC/ZCM_CUST

binary Search.

if sy-subrc = 0.

read table itab2 with key g = itab-a

binary search.

if sy-subrc = 0.

DATA_PACKAGE-/BIC/ZBU_NLVL = itab2-c.

DATA_PACKAGE-/BIC/ZBU_ISTAT = itab2-d.

DATA_PACKAGE-/BIC/ZBU_FDATE = itab2-e.

DATA_PACKAGE-/BIC/ZBU_NEWIN = itab2-f.

endif.

endif.

endloop.

thanks

amit

Tags:
replied

You get non-zero return codes either because the table isn't sorted or contains no entries. See my other answer.

Rob

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question