Skip to Content

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

How can we increse this coding Part

Hi there

I came across some coding to improve .while looking the progam it is unique .some say it is correct as per the Sap point of view .but some dosent.

Please verify is this the correct way for coding .

IF NOT skont IS INITIAL.

IF NOT aksaldo IS INITIAL.

IF NOT summen IS INITIAL.

LOOP AT organ.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM mbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM ebew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM qbew

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)

WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar

GROUP BY bwkey bklas bwtty bwtar.

CHECK NOT sum IS INITIAL.

MOVE f_bwkey TO xmbew-bwkey.

MOVE f_bklas TO xmbew-bklas.

MOVE f_bwtty TO xmbew-bwtty.

MOVE f_bwtar TO xmbew-bwtar.

MOVE sum TO xmbew-salk3.

COLLECT xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum. "n497391

SELECT bwkey bklas bwtty bwtar SUM( salk3 ) "n497391

FROM obew "n497391

INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum) "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bklas IN ibklas "n497391

AND bwtar IN bwtar "n497391

GROUP BY bwkey bklas bwtty bwtar. "n497391

CHECK NOT sum IS INITIAL. "n497391

MOVE f_bwkey TO xmbew-bwkey. "n497391

MOVE f_bklas TO xmbew-bklas. "n497391

MOVE f_bwtty TO xmbew-bwtty. "n497391

MOVE f_bwtar TO xmbew-bwtar. "n497391

MOVE sum TO xmbew-salk3. "n497391

COLLECT xmbew. "n497391

ENDSELECT. "n497391

ENDLOOP.

ELSEIF summen IS INITIAL.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lvorm lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty pstat vksal eklas qklas

FROM mbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar.

APPEND xmbew.

ENDSELECT.

  • Begin of Optima APP 037

IF NOT xmbew IS INITIAL.

  • Start of Insert E_FIR.018 PRADHSA1

SELECT matnr werks prctr

FROM marc

INTO TABLE i_marc

FOR ALL ENTRIES IN xmbew

WHERE matnr = xmbew-matnr

AND werks = xmbew-bwkey.

  • End of Insert E_FIR.018 PRADHSA1

ENDIF.

  • Begin of Optima APP 037

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz vbeln posnr

FROM ebew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar.

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

CLEAR xmbew. "388498

SELECT mandt matnr bwkey bwtar lbkum salk3

vprsv verpr stprs peinh bklas salkv lfgja lfmon

bwtty vksal sobkz pspnr

FROM qbew INTO CORRESPONDING FIELDS OF xmbew

FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey

AND matnr IN matnr

AND bklas IN ibklas

AND bwtar IN bwtar.

xmbew-no_sum = 'X'.

APPEND xmbew.

ENDSELECT.

  • consider valuated subcontractor stocks from OBEW "n497391

CLEAR xmbew. "n497391

SELECT mandt matnr bwkey bwtar lbkum salk3 "n497391

vprsv verpr stprs peinh bklas salkv "n497391

lfgja lfmon bwtty vksal sobkz lifnr "n497391

FROM obew INTO CORRESPONDING FIELDS OF xmbew "n497391

FOR ALL ENTRIES IN organ "n497391

WHERE bwkey EQ organ-bwkey "n497391

AND matnr IN matnr "n497391

AND bklas IN ibklas "n497391

AND bwtar IN bwtar. "n497391

xmbew-no_sum = 'X'. "n497391

APPEND xmbew. "n497391

ENDSELECT. "n497391

ENDIF.

Thanks in advance

Raja

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